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,319 @@
<?php
/**
* This file is part of the Propel package.
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @license MIT License
*/
/**
* This class contains attributes and methods that are used by all
* business objects within the system.
*
* @author Hans Lellelid <hans@xmpl.org> (Propel)
* @author Frank Y. Kim <frank.kim@clearink.com> (Torque)
* @author John D. McNally <jmcnally@collab.net> (Torque)
* @version $Revision: 1673 $
* @package propel.runtime.om
*/
abstract class BaseObject
{
/**
* attribute to determine if this object has previously been saved.
* @var boolean
*/
protected $_new = true;
/**
* attribute to determine whether this object has been deleted.
* @var boolean
*/
protected $_deleted = false;
/**
* The columns that have been modified in current object.
* Tracking modified columns allows us to only update modified columns.
* @var array
*/
protected $modifiedColumns = array();
/**
* The (virtual) columns that are added at runtime
* The formatters can add supplementary columns based on a resultset
* @var array
*/
protected $virtualColumns = array();
/**
* Empty constructor (this allows people with their own BaseObject implementation to use its constructor)
*/
public function __construct() {
}
/**
* Returns whether the object has been modified.
*
* @return boolean True if the object has been modified.
*/
public function isModified()
{
return !empty($this->modifiedColumns);
}
/**
* Has specified column been modified?
*
* @param string $col column fully qualified name (BasePeer::TYPE_COLNAME), e.g. Book::AUTHOR_ID
* @return boolean True if $col has been modified.
*/
public function isColumnModified($col)
{
return in_array($col, $this->modifiedColumns);
}
/**
* Get the columns that have been modified in this object.
* @return array A unique list of the modified column names for this object.
*/
public function getModifiedColumns()
{
return array_unique($this->modifiedColumns);
}
/**
* Returns whether the object has ever been saved. This will
* be false, if the object was retrieved from storage or was created
* and then saved.
*
* @return true, if the object has never been persisted.
*/
public function isNew()
{
return $this->_new;
}
/**
* Setter for the isNew attribute. This method will be called
* by Propel-generated children and Peers.
*
* @param boolean $b the state of the object.
*/
public function setNew($b)
{
$this->_new = (boolean) $b;
}
/**
* Whether this object has been deleted.
* @return boolean The deleted state of this object.
*/
public function isDeleted()
{
return $this->_deleted;
}
/**
* Specify whether this object has been deleted.
* @param boolean $b The deleted state of this object.
* @return void
*/
public function setDeleted($b)
{
$this->_deleted = (boolean) $b;
}
/**
* Code to be run before persisting the object
* @param PropelPDO $con
* @return bloolean
*/
public function preSave(PropelPDO $con = null)
{
return true;
}
/**
* Code to be run after persisting the object
* @param PropelPDO $con
*/
public function postSave(PropelPDO $con = null) { }
/**
* Code to be run before inserting to database
* @param PropelPDO $con
* @return boolean
*/
public function preInsert(PropelPDO $con = null)
{
return true;
}
/**
* Code to be run after inserting to database
* @param PropelPDO $con
*/
public function postInsert(PropelPDO $con = null) { }
/**
* Code to be run before updating the object in database
* @param PropelPDO $con
* @return boolean
*/
public function preUpdate(PropelPDO $con = null)
{
return true;
}
/**
* Code to be run after updating the object in database
* @param PropelPDO $con
*/
public function postUpdate(PropelPDO $con = null) { }
/**
* Code to be run before deleting the object in database
* @param PropelPDO $con
* @return boolean
*/
public function preDelete(PropelPDO $con = null)
{
return true;
}
/**
* Code to be run after deleting the object in database
* @param PropelPDO $con
*/
public function postDelete(PropelPDO $con = null) { }
/**
* Sets the modified state for the object to be false.
* @param string $col If supplied, only the specified column is reset.
* @return void
*/
public function resetModified($col = null)
{
if ($col !== null) {
while (($offset = array_search($col, $this->modifiedColumns)) !== false) {
array_splice($this->modifiedColumns, $offset, 1);
}
} else {
$this->modifiedColumns = array();
}
}
/**
* Compares this with another <code>BaseObject</code> instance. If
* <code>obj</code> is an instance of <code>BaseObject</code>, delegates to
* <code>equals(BaseObject)</code>. Otherwise, returns <code>false</code>.
*
* @param obj The object to compare to.
* @return Whether equal to the object specified.
*/
public function equals($obj)
{
$thisclazz = get_class($this);
if (is_object($obj) && $obj instanceof $thisclazz) {
if ($this === $obj) {
return true;
} elseif ($this->getPrimaryKey() === null || $obj->getPrimaryKey() === null) {
return false;
} else {
return ($this->getPrimaryKey() === $obj->getPrimaryKey());
}
} else {
return false;
}
}
/**
* If the primary key is not <code>null</code>, return the hashcode of the
* primary key. Otherwise calls <code>Object.hashCode()</code>.
*
* @return int Hashcode
*/
public function hashCode()
{
$ok = $this->getPrimaryKey();
if ($ok === null) {
return crc32(serialize($this));
}
return crc32(serialize($ok)); // serialize because it could be an array ("ComboKey")
}
/**
* Get the associative array of the virtual columns in this object
*
* @param string $name The virtual column name
*
* @return array
*/
public function getVirtualColumns()
{
return $this->virtualColumns;
}
/**
* Checks the existence of a virtual column in this object
*
* @return boolean
*/
public function hasVirtualColumn($name)
{
return array_key_exists($name, $this->virtualColumns);
}
/**
* Get the value of a virtual column in this object
*
* @return mixed
*/
public function getVirtualColumn($name)
{
if (!$this->hasVirtualColumn($name)) {
throw new PropelException('Cannot get value of inexistent virtual column ' . $name);
}
return $this->virtualColumns[$name];
}
/**
* Get the value of a virtual column in this object
*
* @param string $name The virtual column name
* @param mixed $value The value to give to the virtual column
*
* @return BaseObject The current object, for fluid interface
*/
public function setVirtualColumn($name, $value)
{
$this->virtualColumns[$name] = $value;
return $this;
}
/**
* Logs a message using Propel::log().
*
* @param string $msg
* @param int $priority One of the Propel::LOG_* logging levels
* @return boolean
*/
protected function log($msg, $priority = Propel::LOG_INFO)
{
return Propel::log(get_class($this) . ': ' . $msg, $priority);
}
/**
* Clean up internal collections prior to serializing
* Avoids recursive loops that turn into segmentation faults when serializing
*/
public function __sleep()
{
$this->clearAllReferences();
return array_keys(get_object_vars($this));
}
}

View file

@ -0,0 +1,86 @@
<?php
/**
* This file is part of the Propel package.
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @license MIT License
*/
/**
* Pre-order node iterator for Node objects.
*
* @author Heltem <heltem@o2php.com>
* @version $Revision: 1612 $
* @package propel.runtime.om
*/
class NestedSetRecursiveIterator implements RecursiveIterator
{
protected $topNode = null;
protected $curNode = null;
public function __construct($node)
{
$this->topNode = $node;
$this->curNode = $node;
}
public function rewind()
{
$this->curNode = $this->topNode;
}
public function valid()
{
return ($this->curNode !== null);
}
public function current()
{
return $this->curNode;
}
public function key()
{
$method = method_exists($this->curNode, 'getPath') ? 'getPath' : 'getAncestors';
$key = array();
foreach ($this->curNode->$method() as $node) {
$key[] = $node->getPrimaryKey();
}
return implode('.', $key);
}
public function next()
{
$nextNode = null;
$method = method_exists($this->curNode, 'retrieveNextSibling') ? 'retrieveNextSibling' : 'getNextSibling';
if ($this->valid()) {
while (null === $nextNode) {
if (null === $this->curNode) {
break;
}
if ($this->curNode->hasNextSibling()) {
$nextNode = $this->curNode->$method();
} else {
break;
}
}
$this->curNode = $nextNode;
}
return $this->curNode;
}
public function hasChildren()
{
return $this->curNode->hasChildren();
}
public function getChildren()
{
$method = method_exists($this->curNode, 'retrieveFirstChild') ? 'retrieveFirstChild' : 'getFirstChild';
return new NestedSetRecursiveIterator($this->curNode->$method());
}
}

View file

@ -0,0 +1,324 @@
<?php
/**
* This file is part of the Propel package.
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @license MIT License
*/
/**
* This interface defines methods that must be implemented by all
* business objects within the system to handle Node object.
*
* @author Heltem <heltem@o2php.com> (Propel)
* @version $Revision: 1612 $
* @package propel.runtime.om
*/
interface NodeObject extends IteratorAggregate
{
/**
* If object is saved without left/right values, set them as undefined (0)
*
* @param PropelPDO $con Connection to use.
* @return void
* @throws PropelException
*/
public function save(PropelPDO $con = null);
/**
* Delete node and descendants
*
* @param PropelPDO $con Connection to use.
* @return void
* @throws PropelException
*/
public function delete(PropelPDO $con = null);
/**
* Sets node properties to make it a root node.
*
* @return object The current object (for fluent API support)
* @throws PropelException
*/
public function makeRoot();
/**
* Gets the level if set, otherwise calculates this and returns it
*
* @param PropelPDO $con Connection to use.
* @return int
*/
public function getLevel(PropelPDO $con = null);
/**
* Get the path to the node in the tree
*
* @param PropelPDO $con Connection to use.
* @return array
*/
public function getPath(PropelPDO $con = null);
/**
* Gets the number of children for the node (direct descendants)
*
* @param PropelPDO $con Connection to use.
* @return int
*/
public function getNumberOfChildren(PropelPDO $con = null);
/**
* Gets the total number of desceandants for the node
*
* @param PropelPDO $con Connection to use.
* @return int
*/
public function getNumberOfDescendants(PropelPDO $con = null);
/**
* Gets the children for the node
*
* @param PropelPDO $con Connection to use.
* @return array
*/
public function getChildren(PropelPDO $con = null);
/**
* Gets the descendants for the node
*
* @param PropelPDO $con Connection to use.
* @return array
*/
public function getDescendants(PropelPDO $con = null);
/**
* Sets the level of the node in the tree
*
* @param int $v new value
* @return object The current object (for fluent API support)
*/
public function setLevel($level);
/**
* Sets the children array of the node in the tree
*
* @param array of Node $children array of Propel node object
* @return object The current object (for fluent API support)
*/
public function setChildren(array $children);
/**
* Sets the parentNode of the node in the tree
*
* @param Node $parent Propel node object
* @return object The current object (for fluent API support)
*/
public function setParentNode(NodeObject $parent = null);
/**
* Sets the previous sibling of the node in the tree
*
* @param Node $node Propel node object
* @return object The current object (for fluent API support)
*/
public function setPrevSibling(NodeObject $node = null);
/**
* Sets the next sibling of the node in the tree
*
* @param Node $node Propel node object
* @return object The current object (for fluent API support)
*/
public function setNextSibling(NodeObject $node = null);
/**
* Determines if the node is the root node
*
* @return bool
*/
public function isRoot();
/**
* Determines if the node is a leaf node
*
* @return bool
*/
public function isLeaf();
/**
* Tests if object is equal to $node
*
* @param object $node Propel object for node to compare to
* @return bool
*/
public function isEqualTo(NodeObject $node);
/**
* Tests if object has an ancestor
*
* @param PropelPDO $con Connection to use.
* @return bool
*/
public function hasParent(PropelPDO $con = null);
/**
* Determines if the node has children / descendants
*
* @return bool
*/
public function hasChildren();
/**
* Determines if the node has previous sibling
*
* @param PropelPDO $con Connection to use.
* @return bool
*/
public function hasPrevSibling(PropelPDO $con = null);
/**
* Determines if the node has next sibling
*
* @param PropelPDO $con Connection to use.
* @return bool
*/
public function hasNextSibling(PropelPDO $con = null);
/**
* Gets ancestor for the given node if it exists
*
* @param PropelPDO $con Connection to use.
* @return mixed Propel object if exists else false
*/
public function retrieveParent(PropelPDO $con = null);
/**
* Gets first child if it exists
*
* @param PropelPDO $con Connection to use.
* @return mixed Propel object if exists else false
*/
public function retrieveFirstChild(PropelPDO $con = null);
/**
* Gets last child if it exists
*
* @param PropelPDO $con Connection to use.
* @return mixed Propel object if exists else false
*/
public function retrieveLastChild(PropelPDO $con = null);
/**
* Gets prev sibling for the given node if it exists
*
* @param PropelPDO $con Connection to use.
* @return mixed Propel object if exists else false
*/
public function retrievePrevSibling(PropelPDO $con = null);
/**
* Gets next sibling for the given node if it exists
*
* @param PropelPDO $con Connection to use.
* @return mixed Propel object if exists else false
*/
public function retrieveNextSibling(PropelPDO $con = null);
/**
* Inserts as first child of destination node $parent
*
* @param object $parent Propel object for given destination node
* @param PropelPDO $con Connection to use.
* @return object The current object (for fluent API support)
*/
public function insertAsFirstChildOf(NodeObject $parent, PropelPDO $con = null);
/**
* Inserts as last child of destination node $parent
*
* @param object $parent Propel object for given destination node
* @param PropelPDO $con Connection to use.
* @return object The current object (for fluent API support)
*/
public function insertAsLastChildOf(NodeObject $parent, PropelPDO $con = null);
/**
* Inserts node as previous sibling to destination node $dest
*
* @param object $dest Propel object for given destination node
* @param PropelPDO $con Connection to use.
* @return object The current object (for fluent API support)
*/
public function insertAsPrevSiblingOf(NodeObject $dest, PropelPDO $con = null);
/**
* Inserts node as next sibling to destination node $dest
*
* @param object $dest Propel object for given destination node
* @param PropelPDO $con Connection to use.
* @return object The current object (for fluent API support)
*/
public function insertAsNextSiblingOf(NodeObject $dest, PropelPDO $con = null);
/**
* Moves node to be first child of $parent
*
* @param object $parent Propel object for destination node
* @param PropelPDO $con Connection to use.
* @return void
*/
public function moveToFirstChildOf(NodeObject $parent, PropelPDO $con = null);
/**
* Moves node to be last child of $parent
*
* @param object $parent Propel object for destination node
* @param PropelPDO $con Connection to use.
* @return void
*/
public function moveToLastChildOf(NodeObject $parent, PropelPDO $con = null);
/**
* Moves node to be prev sibling to $dest
*
* @param object $dest Propel object for destination node
* @param PropelPDO $con Connection to use.
* @return void
*/
public function moveToPrevSiblingOf(NodeObject $dest, PropelPDO $con = null);
/**
* Moves node to be next sibling to $dest
*
* @param object $dest Propel object for destination node
* @param PropelPDO $con Connection to use.
* @return void
*/
public function moveToNextSiblingOf(NodeObject $dest, PropelPDO $con = null);
/**
* Inserts node as parent of given node.
*
* @param object $node Propel object for given destination node
* @param PropelPDO $con Connection to use.
* @return void
* @throws Exception When trying to insert node as parent of a root node
*/
public function insertAsParentOf(NodeObject $node, PropelPDO $con = null);
/**
* Wraps the getter for the scope value
*
* @return int
*/
public function getScopeIdValue();
/**
* Set the value of scope column
*
* @param int $v new value
* @return object The current object (for fluent API support)
*/
public function setScopeIdValue($v);
} // NodeObject

View file

@ -0,0 +1,108 @@
<?php
/**
* This file is part of the Propel package.
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @license MIT License
*/
/**
* This interface defines methods related to saving an object
*
* @author Hans Lellelid <hans@xmpl.org> (Propel)
* @author John D. McNally <jmcnally@collab.net> (Torque)
* @author Fedor K. <fedor@apache.org> (Torque)
* @version $Revision: 1612 $
* @package propel.runtime.om
*/
interface Persistent
{
/**
* getter for the object primaryKey.
*
* @return ObjectKey the object primaryKey as an Object
*/
public function getPrimaryKey();
/**
* Sets the PrimaryKey for the object.
*
* @param mixed $primaryKey The new PrimaryKey object or string (result of PrimaryKey.toString()).
* @return void
* @throws Exception, This method might throw an exceptions
*/
public function setPrimaryKey($primaryKey);
/**
* Returns whether the object has been modified, since it was
* last retrieved from storage.
*
* @return boolean True if the object has been modified.
*/
public function isModified();
/**
* Has specified column been modified?
*
* @param string $col
* @return boolean True if $col has been modified.
*/
public function isColumnModified($col);
/**
* Returns whether the object has ever been saved. This will
* be false, if the object was retrieved from storage or was created
* and then saved.
*
* @return boolean True, if the object has never been persisted.
*/
public function isNew();
/**
* Setter for the isNew attribute. This method will be called
* by Propel-generated children and Peers.
*
* @param boolean $b the state of the object.
*/
public function setNew($b);
/**
* Resets (to false) the "modified" state for this object.
*
* @return void
*/
public function resetModified();
/**
* Whether this object has been deleted.
* @return boolean The deleted state of this object.
*/
public function isDeleted();
/**
* Specify whether this object has been deleted.
* @param boolean $b The deleted state of this object.
* @return void
*/
public function setDeleted($b);
/**
* Deletes the object.
* @param PropelPDO $con
* @return void
* @throws Exception
*/
public function delete(PropelPDO $con = null);
/**
* Saves the object.
* @param PropelPDO $con
* @return void
* @throws Exception
*/
public function save(PropelPDO $con = null);
}

View file

@ -0,0 +1,78 @@
<?php
/**
* This file is part of the Propel package.
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @license MIT License
*/
/**
* Pre-order node iterator for Node objects.
*
* @author Dave Lawson <dlawson@masterytech.com>
* @version $Revision: 1612 $
* @package propel.runtime.om
*/
class PreOrderNodeIterator implements Iterator
{
private $topNode = null;
private $curNode = null;
private $querydb = false;
private $con = null;
public function __construct($node, $opts) {
$this->topNode = $node;
$this->curNode = $node;
if (isset($opts['con']))
$this->con = $opts['con'];
if (isset($opts['querydb']))
$this->querydb = $opts['querydb'];
}
public function rewind() {
$this->curNode = $this->topNode;
}
public function valid() {
return ($this->curNode !== null);
}
public function current() {
return $this->curNode;
}
public function key() {
return $this->curNode->getNodePath();
}
public function next() {
if ($this->valid())
{
$nextNode = $this->curNode->getFirstChildNode($this->querydb, $this->con);
while ($nextNode === null)
{
if ($this->curNode === null || $this->curNode->equals($this->topNode))
break;
$nextNode = $this->curNode->getSiblingNode(false, $this->querydb, $this->con);
if ($nextNode === null)
$this->curNode = $this->curNode->getParentNode($this->querydb, $this->con);
}
$this->curNode = $nextNode;
}
return $this->curNode;
}
}