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:
parent
514777e8d2
commit
b11cbd8159
4546 changed files with 138 additions and 51 deletions
156
airtime_mvc/library/Zend/Tool/Framework/Loader/Abstract.php
Normal file
156
airtime_mvc/library/Zend/Tool/Framework/Loader/Abstract.php
Normal file
|
@ -0,0 +1,156 @@
|
|||
<?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_Tool
|
||||
* @subpackage Framework
|
||||
* @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: Abstract.php 20096 2010-01-06 02:05:09Z bkarwin $
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Tool_Framework_Registry_EnabledInterface
|
||||
*/
|
||||
require_once 'Zend/Tool/Framework/Registry/EnabledInterface.php';
|
||||
|
||||
require_once 'Zend/Tool/Framework/Loader/Interface.php';
|
||||
require_once 'Zend/Tool/Framework/Manifest/Interface.php';
|
||||
require_once 'Zend/Tool/Framework/Provider/Interface.php';
|
||||
|
||||
|
||||
/**
|
||||
* @category Zend
|
||||
* @package Zend_Tool
|
||||
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
abstract class Zend_Tool_Framework_Loader_Abstract
|
||||
implements Zend_Tool_Framework_Loader_Interface, Zend_Tool_Framework_Registry_EnabledInterface
|
||||
{
|
||||
/**
|
||||
* @var Zend_Tool_Framework_Repository_Interface
|
||||
*/
|
||||
protected $_registry = null;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private $_retrievedFiles = array();
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private $_loadedClasses = array();
|
||||
|
||||
/**
|
||||
* _getFiles
|
||||
*
|
||||
* @return array Array Of Files
|
||||
*/
|
||||
abstract protected function _getFiles();
|
||||
|
||||
/**
|
||||
* setRegistry() - required by the enabled interface to get an instance of
|
||||
* the registry
|
||||
*
|
||||
* @param Zend_Tool_Framework_Registry_Interface $registry
|
||||
* @return Zend_Tool_Framework_Loader_Abstract
|
||||
*/
|
||||
public function setRegistry(Zend_Tool_Framework_Registry_Interface $registry)
|
||||
{
|
||||
$this->_registry = $registry;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* load() - called by the client initialize routine to load files
|
||||
*
|
||||
*/
|
||||
public function load()
|
||||
{
|
||||
$this->_retrievedFiles = $this->getRetrievedFiles();
|
||||
$this->_loadedClasses = array();
|
||||
|
||||
$manifestRepository = $this->_registry->getManifestRepository();
|
||||
$providerRepository = $this->_registry->getProviderRepository();
|
||||
|
||||
$loadedClasses = array();
|
||||
|
||||
// loop through files and find the classes declared by loading the file
|
||||
foreach ($this->_retrievedFiles as $file) {
|
||||
if(is_dir($file)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$classesLoadedBefore = get_declared_classes();
|
||||
$oldLevel = error_reporting(E_ALL | ~E_STRICT); // remove strict so that other packages wont throw warnings
|
||||
// should we lint the files here? i think so
|
||||
include_once $file;
|
||||
error_reporting($oldLevel); // restore old error level
|
||||
$classesLoadedAfter = get_declared_classes();
|
||||
$loadedClasses = array_merge($loadedClasses, array_diff($classesLoadedAfter, $classesLoadedBefore));
|
||||
}
|
||||
|
||||
// loop through the loaded classes and ensure that
|
||||
foreach ($loadedClasses as $loadedClass) {
|
||||
|
||||
// reflect class to see if its something we want to load
|
||||
$reflectionClass = new ReflectionClass($loadedClass);
|
||||
if ($reflectionClass->implementsInterface('Zend_Tool_Framework_Manifest_Interface')
|
||||
&& !$reflectionClass->isAbstract())
|
||||
{
|
||||
$manifestRepository->addManifest($reflectionClass->newInstance());
|
||||
$this->_loadedClasses[] = $loadedClass;
|
||||
}
|
||||
|
||||
if ($reflectionClass->implementsInterface('Zend_Tool_Framework_Provider_Interface')
|
||||
&& !$reflectionClass->isAbstract()
|
||||
&& !$providerRepository->hasProvider($reflectionClass->getName(), false))
|
||||
{
|
||||
$providerRepository->addProvider($reflectionClass->newInstance());
|
||||
$this->_loadedClasses[] = $loadedClass;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $this->_loadedClasses;
|
||||
}
|
||||
|
||||
/**
|
||||
* getRetrievedFiles()
|
||||
*
|
||||
* @return array Array of Files Retrieved
|
||||
*/
|
||||
public function getRetrievedFiles()
|
||||
{
|
||||
if ($this->_retrievedFiles == null) {
|
||||
$this->_retrievedFiles = $this->_getFiles();
|
||||
}
|
||||
|
||||
return $this->_retrievedFiles;
|
||||
}
|
||||
|
||||
/**
|
||||
* getLoadedClasses()
|
||||
*
|
||||
* @return array Array of Loaded Classes
|
||||
*/
|
||||
public function getLoadedClasses()
|
||||
{
|
||||
return $this->_loadedClasses;
|
||||
}
|
||||
|
||||
|
||||
}
|
157
airtime_mvc/library/Zend/Tool/Framework/Loader/BasicLoader.php
Normal file
157
airtime_mvc/library/Zend/Tool/Framework/Loader/BasicLoader.php
Normal file
|
@ -0,0 +1,157 @@
|
|||
<?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_Tool
|
||||
* @subpackage Framework
|
||||
* @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: IncludePathLoader.php 18386 2009-09-23 20:44:43Z ralph $
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Tool_Framework_Loader_Abstract
|
||||
*/
|
||||
require_once 'Zend/Tool/Framework/Loader/Interface.php';
|
||||
|
||||
/**
|
||||
* @see Zend_Tool_Framework_Registry_EnabledInterface
|
||||
*/
|
||||
require_once 'Zend/Tool/Framework/Registry/EnabledInterface.php';
|
||||
|
||||
/**
|
||||
* @see Zend_Loader
|
||||
*/
|
||||
require_once 'Zend/Loader.php';
|
||||
require_once 'Zend/Tool/Framework/Manifest/Interface.php';
|
||||
require_once 'Zend/Tool/Framework/Provider/Interface.php';
|
||||
|
||||
/**
|
||||
* @category Zend
|
||||
* @package Zend_Tool
|
||||
* @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_Tool_Framework_Loader_BasicLoader
|
||||
implements Zend_Tool_Framework_Loader_Interface, Zend_Tool_Framework_Registry_EnabledInterface
|
||||
{
|
||||
/**
|
||||
* @var Zend_Tool_Framework_Repository_Interface
|
||||
*/
|
||||
protected $_registry = null;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $_classesToLoad = array();
|
||||
|
||||
public function __construct($options = array())
|
||||
{
|
||||
if ($options) {
|
||||
$this->setOptions($options);
|
||||
}
|
||||
}
|
||||
|
||||
public function setOptions(Array $options)
|
||||
{
|
||||
foreach ($options as $optionName => $optionValue) {
|
||||
$setMethod = 'set' . $optionName;
|
||||
if (method_exists($this, $setMethod)) {
|
||||
$this->{$setMethod}($optionValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* setRegistry() - required by the enabled interface to get an instance of
|
||||
* the registry
|
||||
*
|
||||
* @param Zend_Tool_Framework_Registry_Interface $registry
|
||||
* @return Zend_Tool_Framework_Loader_Abstract
|
||||
*/
|
||||
public function setRegistry(Zend_Tool_Framework_Registry_Interface $registry)
|
||||
{
|
||||
$this->_registry = $registry;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $classesToLoad
|
||||
* @return Zend_Tool_Framework_Loader_Abstract
|
||||
*/
|
||||
public function setClassesToLoad(array $classesToLoad)
|
||||
{
|
||||
$this->_classesToLoad = $classesToLoad;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function load()
|
||||
{
|
||||
$manifestRegistry = $this->_registry->getManifestRepository();
|
||||
$providerRegistry = $this->_registry->getProviderRepository();
|
||||
|
||||
$loadedClasses = array();
|
||||
|
||||
// loop through the loaded classes and ensure that
|
||||
foreach ($this->_classesToLoad as $class) {
|
||||
|
||||
if (!class_exists($class)) {
|
||||
Zend_Loader::loadClass($class);
|
||||
}
|
||||
|
||||
// reflect class to see if its something we want to load
|
||||
$reflectionClass = new ReflectionClass($class);
|
||||
if ($this->_isManifestImplementation($reflectionClass)) {
|
||||
$manifestRegistry->addManifest($reflectionClass->newInstance());
|
||||
$loadedClasses[] = $class;
|
||||
}
|
||||
|
||||
if ($this->_isProviderImplementation($reflectionClass)) {
|
||||
$providerRegistry->addProvider($reflectionClass->newInstance());
|
||||
$loadedClasses[] = $class;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $loadedClasses;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ReflectionClass $reflectionClass
|
||||
* @return bool
|
||||
*/
|
||||
private function _isManifestImplementation($reflectionClass)
|
||||
{
|
||||
return (
|
||||
$reflectionClass->implementsInterface('Zend_Tool_Framework_Manifest_Interface')
|
||||
&& !$reflectionClass->isAbstract()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ReflectionClass $reflectionClass
|
||||
* @return bool
|
||||
*/
|
||||
private function _isProviderImplementation($reflectionClass)
|
||||
{
|
||||
$providerRegistry = $this->_registry->getProviderRepository();
|
||||
|
||||
return (
|
||||
$reflectionClass->implementsInterface('Zend_Tool_Framework_Provider_Interface')
|
||||
&& !$reflectionClass->isAbstract()
|
||||
&& !$providerRegistry->hasProvider($reflectionClass->getName(), false)
|
||||
);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,139 @@
|
|||
<?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_Tool
|
||||
* @subpackage Framework
|
||||
* @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: IncludePathLoader.php 20903 2010-02-04 16:16:47Z matthew $
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Tool_Framework_Loader_Abstract
|
||||
*/
|
||||
require_once 'Zend/Tool/Framework/Loader/Abstract.php';
|
||||
|
||||
/**
|
||||
* @see Zend_Tool_Framework_Loader_IncludePathLoader_RecursiveFilterIterator
|
||||
*/
|
||||
require_once 'Zend/Tool/Framework/Loader/IncludePathLoader/RecursiveFilterIterator.php';
|
||||
|
||||
/**
|
||||
* @category Zend
|
||||
* @package Zend_Tool
|
||||
* @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_Tool_Framework_Loader_IncludePathLoader extends Zend_Tool_Framework_Loader_Abstract
|
||||
{
|
||||
|
||||
/**
|
||||
* _getFiles()
|
||||
*
|
||||
* @return array Array of files to load
|
||||
*/
|
||||
protected function _getFiles()
|
||||
{
|
||||
require_once 'Zend/Loader.php';
|
||||
$paths = Zend_Loader::explodeIncludePath();
|
||||
|
||||
// used for checking similarly named files
|
||||
$relativeItems = array();
|
||||
$files = array();
|
||||
$isZendTraversed = false;
|
||||
|
||||
foreach ($paths as $path) {
|
||||
|
||||
// default patterns to use
|
||||
$filterDenyDirectoryPattern = '.*(/|\\\\).svn';
|
||||
$filterAcceptFilePattern = '.*(?:Manifest|Provider)\.php$';
|
||||
|
||||
if (!file_exists($path) || $path[0] == '.') {
|
||||
continue;
|
||||
}
|
||||
|
||||
$realIncludePath = realpath($path);
|
||||
|
||||
// ensure that we only traverse a single version of Zend Framework on all include paths
|
||||
if (file_exists($realIncludePath . '/Zend/Tool/Framework/Loader/IncludePathLoader.php')) {
|
||||
if ($isZendTraversed === false) {
|
||||
$isZendTraversed = true;
|
||||
} else {
|
||||
// use the deny directory pattern that includes the path to 'Zend', it will not be accepted
|
||||
$filterDenyDirectoryPattern = '.*((/|\\\\).svn|' . preg_quote($realIncludePath . DIRECTORY_SEPARATOR) . 'Zend)';
|
||||
}
|
||||
}
|
||||
|
||||
// create recursive directory iterator
|
||||
$rdi = new RecursiveDirectoryIterator($path);
|
||||
|
||||
// pass in the RecursiveDirectoryIterator & the patterns
|
||||
$filter = new Zend_Tool_Framework_Loader_IncludePathLoader_RecursiveFilterIterator(
|
||||
$rdi,
|
||||
$filterDenyDirectoryPattern,
|
||||
$filterAcceptFilePattern
|
||||
);
|
||||
|
||||
// build the rii with the filter
|
||||
$iterator = new RecursiveIteratorIterator($filter);
|
||||
|
||||
// iterate over the accepted items
|
||||
foreach ($iterator as $item) {
|
||||
$file = (string)$item;
|
||||
if($this->_fileIsBlacklisted($file)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// ensure that the same named file from separate include_paths is not loaded
|
||||
$relativeItem = preg_replace('#^' . preg_quote($realIncludePath . DIRECTORY_SEPARATOR, '#') . '#', '', $item->getRealPath());
|
||||
|
||||
// no links allowed here for now
|
||||
if ($item->isLink()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// no items that are relavitely the same are allowed
|
||||
if (in_array($relativeItem, $relativeItems)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$relativeItems[] = $relativeItem;
|
||||
$files[] = $item->getRealPath();
|
||||
}
|
||||
}
|
||||
|
||||
return $files;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string $file
|
||||
* @return bool
|
||||
*/
|
||||
protected function _fileIsBlacklisted($file)
|
||||
{
|
||||
$blacklist = array(
|
||||
"PHPUnit".DIRECTORY_SEPARATOR."Framework",
|
||||
"Zend".DIRECTORY_SEPARATOR."OpenId".DIRECTORY_SEPARATOR."Provider"
|
||||
);
|
||||
|
||||
foreach($blacklist AS $blacklitedPattern) {
|
||||
if(strpos($file, $blacklitedPattern) !== false) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,91 @@
|
|||
<?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_Tool
|
||||
* @subpackage Framework
|
||||
* @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: RecursiveFilterIterator.php 20096 2010-01-06 02:05:09Z bkarwin $
|
||||
*/
|
||||
|
||||
/**
|
||||
* @category Zend
|
||||
* @package Zend_Tool
|
||||
* @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_Tool_Framework_Loader_IncludePathLoader_RecursiveFilterIterator extends RecursiveFilterIterator
|
||||
{
|
||||
|
||||
protected $_denyDirectoryPattern = null;
|
||||
protected $_acceptFilePattern = null;
|
||||
|
||||
/**
|
||||
* constructor
|
||||
*
|
||||
* @param RecursiveIterator $iterator
|
||||
* @param string $denyDirectoryPattern
|
||||
* @param string $acceptFilePattern
|
||||
*/
|
||||
public function __construct(RecursiveIterator $iterator, $denyDirectoryPattern = null, $acceptFilePattern = null)
|
||||
{
|
||||
$this->_denyDirectoryPattern = $denyDirectoryPattern;
|
||||
$this->_acceptFilePattern = $acceptFilePattern;
|
||||
parent::__construct($iterator);
|
||||
}
|
||||
|
||||
/**
|
||||
* accept() - Which iterable items to accept or deny, required by FilterInterface
|
||||
*
|
||||
* @return unknown
|
||||
*/
|
||||
public function accept()
|
||||
{
|
||||
$currentNode = $this->current();
|
||||
$currentNodeRealPath = $currentNode->getRealPath();
|
||||
|
||||
// if the current node is a directory AND doesn't match the denyDirectory pattern, accept
|
||||
if ($currentNode->isDir()
|
||||
&& !preg_match('#' . $this->_denyDirectoryPattern . '#', $currentNodeRealPath)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// if the file matches the accept file pattern, accept
|
||||
$acceptable = (preg_match('#' . $this->_acceptFilePattern . '#', $currentNodeRealPath)) ? true : false;
|
||||
return $acceptable;
|
||||
}
|
||||
|
||||
/**
|
||||
* getChildren() - overridden from RecursiveFilterIterator to allow the persistence of
|
||||
* the $_denyDirectoryPattern and the $_acceptFilePattern when sub iterators of this filter
|
||||
* are needed to be created.
|
||||
*
|
||||
* @return Zend_Tool_Framework_Loader_IncludePathLoader_RecursiveFilterIterator
|
||||
*/
|
||||
public function getChildren()
|
||||
{
|
||||
if (empty($this->ref)) {
|
||||
$this->ref = new ReflectionClass($this);
|
||||
}
|
||||
|
||||
return $this->ref->newInstance(
|
||||
$this->getInnerIterator()->getChildren(),
|
||||
$this->_denyDirectoryPattern,
|
||||
$this->_acceptFilePattern
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
42
airtime_mvc/library/Zend/Tool/Framework/Loader/Interface.php
Normal file
42
airtime_mvc/library/Zend/Tool/Framework/Loader/Interface.php
Normal 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 Tool
|
||||
* @subpackage Framework
|
||||
* @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$
|
||||
*/
|
||||
|
||||
/**
|
||||
* Basic Interface for factilities that load Zend_Tool providers or manifests.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Tool
|
||||
* @subpackage Framework
|
||||
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
interface Zend_Tool_Framework_Loader_Interface
|
||||
{
|
||||
/**
|
||||
* Load Providers and Manifests
|
||||
*
|
||||
* Returns an array of all loaded class names.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function load();
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue