CC-2166: Packaging Improvements. Moved the Zend app into airtime_mvc. It is now installed to /var/www/airtime. Storage is now set to /srv/airtime/stor. Utils are now installed to /usr/lib/airtime/utils/. Added install/airtime-dircheck.php as a simple test to see if everything is install/uninstalled correctly.

This commit is contained in:
Paul Baranowski 2011-04-14 18:55:04 -04:00
parent 514777e8d2
commit b11cbd8159
4546 changed files with 138 additions and 51 deletions

View file

@ -0,0 +1,46 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_XmlRpc
* @subpackage Server
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Cache.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/** Zend_Server_Cache */
require_once 'Zend/Server/Cache.php';
/**
* Zend_XmlRpc_Server_Cache: cache Zend_XmlRpc_Server server definition
*
* @category Zend
* @package Zend_XmlRpc
* @subpackage Server
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_XmlRpc_Server_Cache extends Zend_Server_Cache
{
/**
* @var array Skip system methods when caching XML-RPC server
*/
protected static $_skipMethods = array(
'system.listMethods',
'system.methodHelp',
'system.methodSignature',
'system.multicall',
);
}

View file

@ -0,0 +1,42 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_XmlRpc
* @subpackage Server
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* Zend_XmlRpc_Exception
*/
require_once 'Zend/XmlRpc/Exception.php';
/**
* Zend_XmlRpc_Server_Exception
*
* @category Zend
* @package Zend_XmlRpc
* @subpackage Server
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_XmlRpc_Server_Exception extends Zend_XmlRpc_Exception
{
}

View file

@ -0,0 +1,201 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_XmlRpc
* @subpackage Server
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Fault.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* Zend_XmlRpc_Fault
*/
require_once 'Zend/XmlRpc/Fault.php';
/**
* XMLRPC Server Faults
*
* Encapsulates an exception for use as an XMLRPC fault response. Valid
* exception classes that may be used for generating the fault code and fault
* string can be attached using {@link attachFaultException()}; all others use a
* generic '404 Unknown error' response.
*
* You may also attach fault observers, which would allow you to monitor
* particular fault cases; this is done via {@link attachObserver()}. Observers
* need only implement a static 'observe' method.
*
* To allow method chaining, you may use the {@link getInstance()} factory
* to instantiate a Zend_XmlRpc_Server_Fault.
*
* @category Zend
* @package Zend_XmlRpc
* @subpackage Server
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_XmlRpc_Server_Fault extends Zend_XmlRpc_Fault
{
/**
* @var Exception
*/
protected $_exception;
/**
* @var array Array of exception classes that may define xmlrpc faults
*/
protected static $_faultExceptionClasses = array('Zend_XmlRpc_Server_Exception' => true);
/**
* @var array Array of fault observers
*/
protected static $_observers = array();
/**
* Constructor
*
* @param Exception $e
* @return Zend_XmlRpc_Server_Fault
*/
public function __construct(Exception $e)
{
$this->_exception = $e;
$code = 404;
$message = 'Unknown error';
$exceptionClass = get_class($e);
foreach (array_keys(self::$_faultExceptionClasses) as $class) {
if ($e instanceof $class) {
$code = $e->getCode();
$message = $e->getMessage();
break;
}
}
parent::__construct($code, $message);
// Notify exception observers, if present
if (!empty(self::$_observers)) {
foreach (array_keys(self::$_observers) as $observer) {
call_user_func(array($observer, 'observe'), $this);
}
}
}
/**
* Return Zend_XmlRpc_Server_Fault instance
*
* @param Exception $e
* @return Zend_XmlRpc_Server_Fault
*/
public static function getInstance(Exception $e)
{
return new self($e);
}
/**
* Attach valid exceptions that can be used to define xmlrpc faults
*
* @param string|array $classes Class name or array of class names
* @return void
*/
public static function attachFaultException($classes)
{
if (!is_array($classes)) {
$classes = (array) $classes;
}
foreach ($classes as $class) {
if (is_string($class) && class_exists($class)) {
self::$_faultExceptionClasses[$class] = true;
}
}
}
/**
* Detach fault exception classes
*
* @param string|array $classes Class name or array of class names
* @return void
*/
public static function detachFaultException($classes)
{
if (!is_array($classes)) {
$classes = (array) $classes;
}
foreach ($classes as $class) {
if (is_string($class) && isset(self::$_faultExceptionClasses[$class])) {
unset(self::$_faultExceptionClasses[$class]);
}
}
}
/**
* Attach an observer class
*
* Allows observation of xmlrpc server faults, thus allowing logging or mail
* notification of fault responses on the xmlrpc server.
*
* Expects a valid class name; that class must have a public static method
* 'observe' that accepts an exception as its sole argument.
*
* @param string $class
* @return boolean
*/
public static function attachObserver($class)
{
if (!is_string($class)
|| !class_exists($class)
|| !is_callable(array($class, 'observe')))
{
return false;
}
if (!isset(self::$_observers[$class])) {
self::$_observers[$class] = true;
}
return true;
}
/**
* Detach an observer
*
* @param string $class
* @return boolean
*/
public static function detachObserver($class)
{
if (!isset(self::$_observers[$class])) {
return false;
}
unset(self::$_observers[$class]);
return true;
}
/**
* Retrieve the exception
*
* @access public
* @return Exception
*/
public function getException()
{
return $this->_exception;
}
}

View file

@ -0,0 +1,162 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_XmlRpc
* @subpackage Server
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: System.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* XML-RPC system.* methods
*
* @category Zend
* @package Zend_XmlRpc
* @subpackage Server
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_XmlRpc_Server_System
{
/**
* @var Zend_XmlRpc_Server
*/
protected $_server;
/**
* Constructor
*
* @param Zend_XmlRpc_Server $server
* @return void
*/
public function __construct(Zend_XmlRpc_Server $server)
{
$this->_server = $server;
}
/**
* List all available XMLRPC methods
*
* Returns an array of methods.
*
* @return array
*/
public function listMethods()
{
$table = $this->_server->getDispatchTable()->getMethods();
return array_keys($table);
}
/**
* Display help message for an XMLRPC method
*
* @param string $method
* @return string
*/
public function methodHelp($method)
{
$table = $this->_server->getDispatchTable();
if (!$table->hasMethod($method)) {
require_once 'Zend/XmlRpc/Server/Exception.php';
throw new Zend_XmlRpc_Server_Exception('Method "' . $method . '" does not exist', 640);
}
return $table->getMethod($method)->getMethodHelp();
}
/**
* Return a method signature
*
* @param string $method
* @return array
*/
public function methodSignature($method)
{
$table = $this->_server->getDispatchTable();
if (!$table->hasMethod($method)) {
require_once 'Zend/XmlRpc/Server/Exception.php';
throw new Zend_XmlRpc_Server_Exception('Method "' . $method . '" does not exist', 640);
}
$method = $table->getMethod($method)->toArray();
return $method['prototypes'];
}
/**
* Multicall - boxcar feature of XML-RPC for calling multiple methods
* in a single request.
*
* Expects a an array of structs representing method calls, each element
* having the keys:
* - methodName
* - params
*
* Returns an array of responses, one for each method called, with the value
* returned by the method. If an error occurs for a given method, returns a
* struct with a fault response.
*
* @see http://www.xmlrpc.com/discuss/msgReader$1208
* @param array $methods
* @return array
*/
public function multicall($methods)
{
$responses = array();
foreach ($methods as $method) {
$fault = false;
if (!is_array($method)) {
$fault = $this->_server->fault('system.multicall expects each method to be a struct', 601);
} elseif (!isset($method['methodName'])) {
$fault = $this->_server->fault('Missing methodName: ' . var_export($methods, 1), 602);
} elseif (!isset($method['params'])) {
$fault = $this->_server->fault('Missing params', 603);
} elseif (!is_array($method['params'])) {
$fault = $this->_server->fault('Params must be an array', 604);
} else {
if ('system.multicall' == $method['methodName']) {
// don't allow recursive calls to multicall
$fault = $this->_server->fault('Recursive system.multicall forbidden', 605);
}
}
if (!$fault) {
try {
$request = new Zend_XmlRpc_Request();
$request->setMethod($method['methodName']);
$request->setParams($method['params']);
$response = $this->_server->handle($request);
if ($response instanceof Zend_XmlRpc_Fault
|| $response->isFault()
) {
$fault = $response;
} else {
$responses[] = $response->getReturnValue();
}
} catch (Exception $e) {
$fault = $this->_server->fault($e);
}
}
if ($fault) {
$responses[] = array(
'faultCode' => $fault->getCode(),
'faultString' => $fault->getMessage()
);
}
}
return $responses;
}
}