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,78 @@
<?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_Test
* @subpackage PHPUnit
* @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: DbRowset.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Db_Table_Rowset_Abstract
*/
require_once "Zend/Db/Table/Rowset/Abstract.php";
/**
* @see PHPUnit_Extensions_Database_DataSet_AbstractTable
*/
require_once "PHPUnit/Extensions/Database/DataSet/AbstractTable.php";
/**
* Use a Zend_Db Rowset as a datatable for assertions with other PHPUnit Database extension tables.
*
* @uses PHPUnit_Extensions_Database_DataSet_AbstractTable
* @category Zend
* @package Zend_Test
* @subpackage PHPUnit
* @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_Test_PHPUnit_Db_DataSet_DbRowset extends PHPUnit_Extensions_Database_DataSet_AbstractTable
{
/**
* Construct Table object from a Zend_Db_Table_Rowset
*
* @param Zend_Db_Table_Rowset_Abstract $rowset
* @param string $tableName
*/
public function __construct(Zend_Db_Table_Rowset_Abstract $rowset, $tableName = null)
{
if($tableName == null) {
$table = $rowset->getTable();
if($table !== null) {
$tableName = $table->info('name');
} else {
require_once "Zend/Test/PHPUnit/Db/Exception.php";
throw new Zend_Test_PHPUnit_Db_Exception(
'No table name was given to Rowset Table and table name cannot be infered from the table, '.
'because the rowset is disconnected from database.'
);
}
}
$this->data = $rowset->toArray();
$columns = array();
if(isset($this->data[0]) > 0) {
$columns = array_keys($this->data[0]);
} else if($rowset->getTable() != null) {
$columns = $rowset->getTable()->info('cols');
}
$this->tableName = $tableName;
$this->tableMetaData = new PHPUnit_Extensions_Database_DataSet_DefaultTableMetaData($this->tableName, $columns);
}
}

View file

@ -0,0 +1,125 @@
<?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_Test
* @subpackage PHPUnit
* @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: DbTable.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see PHPUnit_Extensions_Database_DataSet_QueryTable
*/
require_once "PHPUnit/Extensions/Database/DataSet/QueryTable.php";
/**
* @see Zend_Db_Table_Abstract
*/
require_once "Zend/Db/Table/Abstract.php";
/**
* Use a Zend_Db_Table for assertions with other PHPUnit Database Extension table types.
*
* @uses PHPUnit_Extensions_Database_DataSet_QueryTable
* @category Zend
* @package Zend_Test
* @subpackage PHPUnit
* @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_Test_PHPUnit_Db_DataSet_DbTable extends PHPUnit_Extensions_Database_DataSet_QueryTable
{
/**
* Zend_Db_Table object
*
* @var Zend_Db_Table_Abstract
*/
protected $_table = null;
/**
* @var array
*/
protected $_columns = array();
/**
* @var string
*/
protected $_where = null;
/**
* @var string
*/
protected $_orderBy = null;
/**
* @var string
*/
protected $_count = null;
/**
* @var int
*/
protected $_offset = null;
/**
* Construct Dataset Table from Zend_Db_Table object
*
* @param Zend_Db_Table_Abstract $table
* @param string|Zend_Db_Select|null $where
* @param string|null $order
* @param int $count
* @param int $offset
*/
public function __construct(Zend_Db_Table_Abstract $table, $where=null, $order=null, $count=null, $offset=null)
{
$this->tableName = $table->info('name');
$this->_columns = $table->info('cols');
$this->_table = $table;
$this->_where = $where;
$this->_order = $order;
$this->_count = $count;
$this->_offset = $offset;
}
/**
* Lazy load data via table fetchAll() method.
*
* @return void
*/
protected function loadData()
{
if ($this->data === null) {
$this->data = $this->_table->fetchAll(
$this->_where, $this->_order, $this->_count, $this->_offset
);
if($this->data instanceof Zend_Db_Table_Rowset_Abstract) {
$this->data = $this->data->toArray();
}
}
}
/**
* Create Table Metadata object
*/
protected function createTableMetaData()
{
if ($this->tableMetaData === NULL) {
$this->loadData();
$this->tableMetaData = new PHPUnit_Extensions_Database_DataSet_DefaultTableMetaData($this->tableName, $this->_columns);
}
}
}

View file

@ -0,0 +1,103 @@
<?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_Test
* @subpackage PHPUnit
* @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: DbTableDataSet.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
require_once "PHPUnit/Extensions/Database/DataSet/QueryDataSet.php";
require_once "PHPUnit/Extensions/Database/DB/IDatabaseConnection.php";
/**
* @see Zend_Test_PHPUnit_Db_DataSet_DbTable
*/
require_once "Zend/Test/PHPUnit/Db/DataSet/DbTable.php";
/**
* Aggregate several Zend_Db_Table instances into a dataset.
*
* @uses Zend_Db_Table
* @category Zend
* @package Zend_Test
* @subpackage PHPUnit
* @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_Test_PHPUnit_Db_DataSet_DbTableDataSet extends PHPUnit_Extensions_Database_DataSet_AbstractDataSet
{
/**
* @var array
*/
protected $tables = array();
/**
* Add a Table dataset representation by specifiying an arbitrary select query.
*
* By default a select * will be done on the given tablename.
*
* @param Zend_Db_Table_Abstract $table
* @param string|Zend_Db_Select $query
* @param string $where
* @param string $order
* @param string $count
* @param string $offset
*/
public function addTable(Zend_Db_Table_Abstract $table, $where = null, $order = null, $count = null, $offset = null)
{
$tableName = $table->info('name');
$this->tables[$tableName] = new Zend_Test_PHPUnit_Db_DataSet_DbTable($table, $where, $order, $count, $offset);
}
/**
* Creates an iterator over the tables in the data set. If $reverse is
* true a reverse iterator will be returned.
*
* @param bool $reverse
* @return PHPUnit_Extensions_Database_DB_TableIterator
*/
protected function createIterator($reverse = FALSE)
{
return new PHPUnit_Extensions_Database_DataSet_DefaultTableIterator($this->tables, $reverse);
}
/**
* Returns a table object for the given table.
*
* @param string $tableName
* @return PHPUnit_Extensions_Database_DB_Table
*/
public function getTable($tableName)
{
if (!isset($this->tables[$tableName])) {
throw new InvalidArgumentException("$tableName is not a table in the current database.");
}
return $this->tables[$tableName];
}
/**
* Returns a list of table names for the database
*
* @return Array
*/
public function getTableNames()
{
return array_keys($this->tables);
}
}

View file

@ -0,0 +1,90 @@
<?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_Test
* @subpackage PHPUnit
* @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: QueryDataSet.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see PHPUnit_Extensions_Database_DataSet_QueryDataSet
*/
require_once "PHPUnit/Extensions/Database/DataSet/QueryDataSet.php";
/**
* @see PHPUnit_Extensions_Database_DB_IDatabaseConnection
*/
require_once "PHPUnit/Extensions/Database/DB/IDatabaseConnection.php";
/**
* @see Zend_Test_PHPUnit_Db_DataSet_QueryTable
*/
require_once "Zend/Test/PHPUnit/Db/DataSet/QueryTable.php";
/**
* @see Zend_Db_Select
*/
require_once "Zend/Db/Select.php";
/**
* Uses several query strings or Zend_Db_Select objects to form a dataset of tables for assertion with other datasets.
*
* @uses PHPUnit_Extensions_Database_DataSet_QueryDataSet
* @category Zend
* @package Zend_Test
* @subpackage PHPUnit
* @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_Test_PHPUnit_Db_DataSet_QueryDataSet extends PHPUnit_Extensions_Database_DataSet_QueryDataSet
{
/**
* Creates a new dataset using the given database connection.
*
* @param PHPUnit_Extensions_Database_DB_IDatabaseConnection $databaseConnection
*/
public function __construct(PHPUnit_Extensions_Database_DB_IDatabaseConnection $databaseConnection)
{
if( !($databaseConnection instanceof Zend_Test_PHPUnit_Db_Connection) ) {
require_once "Zend/Test/PHPUnit/Db/Exception.php";
throw new Zend_Test_PHPUnit_Db_Exception("Zend_Test_PHPUnit_Db_DataSet_QueryDataSet only works with Zend_Test_PHPUnit_Db_Connection connections-");
}
$this->databaseConnection = $databaseConnection;
}
/**
* Add a Table dataset representation by specifiying an arbitrary select query.
*
* By default a select * will be done on the given tablename.
*
* @param string $tableName
* @param string|Zend_Db_Select $query
*/
public function addTable($tableName, $query = NULL)
{
if ($query === NULL) {
$query = $this->databaseConnection->getConnection()->select();
$query->from($tableName, Zend_Db_Select::SQL_WILDCARD);
}
if($query instanceof Zend_Db_Select) {
$query = $query->__toString();
}
$this->tables[$tableName] = new Zend_Test_PHPUnit_Db_DataSet_QueryTable($tableName, $query, $this->databaseConnection);
}
}

View file

@ -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_Test
* @subpackage PHPUnit
* @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: QueryTable.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see PHPUnit_Extensions_Database_DataSet_QueryTable
*/
require_once "PHPUnit/Extensions/Database/DataSet/QueryTable.php";
/**
* @see PHPUnit_Extensions_Database_DB_IDatabaseConnection
*/
require_once "PHPUnit/Extensions/Database/DB/IDatabaseConnection.php";
/**
* Represent a PHPUnit Database Extension table with Queries using a Zend_Db adapter for assertion against other tables.
*
* @uses PHPUnit_Extensions_Database_DataSet_QueryTable
* @category Zend
* @package Zend_Test
* @subpackage PHPUnit
* @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_Test_PHPUnit_Db_DataSet_QueryTable extends PHPUnit_Extensions_Database_DataSet_QueryTable
{
/**
* Creates a new database query table object.
*
* @param string $table_name
* @param string $query
* @param PHPUnit_Extensions_Database_DB_IDatabaseConnection $databaseConnection
*/
public function __construct($tableName, $query, PHPUnit_Extensions_Database_DB_IDatabaseConnection $databaseConnection)
{
if( !($databaseConnection instanceof Zend_Test_PHPUnit_Db_Connection) ) {
require_once "Zend/Test/PHPUnit/Db/Exception.php";
throw new Zend_Test_PHPUnit_Db_Exception("Zend_Test_PHPUnit_Db_DataSet_QueryTable only works with Zend_Test_PHPUnit_Db_Connection connections-");
}
parent::__construct($tableName, $query, $databaseConnection);
}
/**
* Load data from the database.
*
* @return void
*/
protected function loadData()
{
if($this->data === null) {
$stmt = $this->databaseConnection->getConnection()->query($this->query);
$this->data = $stmt->fetchAll(Zend_Db::FETCH_ASSOC);
}
}
/**
* Create Table Metadata
*/
protected function createTableMetaData()
{
if ($this->tableMetaData === NULL)
{
$this->loadData();
$keys = array();
if(count($this->data) > 0) {
$keys = array_keys($this->data[0]);
}
$this->tableMetaData = new PHPUnit_Extensions_Database_DataSet_DefaultTableMetaData(
$this->tableName, $keys
);
}
}
}