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
/*
* $Id: AndCondition.php 905 2010-10-05 16:28:03Z mrook $
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information please see
* <http://phing.info>.
*/
require_once 'phing/tasks/system/condition/ConditionBase.php';
/**
* <and> condition container.
*
* Iterates over all conditions and returns false as soon as one
* evaluates to false.
*
* @author Hans Lellelid <hans@xmpl.org>
* @author Andreas Aderhold <andi@binarycloud.com>
* @copyright © 2001,2002 THYRELL. All rights reserved
* @version $Revision: 905 $
* @package phing.tasks.system.condition
*/
class AndCondition extends ConditionBase implements Condition {
public function evaluate() {
foreach($this as $c) { // ConditionBase implements IteratorAggregator
if (!$c->evaluate()) {
return false;
}
}
return true;
}
}

View file

@ -0,0 +1,38 @@
<?php
/*
* $Id: Condition.php 905 2010-10-05 16:28:03Z mrook $
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information please see
* <http://phing.info>.
*/
/**
* Condition interface specification:
*
* Each condition must implement a method applying to this prototye:
*
* @author Hans Lellelid <hans@xmpl.org>
* @version $Revision: 905 $
* @package phing.tasks.system.condition
*/
interface Condition {
/**
* @return boolean
* @throws BuildException
*/
public function evaluate();
}

View file

@ -0,0 +1,197 @@
<?php
/*
* $Id: ConditionBase.php 905 2010-10-05 16:28:03Z mrook $
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information please see
* <http://phing.info>.
*/
require_once 'phing/ProjectComponent.php';
include_once 'phing/Project.php';
include_once 'phing/tasks/system/AvailableTask.php';
include_once 'phing/tasks/system/condition/Condition.php';
/**
* Abstract baseclass for the <condition> task as well as several
* conditions - ensures that the types of conditions inside the task
* and the "container" conditions are in sync.
*
* @author Hans Lellelid <hans@xmpl.org>
* @author Andreas Aderhold <andi@binarycloud.com>
* @copyright © 2001,2002 THYRELL. All rights reserved
* @version $Revision: 905 $
* @package phing.tasks.system.condition
*/
abstract class ConditionBase extends ProjectComponent implements IteratorAggregate {
public $conditions = array(); // needs to be public for "inner" class access
function countConditions() {
return count($this->conditions);
}
/**
* Required for IteratorAggregate
*/
function getIterator() {
return new ConditionEnumeration($this);
}
function getConditions() {
return $this->conditions;
}
/**
* @return void
*/
function addAvailable(AvailableTask $a) {
$this->conditions[] = $a;
}
/**
* @return NotCondition
*/
function createNot() {
include_once 'phing/tasks/system/condition/NotCondition.php';
$num = array_push($this->conditions, new NotCondition());
return $this->conditions[$num-1];
}
/**
* @return AndCondition
*/
function createAnd() {
include_once 'phing/tasks/system/condition/AndCondition.php';
$num = array_push($this->conditions, new AndCondition());
return $this->conditions[$num-1];
}
/**
* @return OrCondition
*/
function createOr() {
include_once 'phing/tasks/system/condition/OrCondition.php';
$num = array_push($this->conditions, new OrCondition());
return $this->conditions[$num-1];
}
/**
* @return EqualsCondition
*/
function createEquals() {
include_once 'phing/tasks/system/condition/EqualsCondition.php';
$num = array_push($this->conditions, new EqualsCondition());
return $this->conditions[$num-1];
}
/**
* @return OsCondition
*/
function createOs() {
include_once 'phing/tasks/system/condition/OsCondition.php';
$num = array_push($this->conditions, new OsCondition());
return $this->conditions[$num-1];
}
/**
* @return IsFalseCondition
*/
function createIsFalse() {
include_once 'phing/tasks/system/condition/IsFalseCondition.php';
$num = array_push($this->conditions, new IsFalseCondition());
return $this->conditions[$num-1];
}
/**
* @return IsTrueCondition
*/
function createIsTrue() {
include_once 'phing/tasks/system/condition/IsTrueCondition.php';
$num = array_push($this->conditions, new IsTrueCondition());
return $this->conditions[$num-1];
}
/**
* @return ContainsCondition
*/
function createContains() {
include_once 'phing/tasks/system/condition/ContainsCondition.php';
$num = array_push($this->conditions, new ContainsCondition());
return $this->conditions[$num-1];
}
/**
* @return IsSetCondition
*/
function createIsSet() {
include_once 'phing/tasks/system/condition/IsSetCondition.php';
$num = array_push($this->conditions, new IsSetCondition());
return $this->conditions[$num-1];
}
/**
* @return ReferenceExistsCondition
*/
function createReferenceExists() {
include_once 'phing/tasks/system/condition/ReferenceExistsCondition.php';
$num = array_push($this->conditions, new ReferenceExistsCondition());
return $this->conditions[$num-1];
}
}
/**
* "Inner" class for handling enumerations.
* Uses build-in PHP5 iterator support.
*
* @package phing.tasks.system.condition
*/
class ConditionEnumeration implements Iterator {
/** Current element number */
private $num = 0;
/** "Outer" ConditionBase class. */
private $outer;
function __construct(ConditionBase $outer) {
$this->outer = $outer;
}
public function valid() {
return $this->outer->countConditions() > $this->num;
}
function current() {
$o = $this->outer->conditions[$this->num];
if ($o instanceof ProjectComponent) {
$o->setProject($this->outer->getProject());
}
return $o;
}
function next() {
$this->num++;
}
function key() {
return $this->num;
}
function rewind() {
$this->num = 0;
}
}

View file

@ -0,0 +1,76 @@
<?php
/*
* $Id: ContainsCondition.php 905 2010-10-05 16:28:03Z mrook $
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information please see
* <http://phing.info>.
*/
require_once 'phing/tasks/system/condition/Condition.php';
/**
* Is one string part of another string?
*
* @author Hans Lellelid <hans@xmpl.org> (Phing)
* @author Stefan Bodewig <stefan.bodewig@epost.de> (Ant)
* @version $Revision: 905 $
* @package phing.tasks.system.condition
*/
class ContainsCondition implements Condition {
private $string;
private $subString;
private $caseSensitive = true;
/**
* The string to search in.
* @param string $a1
*/
public function setString($a1) {
$this->string = $a1;
}
/**
* The string to search for.
* @param string $a2
*/
public function setSubstring($a2) {
$this->subString = $a2;
}
/**
* Whether to search ignoring case or not.
*/
public function setCaseSensitive($b) {
$this->caseSensitive = (boolean) $b;
}
/**
* Check whether string contains substring.
* @throws BuildException
*/
public function evaluate() {
if ($this->string === null || $this->subString === null) {
throw new BuildException("both string and substring are required "
. "in contains");
}
return $this->caseSensitive
? strpos($this->string, $this->subString) !== false
: strpos(strtolower($this->string), strtolower($this->subString)) !== false;
}
}

View file

@ -0,0 +1,78 @@
<?php
/*
* $Id: EqualsCondition.php 905 2010-10-05 16:28:03Z mrook $
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information please see
* <http://phing.info>.
*/
require_once 'phing/tasks/system/condition/Condition.php';
/**
* A simple string comparator. Compares two strings for eqiality in a
* binary safe manner. Implements the condition interface specification.
*
* @author Andreas Aderhold <andi@binarycloud.com>
* @copyright © 2001,2002 THYRELL. All rights reserved
* @version $Revision: 905 $ $Date: 2010-10-05 18:28:03 +0200 (Tue, 05 Oct 2010) $
* @access public
* @package phing.tasks.system.condition
*/
class EqualsCondition implements Condition {
private $arg1;
private $arg2;
private $trim = false;
private $caseSensitive = true;
public function setArg1($a1) {
$this->arg1 = $a1;
}
public function setArg2($a2) {
$this->arg2 = $a2;
}
/**
* Should we want to trim the arguments before comparing them?
* @param boolean $b
*/
public function setTrim($b) {
$this->trim = (boolean) $b;
}
/**
* Should the comparison be case sensitive?
* @param boolean $b
*/
public function setCaseSensitive($b) {
$this->caseSensitive = (boolean) $b;
}
public function evaluate() {
if ($this->arg1 === null || $this->arg2 === null) {
throw new BuildException("Both arg1 and arg2 are required in equals.");
}
if ($this->trim) {
$this->arg1 = trim($this->arg1);
$this->arg2 = trim($this->arg2);
}
//print("[comparison] Comparing '".$this->arg1."' and '".$this->arg2."'\n");
return $this->caseSensitive ? $this->arg1 === $this->arg2 : strtolower($this->arg1) === strtolower($this->arg2);
}
}

View file

@ -0,0 +1,60 @@
<?php
/*
* $Id: IsFalseCondition.php 905 2010-10-05 16:28:03Z mrook $
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information please see
* <http://phing.info>.
*/
require_once 'phing/ProjectComponent.php';
require_once 'phing/tasks/system/condition/Condition.php';
/**
* Condition that tests whether a given string evals to false.
*
* @author Hans Lellelid (Phing)
* @author Steve Loughran (Ant)
* @version $Revision: 905 $
* @package phing.tasks.system.condition
*/
class IsFalseCondition extends ProjectComponent implements Condition {
/**
* what we eval
*/
private $value;
/**
* Set the value to be tested.
* @param boolean $value
*/
public function setValue($value) {
$this->value = $value;
}
/**
* return the inverted value;
* @throws BuildException if someone forgot to spec a value
*/
public function evaluate() {
if ($this->value === null) {
throw new BuildException("Nothing to test for falsehood");
}
return !$this->value;
}
}

View file

@ -0,0 +1,53 @@
<?php
/*
* $Id: IsSetCondition.php 905 2010-10-05 16:28:03Z mrook $
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information please see
* <http://phing.info>.
*/
require_once 'phing/ProjectComponent.php';
require_once 'phing/tasks/system/condition/Condition.php';
/**
* Condition that tests whether a given property has been set.
*
* @author Hans Lellelid <hans@xmpl.org> (Phing)
* @author Stefan Bodewig <stefan.bodewig@epost.de> (Ant)
* @version $Revision: 905 $
* @package phing.tasks.system.condition
*/
class IsSetCondition extends ProjectComponent implements Condition {
private $property;
public function setProperty($p) {
$this->property = $p;
}
/**
* Check whether property is set.
* @throws BuildException
*/
public function evaluate() {
if ($this->property === null) {
throw new BuildException("No property specified for isset "
. "condition");
}
return $this->project->getProperty($this->property) !== null;
}
}

View file

@ -0,0 +1,59 @@
<?php
/*
* $Id: IsTrueCondition.php 905 2010-10-05 16:28:03Z mrook $
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information please see
* <http://phing.info>.
*/
require_once 'phing/ProjectComponent.php';
require_once 'phing/tasks/system/condition/Condition.php';
/**
* Condition that tests whether a given string evals to true.
*
* @author Hans Lellelid <hans@xmpl.org> (Phing)
* @author Steve Loughran (Ant)
* @package phing.tasks.system.condition
*/
class IsTrueCondition extends ProjectComponent implements Condition {
/**
* what we eval
*/
private $value;
/**
* Set the value to be tested.
* @param boolean $value
*/
public function setValue($value) {
$this->value = $value;
}
/**
* return the inverted value;
* @throws BuildException if someone forgot to spec a value
*/
public function evaluate() {
if ($this->value === null) {
throw new BuildException("Nothing to test for falsehood");
}
return $this->value;
}
}

View file

@ -0,0 +1,48 @@
<?php
/*
* $Id: NotCondition.php 905 2010-10-05 16:28:03Z mrook $
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information please see
* <http://phing.info>.
*/
require_once 'phing/tasks/system/condition/ConditionBase.php';
/**
* <not> condition.
*
* Evaluates to true if the single condition nested into it is false
* and vice versa.
*
* @author Andreas Aderhold <andi@binarycloud.com>
* @copyright © 2001,2002 THYRELL. All rights reserved
* @version $Revision: 905 $ $Date: 2010-10-05 18:28:03 +0200 (Tue, 05 Oct 2010) $
* @access public
* @package phing.tasks.system.condition
*/
class NotCondition extends ConditionBase implements Condition {
function evaluate() {
if ($this->countConditions() > 1) {
throw new BuildException("You must not nest more than one condition into <not>");
}
if ($this->countConditions() < 1) {
throw new BuildException("You must nest a condition into <not>");
}
$conds = $this->getIterator();
return !$conds->current()->evaluate();
}
}

View file

@ -0,0 +1,46 @@
<?php
/*
* $Id: OrCondition.php 905 2010-10-05 16:28:03Z mrook $
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information please see
* <http://phing.info>.
*/
require_once 'phing/tasks/system/condition/ConditionBase.php';
/**
* <or> condition container.
*
* Iterates over all conditions and returns true as soon as one
* evaluates to true.
*
* @author Andreas Aderhold <andi@binarycloud.com>
* @copyright 2001,2002 THYRELL. All rights reserved
* @version $Revision: 905 $ $Date: 2010-10-05 18:28:03 +0200 (Tue, 05 Oct 2010) $
* @access public
* @package phing.tasks.system.condition
*/
class OrCondition extends ConditionBase implements Condition {
function evaluate() {
foreach($this as $c) { // ConditionBase implements IteratorAggregator
if ($c->evaluate()) {
return true;
}
}
return false;
}
}

View file

@ -0,0 +1,63 @@
<?php
/*
* $Id: OsCondition.php 905 2010-10-05 16:28:03Z mrook $
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information please see
* <http://phing.info>.
*/
require_once 'phing/tasks/system/condition/ConditionBase.php';
/**
* Condition that tests the OS type.
*
* @author Andreas Aderhold <andi@binarycloud.com>
* @copyright © 2001,2002 THYRELL. All rights reserved
* @version $Revision: 905 $ $Date: 2010-10-05 18:28:03 +0200 (Tue, 05 Oct 2010) $
* @access public
* @package phing.tasks.system.condition
*/
class OsCondition implements Condition {
private $family;
function setFamily($f) {
$this->family = strtolower($f);
}
function evaluate() {
$osName = strtolower(Phing::getProperty("os.name"));
if ($this->family !== null) {
if ($this->family === "windows") {
return StringHelper::startsWith("win", $osName);
} elseif ($this->family === "mac") {
return (strpos($osName, "mac") !== false || strpos($osName, "darwin") !== false);
} elseif ($this->family === ("unix")) {
return (
StringHelper::endsWith("ix", $osName) ||
StringHelper::endsWith("ux", $osName) ||
StringHelper::endsWith("bsd", $osName) ||
StringHelper::startsWith("sunos", $osName) ||
StringHelper::startsWith("darwin", $osName)
);
}
throw new BuildException("Don't know how to detect os family '" . $this->family . "'");
}
return false;
}
}

View file

@ -0,0 +1,52 @@
<?php
/*
* $Id: ReferenceExistsCondition.php 905 2010-10-05 16:28:03Z mrook $
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information please see
* <http://phing.info>.
*/
require_once 'phing/ProjectComponent.php'; require_once 'phing/tasks/system/condition/Condition.php';
/**
* Condition that tests whether a given reference exists.
*
* @author Matthias Pigulla <mp@webfactory.de> (Phing)
* @version $Revision: 905 $
* @package phing.tasks.system.condition */
class ReferenceExistsCondition extends ProjectComponent implements Condition {
private $refid;
public function setRef($id) {
$this->refid = (string) $id;
}
/**
* Check whether the reference exists.
* @throws BuildException
*/
public function evaluate() {
if ($this->refid === null) {
throw new BuildException("No ref attribute specified for reference-exists "
. "condition");
}
$refs = $this->project->getReferences();
return isset($refs[$this->refid]);
}
}