To copy all "user" properties, you will also have to call
- * {@link #copyInheritedProperties copyInheritedProperties}.
- *
- * @param Project $other the project to copy the properties to. Must not be null.
- * @return void
- * @since phing 2.0
- */
- public function copyUserProperties(Project $other) {
- foreach($this->userProperties as $arg => $value) {
- if (isset($this->inheritedProperties[$arg])) {
- continue;
- }
- $other->setUserProperty($arg, $value);
- }
- }
-
- /**
- * Copies all user properties that have not been set on the
- * command line or a GUI tool from this instance to the Project
- * instance given as the argument.
- *
- *
To copy all "user" properties, you will also have to call
- * {@link #copyUserProperties copyUserProperties}.
.
-*/
-
-include_once 'phing/filters/BaseParamFilterReader.php';
-include_once 'phing/filters/ChainableReader.php';
-
-/**
- * Reads the first n lines of a stream.
- * (Default is first 10 lines.)
- *
- * Example:
- *
- * Or:
- *
- *
- *
- *
- * @author Yannick Lecaillez
- * @author hans lellelid, hans@velum.net
- * @version $Revision: 1.6 $ $Date: 2004/03/15 14:45:06 $
- * @access public
- * @see FilterReader
- * @package phing.filters
- */
-class HeadFilter extends BaseParamFilterReader implements ChainableReader {
-
- /**
- * Parameter name for the number of lines to be returned.
- */
- const LINES_KEY = "lines";
-
- /**
- * Number of lines currently read in.
- * @var integer
- */
- private $_linesRead = 0;
-
- /**
- * Number of lines to be returned in the filtered stream.
- * @var integer
- */
- private $_lines = 10;
-
- /**
- * Returns first n lines of stream.
- * @return the resulting stream, or -1
- * if the end of the resulting stream has been reached
- *
- * @exception IOException if the underlying stream throws an IOException
- * during reading
- */
- function read($len = null) {
-
- if ( !$this->getInitialized() ) {
- $this->_initialize();
- $this->setInitialized(true);
- }
-
- // note, if buffer contains fewer lines than
- // $this->_lines this code will not work.
-
- if($this->_linesRead < $this->_lines) {
-
- $buffer = $this->in->read($len);
-
- if($buffer === -1) {
- return -1;
- }
-
- // now grab first X lines from buffer
-
- $lines = explode("\n", $buffer);
-
- $linesCount = count($lines);
-
- // must account for possibility that the num lines requested could
- // involve more than one buffer read.
- $len = ($linesCount > $this->_lines ? $this->_lines - $this->_linesRead : $linesCount);
- $filtered_buffer = implode("\n", array_slice($lines, 0, $len) );
- $this->_linesRead += $len;
-
- return $filtered_buffer;
-
- }
-
- return -1; // EOF, since the file is "finished" as far as subsequent filters are concerned.
- }
-
- /**
- * Sets the number of lines to be returned in the filtered stream.
- *
- * @param integer $lines the number of lines to be returned in the filtered stream.
- */
- function setLines($lines) {
- $this->_lines = (int) $lines;
- }
-
- /**
- * Returns the number of lines to be returned in the filtered stream.
- *
- * @return integer The number of lines to be returned in the filtered stream.
- */
- function getLines() {
- return $this->_lines;
- }
-
- /**
- * Creates a new HeadFilter using the passed in
- * Reader for instantiation.
- *
- * @param object A Reader object providing the underlying stream.
- * Must not be null.
- *
- * @return object A new filter based on this configuration, but filtering
- * the specified reader.
- */
- function chain(Reader $reader) {
- $newFilter = new HeadFilter($reader);
- $newFilter->setLines($this->getLines());
- $newFilter->setInitialized(true);
- $newFilter->setProject($this->getProject());
- return $newFilter;
- }
-
- /**
- * Scans the parameters list for the "lines" parameter and uses
- * it to set the number of lines to be returned in the filtered stream.
- */
- private function _initialize() {
- $params = $this->getParameters();
- if ( $params !== null ) {
- for($i = 0, $_i=count($params) ; $i < $_i; $i++) {
- if ( self::LINES_KEY == $params[$i]->getName() ) {
- $this->_lines = (int) $params[$i]->getValue();
- break;
- }
- }
- }
- }
-}
-
-?>
diff --git a/buildscripts/phing/classes/phing/filters/LineContains.php b/buildscripts/phing/classes/phing/filters/LineContains.php
deleted file mode 100644
index 8f3136b7..00000000
--- a/buildscripts/phing/classes/phing/filters/LineContains.php
+++ /dev/null
@@ -1,258 +0,0 @@
-.
- */
-
-include_once 'phing/filters/BaseParamFilterReader.php';
-include_once 'phing/filters/BaseFilterReader.php';
-include_once 'phing/filters/ChainableReader.php';
-
-/**
- * Filter which includes only those lines that contain all the user-specified
- * strings.
- *
- * Example:
- *
- *
- *
- *
- *
- *
- * Or:
- *
- *
- *
- *
- *
- *
- * This will include only those lines that contain foo and
- * bar.
- *
- * @author Yannick Lecaillez
- * @author Hans Lellelid
- * @version $Revision: 1.11 $
- * @see PhingFilterReader
- * @package phing.filters
-*/
-class LineContains extends BaseParamFilterReader implements ChainableReader {
-
- /**
- * The parameter name for the string to match on.
- * @var string
- */
- const CONTAINS_KEY = "contains";
-
- /**
- * Array of Contains objects.
- * @var array
- */
- private $_contains = array();
-
- /**
- * [Deprecated]
- * @var string
- */
- private $_line = null;
-
- /**
- * Returns all lines in a buffer that contain specified strings.
- * @return mixed buffer, -1 on EOF
- */
- function read($len = null) {
- if ( !$this->getInitialized() ) {
- $this->_initialize();
- $this->setInitialized(true);
- }
-
- $buffer = $this->in->read($len);
-
- if ($buffer === -1) {
- return -1;
- }
-
- $lines = explode("\n", $buffer);
- $matched = array();
- $containsSize = count($this->_contains);
-
- foreach($lines as $line) {
- for($i = 0 ; $i < $containsSize ; $i++) {
- $containsStr = $this->_contains[$i]->getValue();
- if ( strstr($line, $containsStr) === false ) {
- $line = null;
- break;
- }
- }
- if($line !== null) {
- $matched[] = $line;
- }
- }
- $filtered_buffer = implode("\n", $matched);
- return $filtered_buffer;
- }
-
- /**
- * [Deprecated. For reference only, used to be read() method.]
- * Returns the next character in the filtered stream, only including
- * lines from the original stream which contain all of the specified words.
- *
- * @return the next character in the resulting stream, or -1
- * if the end of the resulting stream has been reached
- *
- * @exception IOException if the underlying stream throws an IOException
- * during reading
- */
- function readChar() {
- if ( !$this->getInitialized() ) {
- $this->_initialize();
- $this->setInitialized(true);
- }
-
- $ch = -1;
-
- if ( $this->_line !== null ) {
- $ch = substr($this->_line, 0, 1);
- if ( strlen($this->_line) === 1 )
- $this->_line = null;
- else
- $this->_line = substr($this->_line, 1);
- } else {
- $this->_line = $this->readLine();
- if ( $this->_line === null ) {
- $ch = -1;
- } else {
- $containsSize = count($this->_contains);
- for($i = 0 ; $i < $containsSize ; $i++) {
- $containsStr = $this->_contains[$i]->getValue();
- if ( strstr($this->_line, $containsStr) === false ) {
- $this->_line = null;
- break;
- }
- }
- return $this->readChar();
- }
- }
-
- return $ch;
- }
-
- /**
- * Adds a nested element.
- *
- * @return Contains The contains element added.
- * Must not be null.
- */
- function createContains() {
- $num = array_push($this->_contains, new Contains());
- return $this->_contains[$num-1];
- }
-
- /**
- * Sets the array of words which must be contained within a line read
- * from the original stream in order for it to match this filter.
- *
- * @param array $contains An array of words which must be contained
- * within a line in order for it to match in this filter.
- * Must not be null.
- */
- function setContains($contains) {
- // type check, error must never occur, bad code of it does
- if ( !is_array($contains) ) {
- throw new Exception("Excpected array got something else");
- }
-
- $this->_contains = $contains;
- }
-
- /**
- * Returns the vector of words which must be contained within a line read
- * from the original stream in order for it to match this filter.
- *
- * @return array The array of words which must be contained within a line read
- * from the original stream in order for it to match this filter. The
- * returned object is "live" - in other words, changes made to the
- * returned object are mirrored in the filter.
- */
- function getContains() {
- return $this->_contains;
- }
-
- /**
- * Creates a new LineContains using the passed in
- * Reader for instantiation.
- *
- * @param object A Reader object providing the underlying stream.
- * Must not be null.
- *
- * @return object A new filter based on this configuration, but filtering
- * the specified reader
- */
- function chain(Reader $reader) {
- $newFilter = new LineContains($reader);
- $newFilter->setContains($this->getContains());
- $newFilter->setInitialized(true);
- $newFilter->setProject($this->getProject());
- return $newFilter;
- }
-
- /**
- * Parses the parameters to add user-defined contains strings.
- */
- private function _initialize() {
- $params = $this->getParameters();
- if ( $params !== null ) {
- foreach($params as $param) {
- if ( self::CONTAINS_KEY == $param->getType() ) {
- $cont = new Contains();
- $cont->setValue($param->getValue());
- array_push($this->_contains, $cont);
- break; // because we only support a single contains
- }
- }
- }
- }
-}
-
-/**
- * Holds a contains element.
- */
-class Contains {
-
- /**
- * @var string
- */
- private $_value;
-
- /**
- * Set 'contains' value.
- * @param string $contains
- */
- function setValue($contains) {
- $this->_value = (string) $contains;
- }
-
- /**
- * Returns 'contains' value.
- * @return string
- */
- function getValue() {
- return $this->_value;
- }
-}
-?>
diff --git a/buildscripts/phing/classes/phing/filters/LineContainsRegexp.php b/buildscripts/phing/classes/phing/filters/LineContainsRegexp.php
deleted file mode 100644
index dcbb532c..00000000
--- a/buildscripts/phing/classes/phing/filters/LineContainsRegexp.php
+++ /dev/null
@@ -1,179 +0,0 @@
-.
-*/
-
-include_once 'phing/filters/BaseParamFilterReader.php';
-include_once 'phing/types/RegularExpression.php';
-include_once 'phing/filters/ChainableReader.php';
-
-/**
- * Filter which includes only those lines that contain the user-specified
- * regular expression matching strings.
- *
- * Example:
- *
- *
- *
- *
- * Or:
- *
- *
- *
- *
- *
- * This will fetch all those lines that contain the pattern foo
- *
- * @author Yannick Lecaillez
- * @author Hans Lellelid
- * @version $Revision: 1.8 $
- * @see FilterReader
- * @package phing.filters
- */
-class LineContainsRegexp extends BaseParamFilterReader implements ChainableReader {
-
- /**
- * Parameter name for regular expression.
- * @var string
- */
- const REGEXP_KEY = "regexp";
-
- /**
- * Regular expressions that are applied against lines.
- * @var array
- */
- private $_regexps = array();
-
- /**
- * Returns all lines in a buffer that contain specified strings.
- * @return mixed buffer, -1 on EOF
- */
- function read($len = null) {
-
- if ( !$this->getInitialized() ) {
- $this->_initialize();
- $this->setInitialized(true);
- }
-
- $buffer = $this->in->read($len);
-
- if ($buffer === -1) {
- return -1;
- }
-
- $lines = explode("\n", $buffer);
- $matched = array();
-
- $regexpsSize = count($this->_regexps);
- foreach($lines as $line) {
- for($i = 0 ; $i<$regexpsSize ; $i++) {
- $regexp = $this->_regexps[$i];
- $re = $regexp->getRegexp($this->getProject());
- $matches = $re->matches($line);
- if ( !$matches ) {
- $line = null;
- break;
- }
- }
- if($line !== null) {
- $matched[] = $line;
- }
- }
- $filtered_buffer = implode("\n", $matched);
- return $filtered_buffer;
- }
-
- /**
- * Adds a regexp element.
- *
- * @return object regExp The regexp element added.
- */
- function createRegexp() {
- $num = array_push($this->_regexps, new RegularExpression());
- return $this->_regexps[$num-1];
- }
-
- /**
- * Sets the vector of regular expressions which must be contained within
- * a line read from the original stream in order for it to match this
- * filter.
- *
- * @param regexps An array of regular expressions which must be contained
- * within a line in order for it to match in this filter. Must not be
- * null.
- */
- function setRegexps($regexps) {
- // type check, error must never occur, bad code of it does
- if ( !is_array($regexps) ) {
- throw new Exception("Excpected an 'array', got something else");
- }
- $this->_regexps = $regexps;
- }
-
- /**
- * Returns the array of regular expressions which must be contained within
- * a line read from the original stream in order for it to match this
- * filter.
- *
- * @return array The array of regular expressions which must be contained within
- * a line read from the original stream in order for it to match this
- * filter. The returned object is "live" - in other words, changes made to
- * the returned object are mirrored in the filter.
- */
- function getRegexps() {
- return $this->_regexps;
- }
-
- /**
- * Creates a new LineContainsRegExp using the passed in
- * Reader for instantiation.
- *
- * @param object A Reader object providing the underlying stream.
- * Must not be null.
- *
- * @return object A new filter based on this configuration, but filtering
- * the specified reader
- */
- function chain(Reader $reader) {
- $newFilter = new LineContainsRegExp($reader);
- $newFilter->setRegexps($this->getRegexps());
- $newFilter->setInitialized(true);
- $newFilter->setProject($this->getProject());
- return $newFilter;
- }
-
- /**
- * Parses parameters to add user defined regular expressions.
- */
- private function _initialize() {
- $params = $this->getParameters();
- if ( $params !== null ) {
- for($i = 0 ; $igetType() ) {
- $pattern = $params[$i]->getValue();
- $regexp = new RegularExpression();
- $regexp->setPattern($pattern);
- array_push($this->_regexps, $regexp);
- }
- }
- }
- }
-}
-
-?>
diff --git a/buildscripts/phing/classes/phing/filters/PrefixLines.php b/buildscripts/phing/classes/phing/filters/PrefixLines.php
deleted file mode 100644
index a5580f87..00000000
--- a/buildscripts/phing/classes/phing/filters/PrefixLines.php
+++ /dev/null
@@ -1,142 +0,0 @@
-.
-*/
-
-include_once 'phing/filters/BaseParamFilterReader.php';
-include_once 'phing/filters/ChainableReader.php';
-
-/**
- * Attaches a prefix to every line.
- *
- * Example:
- *
- *
- * Or:
- *
- *
- *
- *
- *
- * @author Yannick Lecaillez
- * @author hans lellelid, hans@velum.net
- * @version $Revision: 1.6 $ $Date: 2004/03/15 14:45:06 $
- * @access public
- * @see FilterReader
- * @package phing.filters
-*/
-class PrefixLines extends BaseParamFilterReader implements ChainableReader {
-
- /**
- * Parameter name for the prefix.
- * @var string
- */
- const PREFIX_KEY = "lines";
-
- /**
- * The prefix to be used.
- * @var string
- */
- private $_prefix = null;
-
- /**
- * Adds a prefix to each line of input stream and returns resulting stream.
- *
- * @return mixed buffer, -1 on EOF
- */
- function read($len = null) {
- if ( !$this->getInitialized() ) {
- $this->_initialize();
- $this->setInitialized(true);
- }
-
- $buffer = $this->in->read($len);
-
- if ($buffer === -1) {
- return -1;
- }
-
- $lines = explode("\n", $buffer);
- $filtered = array();
-
- foreach($lines as $line) {
- $line = $this->_prefix . $line;
- $filtered[] = $line;
- }
-
- $filtered_buffer = implode("\n", $filtered);
- return $filtered_buffer;
- }
-
- /**
- * Sets the prefix to add at the start of each input line.
- *
- * @param string $prefix The prefix to add at the start of each input line.
- * May be null, in which case no prefix
- * is added.
- */
- function setPrefix($prefix) {
- $this->_prefix = (string) $prefix;
- }
-
- /**
- * Returns the prefix which will be added at the start of each input line.
- *
- * @return string The prefix which will be added at the start of each input line
- */
- function getPrefix() {
- return $this->_prefix;
- }
-
- /**
- * Creates a new PrefixLines filter using the passed in
- * Reader for instantiation.
- *
- * @param object A Reader object providing the underlying stream.
- * Must not be null.
- *
- * @return object A new filter based on this configuration, but filtering
- * the specified reader
- */
- function chain(Reader $reader) {
- $newFilter = new PrefixLines($reader);
- $newFilter->setPrefix($this->getPrefix());
- $newFilter->setInitialized(true);
- $newFilter->setProject($this->getProject());
- return $newFilter;
- }
-
- /**
- * Initializes the prefix if it is available from the parameters.
- */
- private function _initialize() {
- $params = $this->getParameters();
- if ( $params !== null ) {
- for($i = 0, $_i=count($params) ; $i < $_i ; $i++) {
- if ( self::PREFIX_KEY == $params[$i]->getName() ) {
- $this->_prefix = (string) $params[$i]->getValue();
- break;
- }
- }
- }
- }
-}
-
-?>
diff --git a/buildscripts/phing/classes/phing/filters/ReplaceRegexp.php b/buildscripts/phing/classes/phing/filters/ReplaceRegexp.php
deleted file mode 100644
index 3c5592e8..00000000
--- a/buildscripts/phing/classes/phing/filters/ReplaceRegexp.php
+++ /dev/null
@@ -1,129 +0,0 @@
-.
-*/
-
-require_once 'phing/filters/BaseFilterReader.php';
-include_once 'phing/filters/ChainableReader.php';
-include_once 'phing/types/RegularExpression.php';
-
-/**
- * Performs a regexp find/replace on stream.
- *
- * Example:
- *
- *
- *
- *
- *
- *
- *
- * @author Hans Lellelid
- * @version $Revision: 1.5 $
- * @package phing.filters
- */
-class ReplaceRegexp extends BaseFilterReader implements ChainableReader {
-
- /**
- * @var array RegularExpression[]
- */
- private $regexps = array();
-
- /**
- * Creator method handles nested tags.
- * @return RegularExpression
- */
- function createRegexp() {
- $num = array_push($this->regexps, new RegularExpression());
- return $this->regexps[$num-1];
- }
-
- /**
- * Sets the current regexps.
- * (Used when, e.g., cloning/chaining the method.)
- * @param array RegularExpression[]
- */
- function setRegexps($regexps) {
- $this->regexps = $regexps;
- }
-
- /**
- * Gets the current regexps.
- * (Used when, e.g., cloning/chaining the method.)
- * @return array RegularExpression[]
- */
- function getRegexps() {
- return $this->regexps;
- }
-
- /**
- * Returns the filtered stream.
- * The original stream is first read in fully, and the regex replace is performed.
- *
- * @param int $len Required $len for Reader compliance.
- *
- * @return mixed The filtered stream, or -1 if the end of the resulting stream has been reached.
- *
- * @exception IOException if the underlying stream throws an IOException
- * during reading
- */
- function read($len = null) {
-
- $buffer = $this->in->read($len);
-
- if($buffer === -1) {
- return -1;
- }
-
- // perform regex replace here ...
- foreach($this->regexps as $exptype) {
- $regexp = $exptype->getRegexp($this->project);
- try {
- $buffer = $regexp->replace($buffer);
- $this->log("Performing regexp replace: /".$regexp->getPattern()."/".$regexp->getReplace()."/g".($regexp->getIgnoreCase() ? 'i' : ''), PROJECT_MSG_VERBOSE);
- } catch (Exception $e) {
- // perhaps mismatch in params (e.g. no replace or pattern specified)
- $this->log("Error performing regexp replace: " . $e->getMessage(), PROJECT_MSG_WARN);
- }
- }
-
- return $buffer;
- }
-
- /**
- * Creates a new ReplaceRegExp filter using the passed in
- * Reader for instantiation.
- *
- * @param Reader $reader A Reader object providing the underlying stream.
- * Must not be null.
- *
- * @return ReplaceRegExp A new filter based on this configuration, but filtering
- * the specified reader
- */
- function chain(Reader $reader) {
- $newFilter = new ReplaceRegExp($reader);
- $newFilter->setProject($this->getProject());
- $newFilter->setRegexps($this->getRegexps());
- return $newFilter;
- }
-
-}
-
-?>
diff --git a/buildscripts/phing/classes/phing/filters/ReplaceTokens.php b/buildscripts/phing/classes/phing/filters/ReplaceTokens.php
deleted file mode 100644
index 999f734f..00000000
--- a/buildscripts/phing/classes/phing/filters/ReplaceTokens.php
+++ /dev/null
@@ -1,415 +0,0 @@
-.
-*/
-
-include_once 'phing/filters/BaseParamFilterReader.php';
-include_once 'phing/types/TokenSource.php';
-include_once 'phing/filters/ChainableReader.php';
-
-/*
- * Replaces tokens in the original input with user-supplied values.
- *
- * Example:
- *
- *
;
- *
- *
- *
- * Or:
- *
- *
- *
- *
- *
- *
- *
- * @author Yannick Lecaillez
- * @author hans lellelid, hans@velum.net
- * @version $Revision: 1.14 $ $Date: 2005/06/16 15:09:10 $
- * @access public
- * @see BaseParamFilterReader
- * @package phing.filters
- */
-class ReplaceTokens extends BaseParamFilterReader implements ChainableReader {
-
- /**
- * Default "begin token" character.
- * @var string
- */
- const DEFAULT_BEGIN_TOKEN = "@";
-
- /**
- * Default "end token" character.
- * @var string
- */
- const DEFAULT_END_TOKEN = "@";
-
- /**
- * [Deprecated] Data that must be read from, if not null.
- * @var string
- */
- private $_queuedData = null;
-
- /**
- * Array to hold the replacee-replacer pairs (String to String).
- * @var array
- */
- private $_tokens = array();
-
- /**
- * Array to hold the token sources that make tokens from
- * different sources available
- * @var array
- */
- private $_tokensources = array();
-
- /**
- * Array holding all tokens given directly to the Filter and
- * those passed via a TokenSource.
- * @var array
- */
- private $_alltokens = null;
-
- /**
- * Character marking the beginning of a token.
- * @var string
- */
- private $_beginToken = "@"; // self::DEFAULT_BEGIN_TOKEN;
-
- /**
- * Character marking the end of a token.
- * @var string
- */
- private $_endToken = "@"; //self::DEFAULT_END_TOKEN;
-
- /**
- * Performs lookup on key and returns appropriate replacement string.
- * @param array $matches Array of 1 el containing key to search for.
- * @return string Text with which to replace key or value of key if none is found.
- * @access private
- */
- private function replaceTokenCallback($matches) {
-
- $key = $matches[1];
-
- /* Get tokens from tokensource and merge them with the
- * tokens given directly via build file. This should be
- * done a bit more elegantly
- */
- if ($this->_alltokens === null) {
- $this->_alltokens = array();
-
- $count = count($this->_tokensources);
- for ($i = 0; $i < $count; $i++) {
- $source = $this->_tokensources[$i];
- $this->_alltokens = array_merge($this->_alltokens, $source->getTokens());
- }
-
-
- $this->_alltokens = array_merge($this->_tokens, $this->_alltokens);
- }
-
- $tokens = $this->_alltokens;
-
- $replaceWith = null;
- $count = count($tokens);
-
- for ($i = 0; $i < $count; $i++) {
- if ($tokens[$i]->getKey() === $key) {
- $replaceWith = $tokens[$i]->getValue();
- }
- }
-
- if ($replaceWith === null) {
- $replaceWith = $this->_beginToken . $key . $this->_endToken;
- $this->log("No token defined for key \"".$this->_beginToken . $key . $this->_endToken."\"");
- } else {
- $this->log("Replaced \"".$this->_beginToken . $key . $this->_endToken ."\" with \"".$replaceWith."\"");
- }
-
- return $replaceWith;
- }
-
- /**
- * Returns stream with tokens having been replaced with appropriate values.
- * If a replacement value is not found for a token, the token is left in the stream.
- *
- * @return mixed filtered stream, -1 on EOF.
- */
- function read($len = null) {
- if ( !$this->getInitialized() ) {
- $this->_initialize();
- $this->setInitialized(true);
- }
-
- // read from next filter up the chain
- $buffer = $this->in->read($len);
-
- if($buffer === -1) {
- return -1;
- }
-
- // filter buffer
- $buffer = preg_replace_callback(
- "/".preg_quote($this->_beginToken)."([\w\.\-:]+?)".preg_quote($this->_endToken)."/",
- array($this, 'replaceTokenCallback'), $buffer);
-
- return $buffer;
- }
-
- /**
- * Sets the "begin token" character.
- *
- * @param string $beginToken the character used to denote the beginning of a token.
- */
- function setBeginToken($beginToken) {
- $this->_beginToken = (string) $beginToken;
- }
-
- /**
- * Returns the "begin token" character.
- *
- * @return string The character used to denote the beginning of a token.
- */
- function getBeginToken() {
- return $this->_beginToken;
- }
-
- /**
- * Sets the "end token" character.
- *
- * @param string $endToken the character used to denote the end of a token
- */
- function setEndToken($endToken) {
- $this->_endToken = (string) $endToken;
- }
-
- /**
- * Returns the "end token" character.
- *
- * @return the character used to denote the beginning of a token
- */
- function getEndToken() {
- return $this->_endToken;
- }
-
- /**
- * Adds a token element to the map of tokens to replace.
- *
- * @return object The token added to the map of replacements.
- * Must not be null.
- */
- function createToken() {
- $num = array_push($this->_tokens, new Token());
- return $this->_tokens[$num-1];
- }
-
- /**
- * Adds a token source to the sources of this filter.
- *
- * @return object A Reference to the source just added.
- */
- function createTokensource() {
- $num = array_push($this->_tokensources, new TokenSource());
- return $this->_tokensources[$num-1];
- }
-
- /**
- * Sets the map of tokens to replace.
- * ; used by ReplaceTokens::chain()
- *
- * @param array A map (String->String) of token keys to replacement
- * values. Must not be null.
- */
- function setTokens($tokens) {
- // type check, error must never occur, bad code of it does
- if ( !is_array($tokens) ) {
- throw new Exception("Excpected 'array', got something else");
- }
-
- $this->_tokens = $tokens;
- }
-
- /**
- * Returns the map of tokens which will be replaced.
- * ; used by ReplaceTokens::chain()
- *
- * @return array A map (String->String) of token keys to replacement values.
- */
- function getTokens() {
- return $this->_tokens;
- }
-
- /**
- * Sets the tokensources to use; used by ReplaceTokens::chain()
- *
- * @param array An array of token sources.
- */
- function setTokensources($sources) {
- // type check
- if ( !is_array($sources)) {
- throw new Exception("Exspected 'array', got something else");
- }
- $this->_tokensources = $sources;
- }
-
- /**
- * Returns the token sources used by this filter; used by ReplaceTokens::chain()
- *
- * @return array
- */
- function getTokensources() {
- return $this->_tokensources;
- }
-
- /**
- * Creates a new ReplaceTokens using the passed in
- * Reader for instantiation.
- *
- * @param object A Reader object providing the underlying stream.
- * Must not be null.
- *
- * @return object A new filter based on this configuration, but filtering
- * the specified reader
- */
- function chain(Reader $reader) {
- $newFilter = new ReplaceTokens($reader);
- $newFilter->setProject($this->getProject());
- $newFilter->setBeginToken($this->getBeginToken());
- $newFilter->setEndToken($this->getEndToken());
- $newFilter->setTokens($this->getTokens());
- $newFilter->setTokensources($this->getTokensources());
- $newFilter->setInitialized(true);
- return $newFilter;
- }
-
- /**
- * Initializes tokens and loads the replacee-replacer hashtable.
- * This method is only called when this filter is used through
- * a tag in build file.
- */
- private function _initialize() {
- $params = $this->getParameters();
- if ( $params !== null ) {
- for($i = 0 ; $igetType();
- if ( $type === "tokenchar" ) {
- $name = $params[$i]->getName();
- if ( $name === "begintoken" ) {
- $this->_beginToken = substr($params[$i]->getValue(), 0, 1);
- } else if ( $name === "endtoken" ) {
- $this->_endToken = substr($params[$i]->getValue(), 0, 1);
- }
- } else if ( $type === "token" ) {
- $name = $params[$i]->getName();
- $value = $params[$i]->getValue();
-
- $tok = new Token();
- $tok->setKey($name);
- $tok->setValue($value);
-
- array_push($this->_tokens, $tok);
- } else if ( $type === "tokensource" ) {
- // Store data from nested tags in local array
- $arr = array(); $subparams = $params[$i]->getParams();
- $count = count($subparams);
- for ($i = 0; $i < $count; $i++) {
- $arr[$subparams[$i]->getName()] = $subparams[$i]->getValue();
- }
-
- // Create TokenSource
- $tokensource = new TokenSource();
- if (isset($arr["classname"]))
- $tokensource->setClassname($arr["classname"]);
-
- // Copy other parameters 1:1 to freshly created TokenSource
- foreach ($arr as $key => $value) {
- if (strtolower($key) === "classname")
- continue;
- $param = $tokensource->createParam();
- $param->setName($key);
- $param->setValue($value);
- }
-
- $this->_tokensources[] = $tokensource;
- }
- }
- }
- }
- }
-}
-
-/**
- * Holds a token.
- */
-class Token {
-
- /**
- * Token key.
- * @var string
- */
- private $_key;
-
- /**
- * Token value.
- * @var string
- */
- private $_value;
-
- /**
- * Sets the token key.
- *
- * @param string $key The key for this token. Must not be null.
- */
- function setKey($key) {
- $this->_key = (string) $key;
- }
-
- /**
- * Sets the token value.
- *
- * @param string $value The value for this token. Must not be null.
- */
- function setValue($value) {
- $this->_value = (string) $value;
- }
-
- /**
- * Returns the key for this token.
- *
- * @return string The key for this token.
- */
- function getKey() {
- return $this->_key;
- }
-
- /**
- * Returns the value for this token.
- *
- * @return string The value for this token.
- */
- function getValue() {
- return $this->_value;
- }
-}
-
-?>
diff --git a/buildscripts/phing/classes/phing/filters/StripLineBreaks.php b/buildscripts/phing/classes/phing/filters/StripLineBreaks.php
deleted file mode 100644
index c5a06129..00000000
--- a/buildscripts/phing/classes/phing/filters/StripLineBreaks.php
+++ /dev/null
@@ -1,148 +0,0 @@
-.
-*/
-
-include_once 'phing/filters/BaseParamFilterReader.php';
-include_once 'phing/filters/ChainableReader.php';
-
-/**
- * Filter to flatten the stream to a single line.
- *
- * Example:
- *
- *
- *
- * Or:
- *
- *
- *
- * @author Yannick Lecaillez
- * @author hans lellelid, hans@velum.net
- * @version $Revision: 1.8 $ $Date: 2004/03/15 14:45:06 $
- * @access public
- * @see BaseParamFilterReader
- * @package phing.filters
- */
-class StripLineBreaks extends BaseParamFilterReader implements ChainableReader {
-
- /**
- * Default line-breaking characters.
- * @var string
- */
- const DEFAULT_LINE_BREAKS = "\r\n";
-
- /**
- * Parameter name for the line-breaking characters parameter.
- * @var string
- */
- const LINES_BREAKS_KEY = "linebreaks";
-
- /**
- * The characters that are recognized as line breaks.
- * @var string
- */
- private $_lineBreaks = "\r\n"; // self::DEFAULT_LINE_BREAKS;
-
- /**
- * Returns the filtered stream, only including
- * characters not in the set of line-breaking characters.
- *
- * @return mixed the resulting stream, or -1
- * if the end of the resulting stream has been reached.
- *
- * @exception IOException if the underlying stream throws an IOException
- * during reading
- */
- function read($len = null) {
- if ( !$this->getInitialized() ) {
- $this->_initialize();
- $this->setInitialized(true);
- }
-
- $buffer = $this->in->read($len);
- if($buffer === -1) {
- return -1;
- }
-
- $buffer = preg_replace("/[".$this->_lineBreaks."]/", '', $buffer);
-
- return $buffer;
- }
-
- /**
- * Sets the line-breaking characters.
- *
- * @param string $lineBreaks A String containing all the characters to be
- * considered as line-breaking.
- */
- function setLineBreaks($lineBreaks) {
- $this->_lineBreaks = (string) $lineBreaks;
- }
-
- /**
- * Gets the line-breaking characters.
- *
- * @return string A String containing all the characters that are considered as line-breaking.
- */
- function getLineBreaks() {
- return $this->_lineBreaks;
- }
-
- /**
- * Creates a new StripLineBreaks using the passed in
- * Reader for instantiation.
- *
- * @param object A Reader object providing the underlying stream.
- * Must not be null.
- *
- * @return object A new filter based on this configuration, but filtering
- * the specified reader
- */
- function chain(Reader $reader) {
- $newFilter = new StripLineBreaks($reader);
- $newFilter->setLineBreaks($this->getLineBreaks());
- $newFilter->setInitialized(true);
- $newFilter->setProject($this->getProject());
- return $newFilter;
- }
-
- /**
- * Parses the parameters to set the line-breaking characters.
- */
- private function _initialize() {
- $userDefinedLineBreaks = null;
- $params = $this->getParameters();
- if ( $params !== null ) {
- for($i = 0 ; $igetName() ) {
- $userDefinedLineBreaks = $params[$i]->getValue();
- break;
- }
- }
- }
-
- if ( $userDefinedLineBreaks !== null ) {
- $this->_lineBreaks = $userDefinedLineBreaks;
- }
- }
-}
-
-?>
diff --git a/buildscripts/phing/classes/phing/filters/StripLineComments.php b/buildscripts/phing/classes/phing/filters/StripLineComments.php
deleted file mode 100644
index 5d97979a..00000000
--- a/buildscripts/phing/classes/phing/filters/StripLineComments.php
+++ /dev/null
@@ -1,205 +0,0 @@
-.
-*/
-
-include_once 'phing/filters/BaseParamFilterReader.php';
-include_once 'phing/filters/ChainableReader.php';
-
-/*
- * This filter strips line comments.
- *
- * Example:
- *
- *
- *
- *
- *
- *
- *
- *
- *
- * Or:
- *
- *
- *
- *
- *
- *
- *
- *
- *
- * @author Yannick Lecaillez
- * @author hans lellelid, hans@velum.net
- * @version $Revision: 1.8 $ $Date: 2005/02/27 20:52:08 $
- * @access public
- * @see BaseParamFilterReader
- * @package phing.filters
- */
-class StripLineComments extends BaseParamFilterReader implements ChainableReader {
-
- /** Parameter name for the comment prefix. */
- const COMMENTS_KEY = "comment";
-
- /** Array that holds the comment prefixes. */
- private $_comments = array();
-
- /**
- * Returns stream only including
- * lines from the original stream which don't start with any of the
- * specified comment prefixes.
- *
- * @return mixed the resulting stream, or -1
- * if the end of the resulting stream has been reached.
- *
- * @throws IOException if the underlying stream throws an IOException
- * during reading
- */
- function read($len = null) {
-
- if ( !$this->getInitialized() ) {
- $this->_initialize();
- $this->setInitialized(true);
- }
-
- $buffer = $this->in->read($len);
-
- if ($buffer === -1) {
- return -1;
- }
-
- $lines = explode("\n", $buffer);
- $filtered = array();
-
- $commentsSize = count($this->_comments);
-
- foreach($lines as $line) {
- for($i = 0; $i < $commentsSize; $i++) {
- $comment = $this->_comments[$i]->getValue();
- if ( StringHelper::startsWith($comment, ltrim($line)) ) {
- $line = null;
- break;
- }
- }
- if ($line !== null) {
- $filtered[] = $line;
- }
- }
-
- $filtered_buffer = implode("\n", $filtered);
- return $filtered_buffer;
- }
-
- /*
- * Adds a comment element to the list of prefixes.
- *
- * @return comment The comment element added to the
- * list of comment prefixes to strip.
- */
- function createComment() {
- $num = array_push($this->_comments, new Comment());
- return $this->_comments[$num-1];
- }
-
- /*
- * Sets the list of comment prefixes to strip.
- *
- * @param comments A list of strings, each of which is a prefix
- * for a comment line. Must not be null.
- */
- function setComments($lineBreaks) {
- if (!is_array($lineBreaks)) {
- throw new Exception("Excpected 'array', got something else");
- }
- $this->_comments = $lineBreaks;
- }
-
- /*
- * Returns the list of comment prefixes to strip.
- *
- * @return array The list of comment prefixes to strip.
- */
- function getComments() {
- return $this->_comments;
- }
-
- /*
- * Creates a new StripLineComments using the passed in
- * Reader for instantiation.
- *
- * @param reader A Reader object providing the underlying stream.
- * Must not be null.
- *
- * @return a new filter based on this configuration, but filtering
- * the specified reader
- */
- function chain(Reader $reader) {
- $newFilter = new StripLineComments($reader);
- $newFilter->setComments($this->getComments());
- $newFilter->setInitialized(true);
- $newFilter->setProject($this->getProject());
- return $newFilter;
- }
-
- /*
- * Parses the parameters to set the comment prefixes.
- */
- private function _initialize() {
- $params = $this->getParameters();
- if ( $params !== null ) {
- for($i = 0 ; $igetType() ) {
- $comment = new Comment();
- $comment->setValue($params[$i]->getValue());
- array_push($this->_comments, $comment);
- }
- }
- }
- }
-}
-
-/*
- * The class that holds a comment representation.
-*/
-class Comment {
-
- /** The prefix for a line comment. */
- private $_value;
-
- /*
- * Sets the prefix for this type of line comment.
- *
- * @param string $value The prefix for a line comment of this type.
- * Must not be null.
- */
- function setValue($value) {
- $this->_value = (string) $value;
- }
-
- /*
- * Returns the prefix for this type of line comment.
- *
- * @return string The prefix for this type of line comment.
- */
- function getValue() {
- return $this->_value;
- }
-}
-?>
diff --git a/buildscripts/phing/classes/phing/filters/StripPhpComments.php b/buildscripts/phing/classes/phing/filters/StripPhpComments.php
deleted file mode 100644
index 9e21eed3..00000000
--- a/buildscripts/phing/classes/phing/filters/StripPhpComments.php
+++ /dev/null
@@ -1,190 +0,0 @@
-.
-*/
-
-include_once 'phing/filters/BaseFilterReader.php';
-include_once 'phing/filters/ChainableReader.php';
-
-/**
- * This is a Php comment and string stripper reader that filters
- * those lexical tokens out for purposes of simple Php parsing.
- * (if you have more complex Php parsing needs, use a real lexer).
- * Since this class heavily relies on the single char read function,
- * you are reccomended to make it work on top of a buffered reader.
- *
- * @author Yannick Lecaillez
- * @author hans lellelid, hans@velum.net
- * @version $Revision: 1.6 $ $Date: 2004/07/16 01:36:35 $
- * @access public
- * @see FilterReader
- * @package phing.filters
- * @todo -c use new PHP functions to perform this instead of regex.
- */
-class StripPhpComments extends BaseFilterReader implements ChainableReader {
- /**
- * The read-ahead character, used for effectively pushing a single
- * character back. -1 indicates that no character is in the buffer.
- */
- private $_readAheadCh = -1;
-
- /**
- * Whether or not the parser is currently in the middle of a string
- * literal.
- * @var boolean
- */
- private $_inString = false;
-
- /**
- * Returns the stream without Php comments.
- *
- * @return the resulting stream, or -1
- * if the end of the resulting stream has been reached
- *
- * @throws IOException if the underlying stream throws an IOException
- * during reading
- */
- function read($len = null) {
-
- $buffer = $this->in->read($len);
- if($buffer === -1) {
- return -1;
- }
-
- // This regex replace /* */ and // style comments
- $buffer = preg_replace('/\/\*[^*]*\*+([^\/*][^*]*\*+)*\/|\/\/[^\n]*|("(\\\\.|[^"\\\\])*"|\'(\\\\.|[^\'\\\\])*\'|.[^\/"\'\\\\]*)/s', "$2", $buffer);
-
- // The regex above is not identical to, but is based on the expression below:
- //
- // created by Jeffrey Friedl
- // and later modified by Fred Curtis.
- // s{
- // /\* ## Start of /* ... */ comment
- // [^*]*\*+ ## Non-* followed by 1-or-more *'s
- // (
- // [^/*][^*]*\*+
- // )* ## 0-or-more things which don't start with /
- // ## but do end with '*'
- // / ## End of /* ... */ comment
- //
- // | ## OR various things which aren't comments:
- //
- // (
- // " ## Start of " ... " string
- // (
- // \\. ## Escaped char
- // | ## OR
- // [^"\\] ## Non "\
- // )*
- // " ## End of " ... " string
- //
- // | ## OR
- //
- // ' ## Start of ' ... ' string
- // (
- // \\. ## Escaped char
- // | ## OR
- // [^'\\] ## Non '\
- // )*
- // ' ## End of ' ... ' string
- //
- // | ## OR
- //
- // . ## Anything other char
- // [^/"'\\]* ## Chars which doesn't start a comment, string or escape
- // )
- // }{$2}gxs;
-
- return $buffer;
- }
-
-
- /*
- * Returns the next character in the filtered stream, not including
- * Php comments.
- *
- * @return the next character in the resulting stream, or -1
- * if the end of the resulting stream has been reached
- *
- * @throws IOException if the underlying stream throws an IOException
- * during reading
- * @deprecated
- */
- function readChar() {
- $ch = -1;
-
- if ( $this->_readAheadCh !== -1 ) {
- $ch = $this->_readAheadCh;
- $this->_readAheadCh = -1;
- } else {
- $ch = $this->in->readChar();
- if ( $ch === "\"" ) {
- $this->_inString = !$this->_inString;
- } else {
- if ( !$this->_inString ) {
- if ( $ch === "/" ) {
- $ch = $this->in->readChar();
- if ( $ch === "/" ) {
- while ( $ch !== "\n" && $ch !== -1 ) {
- $ch = $this->in->readChar();
- }
- } else if ( $ch === "*" ) {
- while ( $ch !== -1 ) {
- $ch = $this->in->readChar();
- while ( $ch === "*" && $ch !== -1 ) {
- $ch = $this->in->readChar();
- }
-
- if ( $ch === "/" ) {
- $ch = $this->readChar();
- echo "$ch\n";
- break;
- }
- }
- } else {
- $this->_readAheadCh = $ch;
- $ch = "/";
- }
- }
- }
- }
- }
-
- return $ch;
- }
-
- /**
- * Creates a new StripJavaComments using the passed in
- * Reader for instantiation.
- *
- * @param reader A Reader object providing the underlying stream.
- * Must not be null.
- *
- * @return a new filter based on this configuration, but filtering
- * the specified reader
- */
- function chain(Reader $reader) {
- $newFilter = new StripPhpComments($reader);
- $newFilter->setProject($this->getProject());
- return $newFilter;
- }
-}
-
-?>
\ No newline at end of file
diff --git a/buildscripts/phing/classes/phing/filters/TabToSpaces.php b/buildscripts/phing/classes/phing/filters/TabToSpaces.php
deleted file mode 100644
index 7293d3b5..00000000
--- a/buildscripts/phing/classes/phing/filters/TabToSpaces.php
+++ /dev/null
@@ -1,144 +0,0 @@
-.
-*/
-
-require_once 'phing/filters/BaseParamFilterReader.php';
-require_once 'phing/filters/ChainableReader.php';
-
-/**
- * Converts tabs to spaces.
- *
- * Example:
- *
- *
- *
- * Or:
- *
- *
- *
- *
- *
- * @author Yannick Lecaillez
- * @author Hans Lellelid
- * @version $Revision: 1.9 $
- * @see BaseParamFilterReader
- * @package phing.filters
- */
-class TabToSpaces extends BaseParamFilterReader implements ChainableReader {
-
- /**
- * The default tab length.
- * @var int
- */
- const DEFAULT_TAB_LENGTH = 8;
-
- /**
- * Parameter name for the length of a tab.
- * @var string
- */
- const TAB_LENGTH_KEY = "tablength";
-
- /**
- * Tab length in this filter.
- * @var int
- */
- private $tabLength = 8; //self::DEFAULT_TAB_LENGTH;
-
- /**
- * Returns stream after converting tabs to the specified number of spaces.
- *
- * @return the resulting stream, or -1
- * if the end of the resulting stream has been reached
- *
- * @exception IOException if the underlying stream throws an IOException
- * during reading
- */
- function read($len = null) {
-
- if ( !$this->getInitialized() ) {
- $this->_initialize();
- $this->setInitialized(true);
- }
-
- $buffer = $this->in->read($len);
-
- if($buffer === -1) {
- return -1;
- }
-
- $buffer = str_replace("\t", str_repeat(' ', $this->tabLength), $buffer);
-
- return $buffer;
- }
-
- /**
- * Sets the tab length.
- *
- * @param int $tabLength The number of spaces to be used when converting a tab.
- */
- function setTablength($tabLength) {
- $this->tabLength = (int) $tabLength;
- }
-
- /**
- * Returns the tab length.
- *
- * @return int The number of spaces used when converting a tab
- */
- function getTablength() {
- return $this->tabLength;
- }
-
- /**
- * Creates a new TabsToSpaces using the passed in
- * Reader for instantiation.
- *
- * @param Reader $reader A Reader object providing the underlying stream.
- * Must not be null.
- *
- * @return Reader A new filter based on this configuration, but filtering
- * the specified reader
- */
- function chain(Reader $reader) {
- $newFilter = new TabToSpaces($reader);
- $newFilter->setTablength($this->getTablength());
- $newFilter->setInitialized(true);
- $newFilter->setProject($this->getProject());
- return $newFilter;
- }
-
- /**
- * Parses the parameters to set the tab length.
- */
- private function _initialize() {
- $params = $this->getParameters();
- if ( $params !== null ) {
- for($i = 0 ; $igetName()) {
- $this->tabLength = $params[$i]->getValue();
- break;
- }
- }
- }
- }
-}
-
-?>
diff --git a/buildscripts/phing/classes/phing/filters/TailFilter.php b/buildscripts/phing/classes/phing/filters/TailFilter.php
deleted file mode 100644
index a6af6e4b..00000000
--- a/buildscripts/phing/classes/phing/filters/TailFilter.php
+++ /dev/null
@@ -1,157 +0,0 @@
-.
-*/
-
-require_once 'phing/filters/BaseParamFilterReader.php';
-
-/**
- * Reads the last n lines of a stream. (Default is last10 lines.)
- *
- * Example:
- *
- *
- *
- * @author Hans Lellelid
- * @version $Revision: 1.2 $ $Date: 2005/12/08 19:15:20 $
- * @package phing.filters
- */
-class TidyFilter extends BaseParamFilterReader implements ChainableReader {
-
- /** @var string Encoding of resulting document. */
- private $encoding = 'utf8';
-
- /** @var array Parameter[] */
- private $configParameters = array();
-
- /**
- * Set the encoding for resulting (X)HTML document.
- * @param string $v
- */
- public function setEncoding($v) {
- $this->encoding = $v;
- }
-
- /**
- * Sets the config params.
- * @param array Parameter[]
- * @see chain()
- */
- public function setConfigParameters($params)
- {
- $this->configParameters = $params;
- }
-
- /**
- * Adds a element (which is a Parameter).
- * @return Parameter
- */
- public function createConfig() {
- $num = array_push($this->configParameters, new Parameter());
- return $this->configParameters[$num-1];
- }
-
- /**
- * Converts the Parameter objects being used to store configuration into a simle assoc array.
- * @return array
- */
- private function getDistilledConfig() {
- $config = array();
- foreach($this->configParameters as $p) {
- $config[$p->getName()] = $p->getValue();
- }
- return $config;
- }
-
- /**
- * Reads input and returns Tidy-filtered output.
- *
- * @return the resulting stream, or -1 if the end of the resulting stream has been reached
- *
- * @throws IOException if the underlying stream throws an IOException
- * during reading
- */
- function read($len = null) {
-
- if (!class_exists('Tidy')) {
- throw new BuildException("You must enable the 'tidy' extension in your PHP configuration in order to use the Tidy filter.");
- }
-
- if ( !$this->getInitialized() ) {
- $this->_initialize();
- $this->setInitialized(true);
- }
-
- $buffer = $this->in->read($len);
- if($buffer === -1) {
- return -1;
- }
-
- $config = $this->getDistilledConfig();
-
- $tidy = new Tidy();
- $tidy->parseString($buffer, $config, $this->encoding);
- $tidy->cleanRepair();
-
- return tidy_get_output($tidy);
-
- }
-
-
- /**
- * Creates a new TidyFilter using the passed in Reader for instantiation.
- *
- * @param reader A Reader object providing the underlying stream.
- * Must not be null.
- *
- * @return a new filter based on this configuration, but filtering
- * the specified reader
- */
- public function chain(Reader $reader) {
- $newFilter = new TidyFilter($reader);
- $newFilter->setConfigParameters($this->configParameters);
- $newFilter->setEncoding($this->encoding);
- $newFilter->setProject($this->getProject());
- return $newFilter;
- }
-
- /**
- * Initializes any parameters (e.g. config options).
- * This method is only called when this filter is used through a tag in build file.
- */
- private function _initialize() {
- $params = $this->getParameters();
- if ($params) {
- foreach($params as $param) {
- if ($param->getType() == "config") {
- $this->configParameters[] = $param;
- } else {
-
- if ($param->getName() == "encoding") {
- $this->setEncoding($param->getValue());
- }
-
- }
-
- }
- }
- }
-
-}
diff --git a/buildscripts/phing/classes/phing/filters/TranslateGettext.php b/buildscripts/phing/classes/phing/filters/TranslateGettext.php
deleted file mode 100644
index f71823e3..00000000
--- a/buildscripts/phing/classes/phing/filters/TranslateGettext.php
+++ /dev/null
@@ -1,285 +0,0 @@
-.
-*/
-
-require_once 'phing/filters/BaseParamFilterReader.php';
-include_once 'phing/filters/ChainableReader.php';
-
-/**
- * Replaces gettext("message id") and _("message id") with the translated string.
- *
- * Gettext is great for creating multi-lingual sites, but in some cases (e.g. for
- * performance reasons) you may wish to replace the gettext calls with the translations
- * of the strings; that's what this task is for. Note that this is similar to
- * ReplaceTokens, but both the find and the replace aspect is more complicated -- hence
- * this is a separate, stand-alone filter.
- *
- *
- * Example:
- *
- *
- *
- *
- * @author Hans Lellelid
- * @version $Revision: 1.11 $ $Date: 2005/12/08 15:59:56 $
- * @access public
- * @see BaseFilterReader
- * @package phing.filters
- */
-class TranslateGettext extends BaseParamFilterReader implements ChainableReader {
-
- // constants for specifying keys to expect
- // when this is called using
- const DOMAIN_KEY = "domain";
- const DIR_KEY = "dir";
- const LOCALE_KEY = "locale";
-
- /** The domain to use */
- private $domain = 'messages';
-
- /** The dir containing LC_MESSAGES */
- private $dir;
-
- /** The locale to use */
- private $locale;
-
- /** The system locale before it was changed for this filter. */
- private $storedLocale;
-
- /**
- * Set the text domain to use.
- * The text domain must correspond to the name of the compiled .mo files.
- * E.g. "messages" ==> $dir/LC_MESSAGES/messages.mo
- * "mydomain" ==> $dir/LC_MESSAGES/mydomain.mo
- * @param string $domain
- */
- function setDomain($domain) {
- $this->domain = $domain;
- }
-
- /**
- * Get the current domain.
- * @return string
- */
- function getDomain() {
- return $this->domain;
- }
-
- /**
- * Sets the root locale directory.
- * @param PhingFile $dir
- */
- function setDir(PhingFile $dir) {
- $this->dir = $dir;
- }
-
- /**
- * Gets the root locale directory.
- * @return PhingFile
- */
- function getDir() {
- return $this->dir;
- }
-
- /**
- * Sets the locale to use for translation.
- * Note that for gettext() to work, you have to make sure this locale
- * is specific enough for your system (e.g. some systems may allow an 'en' locale,
- * but others will require 'en_US', etc.).
- * @param string $locale
- */
- function setLocale($locale) {
- $this->locale = $locale;
- }
-
- /**
- * Gets the locale to use for translation.
- * @return string
- */
- function getLocale() {
- return $this->locale;
- }
-
- /**
- * Make sure that required attributes are set.
- * @throws BuldException - if any required attribs aren't set.
- */
- protected function checkAttributes() {
- if (!$this->domain || !$this->locale || !$this->dir) {
- throw new BuildException("You must specify values for domain, locale, and dir attributes.");
- }
- }
-
- /**
- * Initialize the gettext/locale environment.
- * This method will change some env vars and locale settings; the
- * restoreEnvironment should put them all back :)
- *
- * @return void
- * @throws BuildException - if locale cannot be set.
- * @see restoreEnvironment()
- */
- protected function initEnvironment() {
- $this->storedLocale = getenv("LANG");
-
- $this->log("Setting locale to " . $this->locale, PROJECT_MSG_DEBUG);
- putenv("LANG=".$this->locale);
- $ret = setlocale(LC_ALL, $this->locale);
- if ($ret === false) {
- $msg = "Could not set locale to " . $this->locale
- . ". You may need to use fully qualified name"
- . " (e.g. en_US instead of en).";
- throw new BuildException($msg);
- }
-
- $this->log("Binding domain '".$this->domain."' to " . $this->dir, PROJECT_MSG_DEBUG);
- bindtextdomain($this->domain, $this->dir->getAbsolutePath());
- textdomain($this->domain);
- }
-
- /**
- * Restores environment settings and locale.
- * This does _not_ restore any gettext-specific settings
- * (e.g. textdomain()).
- *
- * @return void
- */
- protected function restoreEnvironment() {
- putenv("LANG=".$this->storedLocale);
- setlocale(LC_ALL, $this->storedLocale);
- }
-
- /**
- * Performs gettext translation of msgid and returns translated text.
- *
- * This function simply wraps gettext() call, but provides ability to log
- * string replacements. (alternative would be using preg_replace with /e which
- * would probably be faster, but no ability to debug/log.)
- *
- * @param array $matches Array of matches; we're interested in $matches[2].
- * @return string Translated text
- */
- private function xlateStringCallback($matches) {
- $charbefore = $matches[1];
- $msgid = $matches[2];
- $translated = gettext($msgid);
- $this->log("Translating \"$msgid\" => \"$translated\"", PROJECT_MSG_DEBUG);
- return $charbefore . '"' . $translated . '"';
- }
-
- /**
- * Returns the filtered stream.
- * The original stream is first read in fully, and then translation is performed.
- *
- * @return mixed the filtered stream, or -1 if the end of the resulting stream has been reached.
- *
- * @throws IOException - if the underlying stream throws an IOException during reading
- * @throws BuildException - if the correct params are not supplied
- */
- function read($len = null) {
-
- if ( !$this->getInitialized() ) {
- $this->_initialize();
- $this->setInitialized(true);
- }
-
- // Make sure correct params/attribs have been set
- $this->checkAttributes();
-
- $buffer = $this->in->read($len);
- if($buffer === -1) {
- return -1;
- }
-
- // Setup the locale/gettext environment
- $this->initEnvironment();
-
-
- // replace any occurrences of _("") or gettext("") with
- // the translated value.
- //
- // ([^\w]|^)_\("((\\"|[^"])*)"\)
- // --$1--- -----$2----
- // ---$3-- [match escaped quotes or any char that's not a quote]
- //
- // also match gettext() -- same as above
-
- $buffer = preg_replace_callback('/([^\w]|^)_\("((\\\"|[^"])*)"\)/', array($this, 'xlateStringCallback'), $buffer);
- $buffer = preg_replace_callback('/([^\w]|^)gettext\("((\\\"|[^"])*)"\)/', array($this, 'xlateStringCallback'), $buffer);
-
- // Check to see if there are any _('') calls and flag an error
-
- // Check to see if there are any unmatched gettext() calls -- and flag an error
-
- $matches = array();
- if (preg_match('/([^\w]|^)(gettext\([^\)]+\))/', $buffer, $matches)) {
- $this->log("Unable to perform translation on: " . $matches[2], PROJECT_MSG_WARN);
- }
-
- $this->restoreEnvironment();
-
- return $buffer;
- }
-
- /**
- * Creates a new TranslateGettext filter using the passed in
- * Reader for instantiation.
- *
- * @param Reader $reader A Reader object providing the underlying stream.
- * Must not be null.
- *
- * @return TranslateGettext A new filter based on this configuration, but filtering
- * the specified reader
- */
- function chain(Reader $reader) {
- $newFilter = new TranslateGettext($reader);
- $newFilter->setProject($this->getProject());
- $newFilter->setDomain($this->getDomain());
- $newFilter->setLocale($this->getLocale());
- $newFilter->setDir($this->getDir());
- return $newFilter;
- }
-
- /**
- * Parses the parameters if this filter is being used in "generic" mode.
- */
- private function _initialize() {
- $params = $this->getParameters();
- if ( $params !== null ) {
- foreach($params as $param) {
- switch($param->getType()) {
- case self::DOMAIN_KEY:
- $this->setDomain($param->getValue());
- break;
- case self::DIR_KEY:
- $this->setDir($this->project->resolveFile($param->getValue()));
- break;
-
- case self::LOCALE_KEY:
- $this->setLocale($param->getValue());
- break;
- } // switch
- }
- } // if params !== null
- }
-}
-
-?>
diff --git a/buildscripts/phing/classes/phing/filters/XsltFilter.php b/buildscripts/phing/classes/phing/filters/XsltFilter.php
deleted file mode 100644
index 0b8c4e6f..00000000
--- a/buildscripts/phing/classes/phing/filters/XsltFilter.php
+++ /dev/null
@@ -1,317 +0,0 @@
-.
-*/
-
-include_once 'phing/filters/BaseParamFilterReader.php';
-include_once 'phing/filters/ChainableReader.php';
-
-/**
- * Applies XSL stylesheet to incoming text.
- *
- * Uses PHP XSLT support (libxslt).
- *
- * @author Hans Lellelid
- * @author Yannick Lecaillez
- * @author Andreas Aderhold
- * @version $Revision: 1.16 $
- * @see FilterReader
- * @package phing.filters
- */
-class XsltFilter extends BaseParamFilterReader implements ChainableReader {
-
- /**
- * Path to XSL stylesheet.
- * @var string
- */
- private $xslFile = null;
-
- /**
- * Whether XML file has been transformed.
- * @var boolean
- */
- private $processed = false;
-
- /**
- * XSLT Params.
- * @var array
- */
- private $xsltParams = array();
-
- /**
- * Whether to use loadHTML() to parse the input XML file.
- */
- private $html = false;
-
- /**
- * Create new XSLT Param object, to handle the nested element.
- * @return XSLTParam
- */
- function createParam() {
- $num = array_push($this->xsltParams, new XSLTParam());
- return $this->xsltParams[$num-1];
- }
-
- /**
- * Sets the XSLT params for this class.
- * This is used to "clone" this class, in the chain() method.
- * @param array $params
- */
- function setParams($params) {
- $this->xsltParams = $params;
- }
-
- /**
- * Returns the XSLT params set for this class.
- * This is used to "clone" this class, in the chain() method.
- * @return array
- */
- function getParams() {
- return $this->xsltParams;
- }
-
- /**
- * Set the XSLT stylesheet.
- * @param mixed $file PhingFile object or path.
- */
- function setStyle(PhingFile $file) {
- $this->xslFile = $file;
- }
-
- /**
- * Whether to use HTML parser for the XML.
- * This is supported in libxml2 -- Yay!
- * @return boolean
- */
- function getHtml() {
- return $this->html;
- }
-
- /**
- * Whether to use HTML parser for XML.
- * @param boolean $b
- */
- function setHtml($b) {
- $this->html = (boolean) $b;
- }
-
- /**
- * Get the path to XSLT stylesheet.
- * @return mixed XSLT stylesheet path.
- */
- function getStyle() {
- return $this->xslFile;
- }
-
- /**
- * Reads stream, applies XSLT and returns resulting stream.
- * @return string transformed buffer.
- * @throws BuildException - if XSLT support missing, if error in xslt processing
- */
- function read($len = null) {
-
- if (!class_exists('XSLTProcessor')) {
- throw new BuildException("Could not find the XSLTProcessor class. Make sure PHP has been compiled/configured to support XSLT.");
- }
-
- if ($this->processed === true) {
- return -1; // EOF
- }
-
- if ( !$this->getInitialized() ) {
- $this->_initialize();
- $this->setInitialized(true);
- }
-
- // Read XML
- $_xml = null;
- while ( ($data = $this->in->read($len)) !== -1 )
- $_xml .= $data;
-
- if ($_xml === null ) { // EOF?
- return -1;
- }
-
- if(empty($_xml)) {
- $this->log("XML file is empty!", PROJECT_MSG_WARN);
- return ''; // return empty string, don't attempt to apply XSLT
- }
-
- // Read XSLT
- $_xsl = null;
- $xslFr = new FileReader($this->xslFile);
- $xslFr->readInto($_xsl);
-
- $this->log("Tranforming XML " . $this->in->getResource() . " using style " . $this->xslFile->getPath(), PROJECT_MSG_VERBOSE);
-
- $out = '';
- try {
- $out = $this->process($_xml, $_xsl);
- $this->processed = true;
- } catch (IOException $e) {
- throw new BuildException($e);
- }
-
- return $out;
- }
-
- // {{{ method _ProcessXsltTransformation($xml, $xslt) throws BuildException
- /**
- * Try to process the XSLT transformation
- *
- * @param string XML to process.
- * @param string XSLT sheet to use for the processing.
- *
- * @throws BuildException On XSLT errors
- */
- protected function process($xml, $xsl) {
-
- $processor = new XSLTProcessor();
-
- $xmlDom = new DOMDocument();
- $xslDom = new DOMDocument();
-
- if ($this->html) {
- $xmlDom->loadHTML($xml);
- } else {
- $xmlDom->loadXML($xml);
- }
-
- $xslDom->loadxml($xsl);
-
- $processor->importStylesheet($xslDom);
-
- // ignoring param "type" attrib, because
- // we're only supporting direct XSL params right now
- foreach($this->xsltParams as $param) {
- $this->log("Setting XSLT param: " . $param->getName() . "=>" . $param->getExpression(), PROJECT_MSG_DEBUG);
- $processor->setParameter(null, $param->getName(), $param->getExpression());
- }
-
- $result = $processor->transformToXML($xmlDom);
-
- if ( !$result ) {
- //$errno = xslt_errno($processor);
- //$err = xslt_error($processor);
- throw new BuildException("XSLT Error");
- } else {
- return $result;
- }
- }
-
- /**
- * Creates a new XsltFilter using the passed in
- * Reader for instantiation.
- *
- * @param Reader A Reader object providing the underlying stream.
- * Must not be null.
- *
- * @return Reader A new filter based on this configuration, but filtering
- * the specified reader
- */
- function chain(Reader $reader) {
- $newFilter = new XsltFilter($reader);
- $newFilter->setProject($this->getProject());
- $newFilter->setStyle($this->getStyle());
- $newFilter->setInitialized(true);
- $newFilter->setParams($this->getParams());
- $newFilter->setHtml($this->getHtml());
- return $newFilter;
- }
-
- /**
- * Parses the parameters to get stylesheet path.
- */
- private function _initialize() {
- $params = $this->getParameters();
- if ( $params !== null ) {
- for($i = 0, $_i=count($params) ; $i < $_i; $i++) {
- if ( $params[$i]->getType() === null ) {
- if ($params[$i]->getName() === "style") {
- $this->setStyle($params[$i]->getValue());
- }
- } elseif ($params[$i]->getType() == "param") {
- $xp = new XSLTParam();
- $xp->setName($params[$i]->getName());
- $xp->setExpression($params[$i]->getValue());
- $this->xsltParams[] = $xp;
- }
- }
- }
- }
-
-}
-
-
-/**
- * Class that holds an XSLT parameter.
- */
-class XSLTParam {
-
- private $name;
-
- private $expr;
-
- /**
- * Sets param name.
- * @param string $name
- */
- public function setName($name) {
- $this->name = $name;
- }
-
- /**
- * Get param name.
- * @return string
- */
- public function getName() {
- return $this->name;
- }
-
- /**
- * Sets expression value.
- * @param string $expr
- */
- public function setExpression($expr) {
- $this->expr = $expr;
- }
-
- /**
- * Sets expression to dynamic register slot.
- * @param RegisterSlot $expr
- */
- public function setListeningExpression(RegisterSlot $expr) {
- $this->expr = $expr;
- }
-
- /**
- * Returns expression value -- performs lookup if expr is registerslot.
- * @return string
- */
- public function getExpression() {
- if ($this->expr instanceof RegisterSlot) {
- return $this->expr->getValue();
- } else {
- return $this->expr;
- }
- }
-}
-
-?>
\ No newline at end of file
diff --git a/buildscripts/phing/classes/phing/filters/util/ChainReaderHelper.php b/buildscripts/phing/classes/phing/filters/util/ChainReaderHelper.php
deleted file mode 100644
index 80508a82..00000000
--- a/buildscripts/phing/classes/phing/filters/util/ChainReaderHelper.php
+++ /dev/null
@@ -1,184 +0,0 @@
-.
-*/
-
-include_once 'phing/Project.php';
-include_once 'phing/filters/BaseFilterReader.php';
-include_once 'phing/types/PhingFilterReader.php';
-include_once 'phing/types/FilterChain.php';
-include_once 'phing/types/Parameter.php';
-include_once 'phing/util/FileUtils.php';
-include_once 'phing/util/StringHelper.php';
-include_once 'phing/filters/ChainableReader.php';
-
-/**
- * Process a FilterReader chain.
- *
- * Here, the interesting method is 'getAssembledReader'.
- * The purpose of this one is to create a simple Reader object which
- * apply all filters on another primary Reader object.
- *
- * For example : In copyFile (phing.util.FileUtils) the primary Reader
- * is a FileReader object (more accuratly, a BufferedReader) previously
- * setted for the source file to copy. So, consider this filterchain :
- *
- *
- *
- *
- *
- *
- *
- *
- *
- * getAssembledReader will return a Reader object wich read on each
- * of these filters. Something like this : ('->' = 'which read data from') :
- *
- * [TABTOSPACES] -> [LINECONTAINS] -> [STRIPPHPCOMMENTS] -> [FILEREADER]
- * (primary reader)
- *
- * So, getAssembledReader will return the TABTOSPACES Reader object. Then
- * each read done with this Reader object will follow this path.
- *
- * Hope this explanation is clear :)
- *
- * TODO: Implement the classPath feature.
- *
- * @author Yannick Lecaillez
- * @version $Revision: 1.8 $ $Date: 2005/02/27 20:52:09 $
- * @access public
- * @package phing.filters.util
-*/
-class ChainReaderHelper {
-
- /** Primary reader to wich the reader chain is to be attached */
- private $primaryReader = null;
-
- /** The site of the buffer to be used. */
- private $bufferSize = 8192;
-
- /** Chain of filters */
- private $filterChains = array();
-
- /** The Phing project */
- private $project;
-
- /*
- * Sets the primary reader
- */
- function setPrimaryReader(Reader $reader) {
- $this->primaryReader = $reader;
- }
-
- /*
- * Set the project to work with
- */
- function setProject(Project $project) {
- $this->project = $project;
- }
-
- /*
- * Get the project
- */
- function getProject() {
- return $this->project;
- }
-
- /*
- * Sets the buffer size to be used. Defaults to 8192,
- * if this method is not invoked.
- */
- function setBufferSize($size) {
- $this->bufferSize = $size;
- }
-
- /*
- * Sets the collection of filter reader sets
- */
- function setFilterChains(&$fchain) {
- $this->filterChains = &$fchain;
- }
-
- /*
- * Assemble the reader
- */
- function getAssembledReader() {
-
- $instream = $this->primaryReader;
- $filterReadersCount = count($this->filterChains);
- $finalFilters = array();
-
- // Collect all filter readers of all filter chains used ...
- for($i = 0 ; $i<$filterReadersCount ; $i++) {
- $filterchain = &$this->filterChains[$i];
- $filterReaders = $filterchain->getFilterReaders();
- $readerCount = count($filterReaders);
- for($j = 0 ; $j<$readerCount ; $j++) {
- $finalFilters[] = $filterReaders[$j];
- }
- }
-
- // ... then chain the filter readers.
- $filtersCount = count($finalFilters);
- if ( $filtersCount > 0 ) {
- for($i = 0 ; $i<$filtersCount ; $i++) {
- $filter = $finalFilters[$i];
-
- if ( $filter instanceof PhingFilterReader ) {
-
- // This filter reader is an external class.
- $className = $filter->getClassName();
- $classpath = $filter->getClasspath();
- $project = $filter->getProject();
-
- if ( $className !== null ) {
- $cls = Phing::import($className, $classpath);
- $impl = new $cls();
- }
-
- if ( !($impl instanceof FilterReader) ) {
- throw new Exception($className." does not extend phing.system.io.FilterReader");
- }
-
- $impl->setReader($instream); // chain
- $impl->setProject($this->getProject()); // what about $project above ?
-
- if ( $impl instanceof Parameterizable ) {
- $impl->setParameters($filter->getParams());
- }
-
- $instream = $impl; // now that it's been chained
-
- } elseif (($filter instanceof ChainableReader) && ($filter instanceof Reader)) {
- if ( $this->getProject() !== null && ($filter instanceof BaseFilterReader) ) {
- $filter->setProject($this->getProject());
- }
- $instream = $filter->chain($instream);
- } else {
- throw new Exception("Cannot chain invalid filter: " . get_class($filter));
- }
- }
- }
-
- return $instream;
- }
-
-}
-
-?>
\ No newline at end of file
diff --git a/buildscripts/phing/classes/phing/filters/util/IniFileTokenReader.php b/buildscripts/phing/classes/phing/filters/util/IniFileTokenReader.php
deleted file mode 100644
index 34bc5943..00000000
--- a/buildscripts/phing/classes/phing/filters/util/IniFileTokenReader.php
+++ /dev/null
@@ -1,96 +0,0 @@
-.
-*/
-
-include_once 'phing/types/TokenReader.php';
-include_once 'phing/system/io/IOException.php';
-include_once 'phing/filters/ReplaceTokens.php'; // For class Token
-
-/**
- * Class that allows reading tokens from INI files.
- *
- * @author Manuel Holtgewe
- * @version $Revision: 1.7 $
- * @package phing.filters.util
- */
-class IniFileTokenReader extends TokenReader {
-
- /**
- * Holds the path to the INI file that is to be read.
- * @var object Reference to a PhingFile Object representing
- * the path to the INI file.
- */
- private $file = null;
-
- /**
- * @var string Sets the section to load from the INI file.
- * if omitted, all sections are loaded.
- */
- private $section = null;
-
- /**
- * Reads the next token from the INI file
- *
- * @throws IOException On error
- */
- function readToken() {
- if ($this->file === null) {
- throw new BuildException("No File set for IniFileTokenReader");
- }
-
- static $tokens = null;
- if ($tokens === null) {
- $tokens = array();
- $arr = parse_ini_file($this->file->getAbsolutePath(), true);
- if ($this->section === null) {
- foreach ($arr as $sec_name => $values) {
- foreach($arr[$sec_name] as $key => $value) {
- $tok = new Token;
- $tok->setKey($key);
- $tok->setValue($value);
- $tokens[] = $tok;
- }
- }
- } else if (isset($arr[$this->section])) {
- foreach ($arr[$this->section] as $key => $value) {
- $tok = new Token;
- $tok->setKey($key);
- $tok->setValue($value);
- $tokens[] = $tok;
- }
- }
- }
-
- if (count($tokens) > 0) {
- return array_pop($tokens);
- } else
- return null;
- }
-
- function setFile(PhingFile $file) {
- $this->file = $file;
- }
-
- function setSection($str) {
- $this->section = (string) $str;
- }
-}
-
-?>
diff --git a/buildscripts/phing/classes/phing/input/DefaultInputHandler.php b/buildscripts/phing/classes/phing/input/DefaultInputHandler.php
deleted file mode 100644
index 8ce76cdd..00000000
--- a/buildscripts/phing/classes/phing/input/DefaultInputHandler.php
+++ /dev/null
@@ -1,82 +0,0 @@
-.
- */
-
-require_once 'phing/input/InputHandler.php';
-include_once 'phing/system/io/ConsoleReader.php';
-
-/**
- * Prompts using print(); reads input from Console.
- *
- * @author Hans Lellelid (Phing)
- * @author Stefan Bodewig (Ant)
- * @version $Revision: 1.6 $
- * @package phing.input
- */
-class DefaultInputHandler implements InputHandler {
-
- /**
- * Prompts and requests input. May loop until a valid input has
- * been entered.
- * @throws BuildException
- */
- public function handleInput(InputRequest $request) {
- $prompt = $this->getPrompt($request);
- $in = new ConsoleReader();
- do {
- print $prompt;
- try {
- $input = $in->readLine();
- if ($input === "" && ($request->getDefaultValue() !== null) ) {
- $input = $request->getDefaultValue();
- }
- $request->setInput($input);
- } catch (Exception $e) {
- throw new BuildException("Failed to read input from Console.", $e);
- }
- } while (!$request->isInputValid());
- }
-
- /**
- * Constructs user prompt from a request.
- *
- *
This implementation adds (choice1,choice2,choice3,...) to the
- * prompt for MultipleChoiceInputRequests.
- *
- * @param $request the request to construct the prompt for.
- * Must not be null.
- */
- protected function getPrompt(InputRequest $request) {
- $prompt = $request->getPrompt();
-
- // use is_a() to avoid needing the class to be loaded
- if (is_a($request, 'YesNoInputRequest')) { // (yes/no)
- $prompt .= '(' . implode('/', $request->getChoices()) .')';
- } elseif (is_a($request, 'MultipleChoiceInputRequest')) { // (a,b,c,d)
- $prompt .= '(' . implode(',', $request->getChoices()) . ')';
- }
- if ($request->getDefaultValue() !== null) {
- $prompt .= ' ['.$request->getDefaultValue().']';
- }
- $pchar = $request->getPromptChar();
- return $prompt . ($pchar ? $pchar . ' ' : ' ');
- }
-}
diff --git a/buildscripts/phing/classes/phing/input/InputHandler.php b/buildscripts/phing/classes/phing/input/InputHandler.php
deleted file mode 100644
index 68fad7b5..00000000
--- a/buildscripts/phing/classes/phing/input/InputHandler.php
+++ /dev/null
@@ -1,45 +0,0 @@
-.
- */
-
-/**
- * Plugin to Phing to handle requests for user input.
- *
- * @author Stefan Bodewig
- * @version $Revision: 1.3 $
- * @package phing.input
- */
-interface InputHandler {
-
- /**
- * Handle the request encapsulated in the argument.
- *
- *
Precondition: the request.getPrompt will return a non-null
- * value.
- *
- *
Postcondition: request.getInput will return a non-null
- * value, request.isInputValid will return true.
adding a reference to the task (if id attribute is given)
- *
executing the task if the container is the <project>
- * element
- *
- *
- * @param string $tag The tag that comes in
- * @param array $attrs Attributes the tag carries
- * @throws ExpatParseException if attributes are incomplete or invalid
- */
- function init($tag, $attrs) {
- // shorthands
- try {
- $configurator = $this->configurator;
- $project = $this->configurator->project;
-
- $this->task = $project->createTask($tag);
- } catch (BuildException $be) {
- // swallow here, will be thrown again in
- // UnknownElement->maybeConfigure if the problem persists.
- print("Swallowing exception: ".$be->getMessage() . "\n");
- }
-
- // the task is not known of bat, try to load it on thy fly
- if ($this->task === null) {
- $this->task = new UnknownElement($tag);
- $this->task->setProject($project);
- $this->task->setTaskType($tag);
- $this->task->setTaskName($tag);
- }
-
- // add file position information to the task (from parser)
- // should be used in task exceptions to provide details
- $this->task->setLocation($this->parser->getLocation());
- $configurator->configureId($task, $attrs);
-
- if ($this->container) {
- $this->container->addTask($this->task);
- }
-
- // Top level tasks don't have associated targets
- // FIXME: if we do like Ant 1.6 and create an implicitTarget in the projectconfigurator object
- // then we don't need to check for null here ... but there's a lot of stuff that will break if we
- // do that at this point.
- if ($this->target !== null) {
- $this->task->setOwningTarget($this->target);
- $this->task->init();
- $this->wrapper = $this->task->getRuntimeConfigurableWrapper();
- $this->wrapper->setAttributes($attrs);
- if ($this->parentWrapper !== null) { // this may not make sense only within this if-block, but it
- // seems to address current use cases adequately
- $this->parentWrapper->addChild($this->wrapper);
- }
- } else {
- $this->task->init();
- $configurator->configure($this->task, $attrs, $project);
- }
- }
-
- /**
- * Executes the task at once if it's directly beneath the tag.
- */
- protected function finished() {
- if ($this->task !== null && $this->target === null) {
- try {
- $this->task->main();
- } catch (Exception $e) {
- $this->task->log($e->getMessage(), PROJECT_MSG_ERR);
- throw $e;
- }
- }
- }
-
- /**
- * Handles character data.
- *
- * @param string $data The CDATA that comes in
- */
- function characters($data) {
- if ($this->wrapper === null) {
- $configurator = $this->configurator;
- $project = $this->configurator->project;
- try { // try
- $configurator->addText($project, $this->task, $data);
- } catch (BuildException $exc) {
- throw new ExpatParseException($exc->getMessage(), $this->parser->getLocation());
- }
- } else {
- $this->wrapper->addText($data);
- }
- }
-
- /**
- * Checks for nested tags within the current one. Creates and calls
- * handlers respectively.
- *
- * @param string $name The tag that comes in
- * @param array $attrs Attributes the tag carries
- */
- function startElement($name, $attrs) {
- $project = $this->configurator->project;
- if ($this->task instanceof TaskContainer) {
- //print("TaskHandler::startElement() (TaskContainer) name = $name, attrs = " . implode(",",$attrs) . "\n");
- $th = new TaskHandler($this->parser, $this, $this->configurator, $this->task, $this->wrapper, $this->target);
- $th->init($name, $attrs);
- } else {
- //print("TaskHandler::startElement() name = $name, attrs = " . implode(",",$attrs) . "\n");
- $tmp = new NestedElementHandler($this->parser, $this, $this->configurator, $this->task, $this->wrapper, $this->target);
- $tmp->init($name, $attrs);
- }
- }
-}
diff --git a/buildscripts/phing/classes/phing/system/io/BufferedReader.php b/buildscripts/phing/classes/phing/system/io/BufferedReader.php
deleted file mode 100644
index 4946985c..00000000
--- a/buildscripts/phing/classes/phing/system/io/BufferedReader.php
+++ /dev/null
@@ -1,170 +0,0 @@
-.
-*/
-
-include_once 'phing/system/io/Reader.php';
-
-/*
- * Convenience class for reading files.
- *
- * @author Yannick Lecaillez
- * @version $Revision: 1.6 $ $Date: 2005/12/27 19:12:13 $
- * @access public
- * @see FilterReader
- * @package phing.system.io
-*/
-class BufferedReader extends Reader {
-
- private $bufferSize = 0;
- private $buffer = null;
- private $bufferPos = 0;
-
- /**
- * The Reader we are buffering for.
- */
- private $in;
-
- /**
- *
- * @param object $reader The reader (e.g. FileReader).
- * @param integer $buffsize The size of the buffer we should use for reading files.
- * A large buffer ensures that most files (all scripts?) are parsed in 1 buffer.
- */
- function __construct(Reader $reader, $buffsize = 65536) {
- $this->in = $reader;
- $this->bufferSize = $buffsize;
- }
-
- /**
- * Reads and returns $_bufferSize chunk of data.
- * @return mixed buffer or -1 if EOF.
- */
- function read($len = null) {
- // ignore $len param, not sure how to hanlde it, since
- // this should only read bufferSize amount of data.
- if ($len !== null) {
- $this->currentPosition = ftell($this->fd);
- }
-
- if ( ($data = $this->in->read($this->bufferSize)) !== -1 ) {
-
- // not all files end with a newline character, so we also need to check EOF
- if (!$this->in->eof()) {
-
- $notValidPart = strrchr($data, "\n");
- $notValidPartSize = strlen($notValidPart);
-
- if ( $notValidPartSize > 1 ) {
- // Block doesn't finish on a EOL
- // Find the last EOL and forgot all following stuff
- $dataSize = strlen($data);
- $validSize = $dataSize - $notValidPartSize + 1;
-
- $data = substr($data, 0, $validSize);
-
- // Rewind to the begining of the forgotten stuff.
- $this->in->skip(-$notValidPartSize+1);
- }
-
- } // if !EOF
- }
- return $data;
- }
-
- function skip($n) {
- return $this->in->skip($n);
- }
-
- function reset() {
- return $this->in->reset();
- }
-
- function close() {
- return $this->in->close();
- }
-
- function open() {
- return $this->in->open();
- }
-
- /**
- * Read a line from input stream.
- */
- function readLine() {
- $line = null;
- while ( ($ch = $this->readChar()) !== -1 ) {
- if ( $ch === "\n" ) {
- break;
- }
- $line .= $ch;
- }
-
- // Warning : Not considering an empty line as an EOF
- if ( $line === null && $ch !== -1 )
- return "";
-
- return $line;
- }
-
- /**
- * Reads a single char from the reader.
- * @return string single char or -1 if EOF.
- */
- function readChar() {
-
- if ( $this->buffer === null ) {
- // Buffer is empty, fill it ...
- $read = $this->in->read($this->bufferSize);
- if ($read === -1) {
- $ch = -1;
- } else {
- $this->buffer = $read;
- return $this->readChar(); // recurse
- }
- } else {
- // Get next buffered char ...
- // handle case where buffer is read-in, but is empty. The next readChar() will return -1 EOF,
- // so we just return empty string (char) at this point. (Probably could also return -1 ...?)
- $ch = ($this->buffer !== "") ? $this->buffer{$this->bufferPos} : '';
- $this->bufferPos++;
- if ( $this->bufferPos >= strlen($this->buffer) ) {
- $this->buffer = null;
- $this->bufferPos = 0;
- }
- }
-
- return $ch;
- }
-
- /**
- * Returns whether eof has been reached in stream.
- * This is important, because filters may want to know if the end of the file (and not just buffer)
- * has been reached.
- * @return boolean
- */
- function eof() {
- return $this->in->eof();
- }
-
- function getResource() {
- return $this->in->getResource();
- }
-}
-?>
diff --git a/buildscripts/phing/classes/phing/system/io/BufferedWriter.php b/buildscripts/phing/classes/phing/system/io/BufferedWriter.php
deleted file mode 100644
index c982db28..00000000
--- a/buildscripts/phing/classes/phing/system/io/BufferedWriter.php
+++ /dev/null
@@ -1,72 +0,0 @@
-.
- */
-
-include_once 'phing/system/io/Writer.php';
-
-/**
- * Convenience class for writing files.
- *
- * @author Hans Lellelid
- * @version $Revision: 1.10 $
- * @package phing.system.io
- */
-class BufferedWriter extends Writer {
-
- /**
- * The size of the buffer in kb.
- */
- private $bufferSize = 0;
-
- /**
- * The Writer we are buffering output to.
- */
- private $out;
-
- function __construct(Writer $writer, $buffsize = 8192) {
- $this->out = $writer;
- $this->bufferSize = $buffsize;
- }
-
- function write($buf, $off = null, $len = null) {
- return $this->out->write($buf, $off, $len);
- }
-
- function newLine() {
- $this->write(Phing::getProperty('line.separator'));
- }
-
- function getResource() {
- return $this->out->getResource();
- }
-
- function reset() {
- return $this->out->reset();
- }
-
- function close() {
- return $this->out->close();
- }
-
- function open() {
- return $this->out->open();
- }
-
-}
diff --git a/buildscripts/phing/classes/phing/system/io/ConsoleReader.php b/buildscripts/phing/classes/phing/system/io/ConsoleReader.php
deleted file mode 100644
index 33b37619..00000000
--- a/buildscripts/phing/classes/phing/system/io/ConsoleReader.php
+++ /dev/null
@@ -1,84 +0,0 @@
-.
- */
-
-include_once 'phing/system/io/Reader.php';
-
-/**
- * Convenience class for reading console input.
- *
- * @author Hans Lellelid
- * @author Matthew Hershberger
- * @version $Revision: 1.4 $
- * @package phing.system.io
- */
-class ConsoleReader extends Reader {
-
- function readLine() {
-
- $out = fgets(STDIN); // note: default maxlen is 1kb
- $out = rtrim($out);
-
- return $out;
- }
-
- /**
- *
- * @param int $len Num chars to read.
- * @return string chars read or -1 if eof.
- */
- function read($len = null) {
-
- $out = fread(STDIN, $len);
-
-
- return $out;
- // FIXME
- // read by chars doesn't work (yet?) with PHP stdin. Maybe
- // this is just a language feature, maybe there's a way to get
- // ability to read chars w/o ?
-
- }
-
- function close() {
- // STDIN is always open
- }
-
- function open() {
- // STDIN is always open
- }
-
- /**
- * Whether eof has been reached with stream.
- * @return boolean
- */
- function eof() {
- return feof(STDIN);
- }
-
- /**
- * Returns path to file we are reading.
- * @return string
- */
- function getResource() {
- return "console";
- }
-}
-?>
diff --git a/buildscripts/phing/classes/phing/system/io/FileReader.php b/buildscripts/phing/classes/phing/system/io/FileReader.php
deleted file mode 100644
index cbea2c7e..00000000
--- a/buildscripts/phing/classes/phing/system/io/FileReader.php
+++ /dev/null
@@ -1,179 +0,0 @@
-.
- */
-
-include_once 'phing/system/io/PhingFile.php';
-include_once 'phing/system/io/Reader.php';
-
-/**
- * Convenience class for reading files. The constructor of this
- * @package phing.system.io
- */
-
-class FileReader extends Reader {
-
- protected $file;
- protected $fd;
-
- protected $currentPosition = 0;
- protected $mark = 0;
-
- function __construct($file, $exclusive = false) {
-
- if ($file instanceof PhingFile) {
- $this->file = $file;
- } elseif (is_string($file)) {
- $this->file = new PhingFile($file);
- } else {
- throw new Exception("Illegal argument type to " . __METHOD__);
- }
- }
-
- function skip($n) {
- $this->open();
-
- $start = $this->currentPosition;
-
- $ret = @fseek($this->fd, $n, SEEK_CUR);
- if ( $ret === -1 )
- return -1;
-
- $this->currentPosition = ftell($this->fd);
-
- if ( $start > $this->currentPosition )
- $skipped = $start - $this->currentPosition;
- else
- $skipped = $this->currentPosition - $start;
-
- return $skipped;
- }
-
- /**
- * Read data from file.
- * @param int $len Num chars to read.
- * @return string chars read or -1 if eof.
- */
- function read($len = null) {
- $this->open();
- if (feof($this->fd)) {
- return -1;
- }
-
- // Compute length to read
- // possible that filesize($this->file) will be larger than
- // available bytes to read, but that's fine -- better to err on high end
- $length = ($len === null) ? filesize($this->file->getAbsolutePath()) : $len;
-
- // Read data
- $out = fread($this->fd, $length + 1); // adding 1 seems to ensure that next call to read() will return EOF (-1)
- $this->currentPosition = ftell($this->fd);
-
- return $out;
- }
-
- function mark($n = null) {
- $this->mark = $this->currentPosition;
- }
-
- function reset() {
- // goes back to last mark, by default this would be 0 (i.e. rewind file).
- fseek($this->fd, SEEK_SET, $this->mark);
- $this->mark = 0;
- }
-
- function close() {
- if ($this->fd === null) {
- return true;
- }
-
- if (false === @fclose($this->fd)) {
- // FAILED.
- $msg = "Cannot fclose " . $this->file->__toString() . " $php_errormsg";
- throw new IOException($msg);
- } else {
- $this->fd = null;
- return true;
- }
- }
-
- function open() {
- global $php_errormsg;
-
- if ($this->fd === null) {
- $this->fd = @fopen($this->file->getAbsolutePath(), "rb");
- }
-
- if ($this->fd === false) {
- // fopen FAILED.
- // Add error from php to end of log message. $php_errormsg.
- $msg = "Cannot fopen ".$this->file->getAbsolutePath().". $php_errormsg";
- throw new IOException($msg);
- }
-
- if (false) {
- // Locks don't seem to work on windows??? HELP!!!!!!!!!
- // if (FALSE === @flock($fp, LOCK_EX)) { // FAILED.
- $msg = "Cannot acquire flock on $file. $php_errormsg";
- throw new IOException($msg);
- }
-
- return true;
- }
-
- /**
- * Whether eof has been reached with stream.
- * @return boolean
- */
- function eof() {
- return feof($this->fd);
- }
-
- /**
- * Reads a entire file and stores the data in the variable
- * passed by reference.
- *
- * @param string $file String. Path and/or name of file to read.
- * @param object &$rBuffer Reference. Variable of where to put contents.
- *
- * @return TRUE on success. Err object on failure.
- * @author Charlie Killian, charlie@tizac.com
- */
- function readInto(&$rBuffer) {
-
- $this->open();
-
- $fileSize = $this->file->length();
- if ($fileSize === false) {
- $msg = "Cannot get filesize of " . $this->file->__toString() . " $php_errormsg";
- throw new IOException($msg);
- }
- $rBuffer = fread($this->fd, $fileSize);
- $this->close();
- }
-
- /**
- * Returns path to file we are reading.
- * @return string
- */
- function getResource() {
- return $this->file->toString();
- }
-}
-?>
diff --git a/buildscripts/phing/classes/phing/system/io/FileSystem.php b/buildscripts/phing/classes/phing/system/io/FileSystem.php
deleted file mode 100644
index 2802ddfb..00000000
--- a/buildscripts/phing/classes/phing/system/io/FileSystem.php
+++ /dev/null
@@ -1,657 +0,0 @@
-.
- */
-
-/**
- * This is an abstract class for platform specific filesystem implementations
- * you have to implement each method in the platform specific filesystem implementation
- * classes Your local filesytem implementation must extend this class.
- * You should also use this class as a template to write your local implementation
- * Some native PHP filesystem specific methods are abstracted here as well. Anyway
- * you _must_ always use this methods via a PhingFile object (that by nature uses the
- * *FileSystem drivers to access the real filesystem via this class using natives.
- *
- * FIXME:
- * - Error handling reduced to min fallthrough runtime excetions
- * more precise errorhandling is done by the PhingFile class
- *
- * @author Charlie Killian
- * @author Hans Lellelid
- * @version $Revision: 1.11 $
- * @package phing.system.io
- */
-abstract class FileSystem {
-
- /* properties for simple boolean attributes */
- const BA_EXISTS = 0x01;
- const BA_REGULAR = 0x02;
- const BA_DIRECTORY = 0x04;
- const BA_HIDDEN = 0x08;
-
- /** Instance for getFileSystem() method. */
- private static $fs;
-
- /**
- * Static method to return the FileSystem singelton representing
- * this platform's local filesystem driver.
- */
- function getFileSystem() {
- if (self::$fs === null) {
- switch(Phing::getProperty('host.fstype')) {
- case 'UNIX':
- include_once 'phing/system/io/UnixFileSystem.php';
- self::$fs = new UnixFileSystem();
- break;
- case 'WIN32':
- include_once 'phing/system/io/Win32FileSystem.php';
- self::$fs = new Win32FileSystem();
- break;
- case 'WINNT':
- include_once 'phing/system/io/WinNTFileSystem.php';
- self::$fs = new WinNTFileSystem();
- break;
- default:
- throw new Exception("Host uses unsupported filesystem, unable to proceed");
- }
- }
- return self::$fs;
- }
-
- /* -- Normalization and construction -- */
-
- /**
- * Return the local filesystem's name-separator character.
- */
- abstract function getSeparator();
-
- /**
- * Return the local filesystem's path-separator character.
- */
- abstract function getPathSeparator();
-
- /**
- * Convert the given pathname string to normal form. If the string is
- * already in normal form then it is simply returned.
- */
- abstract function normalize($strPath);
-
- /**
- * Compute the length of this pathname string's prefix. The pathname
- * string must be in normal form.
- */
- abstract function prefixLength($pathname);
-
- /**
- * Resolve the child pathname string against the parent.
- * Both strings must be in normal form, and the result
- * will be a string in normal form.
- */
- abstract function resolve($parent, $child);
-
- /**
- * Resolve the given abstract pathname into absolute form. Invoked by the
- * getAbsolutePath and getCanonicalPath methods in the PhingFile class.
- */
- abstract function resolveFile(PhingFile $f);
-
- /**
- * Return the parent pathname string to be used when the parent-directory
- * argument in one of the two-argument PhingFile constructors is the empty
- * pathname.
- */
- abstract function getDefaultParent();
-
- /**
- * Post-process the given URI path string if necessary. This is used on
- * win32, e.g., to transform "/c:/foo" into "c:/foo". The path string
- * still has slash separators; code in the PhingFile class will translate them
- * after this method returns.
- */
- abstract function fromURIPath($path);
-
- /* -- Path operations -- */
-
- /**
- * Tell whether or not the given abstract pathname is absolute.
- */
- abstract function isAbsolute(PhingFile $f);
-
- /**
- * canonicalize filename by checking on disk
- * @return mixed Canonical path or false if the file doesn't exist.
- */
- function canonicalize($strPath) {
- return @realpath($strPath);
- }
-
- /* -- Attribute accessors -- */
-
- /**
- * Return the simple boolean attributes for the file or directory denoted
- * by the given abstract pathname, or zero if it does not exist or some
- * other I/O error occurs.
- */
- function getBooleanAttributes($f) {
- throw new Exception("SYSTEM ERROR method getBooleanAttributes() not implemented by fs driver");
- }
-
- /**
- * Check whether the file or directory denoted by the given abstract
- * pathname may be accessed by this process. If the second argument is
- * false, then a check for read access is made; if the second
- * argument is true, then a check for write (not read-write)
- * access is made. Return false if access is denied or an I/O error
- * occurs.
- */
- function checkAccess(PhingFile $f, $write = false) {
- // we clear stat cache, its expensive to look up from scratch,
- // but we need to be sure
- @clearstatcache();
-
-
- // Shouldn't this be $f->GetAbsolutePath() ?
- // And why doesn't GetAbsolutePath() work?
-
- $strPath = (string) $f->getPath();
-
- // FIXME
- // if file object does denote a file that yet not existst
- // path rights are checked
- if (!@file_exists($strPath) && !is_dir($strPath)) {
- $strPath = $f->getParent();
- if ($strPath === null || !is_dir($strPath)) {
- $strPath = Phing::getProperty("user.dir");
- }
- //$strPath = dirname($strPath);
- }
-
- if (!$write) {
- return (boolean) @is_readable($strPath);
- } else {
- return (boolean) @is_writable($strPath);
- }
- }
-
- /**
- * Return the time at which the file or directory denoted by the given
- * abstract pathname was last modified, or zero if it does not exist or
- * some other I/O error occurs.
- */
- function getLastModifiedTime(PhingFile $f) {
-
- if (!$f->exists()) {
- return 0;
- }
-
- @clearstatcache();
- $strPath = (string) $f->getPath();
- $mtime = @filemtime($strPath);
- if (false === $mtime) {
- // FAILED. Log and return err.
- $msg = "FileSystem::Filemtime() FAILED. Cannot can not get modified time of $strPath. $php_errormsg";
- throw new Exception($msg);
- } else {
- return (int) $mtime;
- }
- }
-
- /**
- * Return the length in bytes of the file denoted by the given abstract
- * pathname, or zero if it does not exist, is a directory, or some other
- * I/O error occurs.
- */
- function getLength(PhingFile $f) {
- $strPath = (string) $f->getAbsolutePath();
- $fs = filesize((string) $strPath);
- if ($fs !== false) {
- return $fs;
- } else {
- $msg = "FileSystem::Read() FAILED. Cannot get filesize of $strPath. $php_errormsg";
- throw new Exception($msg);
- }
- }
-
- /* -- File operations -- */
-
- /**
- * Create a new empty file with the given pathname. Return
- * true if the file was created and false if a
- * file or directory with the given pathname already exists. Throw an
- * IOException if an I/O error occurs.
- *
- * @param string Path of the file to be created.
- *
- * @throws IOException
- */
- function createNewFile($strPathname) {
- if (@file_exists($strPathname))
- return false;
-
- // Create new file
- $fp = @fopen($strPathname, "w");
- if ($fp === false) {
- throw new IOException("The file \"$strPathname\" could not be created");
- }
- @fclose($fp);
- return true;
- }
-
- /**
- * Delete the file or directory denoted by the given abstract pathname,
- * returning true if and only if the operation succeeds.
- */
- function delete(PhingFile $f) {
- if ($f->isDirectory()) {
- return $this->rmdir($f->getPath());
- } else {
- return $this->unlink($f->getPath());
- }
- }
-
- /**
- * Arrange for the file or directory denoted by the given abstract
- * pathname to be deleted when Phing::shutdown is called, returning
- * true if and only if the operation succeeds.
- */
- function deleteOnExit($f) {
- throw new Exception("deleteOnExit() not implemented by local fs driver");
- }
-
- /**
- * List the elements of the directory denoted by the given abstract
- * pathname. Return an array of strings naming the elements of the
- * directory if successful; otherwise, return null.
- */
- function listDir(PhingFile $f) {
- $strPath = (string) $f->getAbsolutePath();
- $d = @dir($strPath);
- if (!$d) {
- return null;
- }
- $list = array();
- while($entry = $d->read()) {
- if ($entry != "." && $entry != "..") {
- array_push($list, $entry);
- }
- }
- $d->close();
- unset($d);
- return $list;
- }
-
- /**
- * Create a new directory denoted by the given abstract pathname,
- * returning true if and only if the operation succeeds.
- */
- function createDirectory(&$f) {
- return @mkdir($f->getAbsolutePath(),0755);
- }
-
- /**
- * Rename the file or directory denoted by the first abstract pathname to
- * the second abstract pathname, returning true if and only if
- * the operation succeeds.
- *
- * @param PhingFile $f1 abstract source file
- * @param PhingFile $f2 abstract destination file
- * @return void
- * @throws Exception if rename cannot be performed
- */
- function rename(PhingFile $f1, PhingFile $f2) {
- // get the canonical paths of the file to rename
- $src = $f1->getAbsolutePath();
- $dest = $f2->getAbsolutePath();
- if (false === @rename($src, $dest)) {
- $msg = "Rename FAILED. Cannot rename $src to $dest. $php_errormsg";
- throw new Exception($msg);
- }
- }
-
- /**
- * Set the last-modified time of the file or directory denoted by the
- * given abstract pathname returning true if and only if the
- * operation succeeds.
- * @return void
- * @throws Exception
- */
- function setLastModifiedTime(PhingFile $f, $time) {
- $path = $f->getPath();
- $success = @touch($path, $time);
- if (!$success) {
- throw new Exception("Could not create directory due to: $php_errormsg");
- }
- }
-
- /**
- * Mark the file or directory denoted by the given abstract pathname as
- * read-only, returning true if and only if the operation
- * succeeds.
- */
- function setReadOnly($f) {
- throw new Exception("setReadonle() not implemented by local fs driver");
- }
-
- /* -- Filesystem interface -- */
-
- /**
- * List the available filesystem roots, return array of PhingFile objects
- */
- function listRoots() {
- throw new Exception("SYSTEM ERROR [listRoots() not implemented by local fs driver]");
- }
-
- /* -- Basic infrastructure -- */
-
- /**
- * Compare two abstract pathnames lexicographically.
- */
- function compare($f1, $f2) {
- throw new Exception("SYSTEM ERROR [compare() not implemented by local fs driver]");
- }
-
- /**
- * Copy a file.
- *
- * @param PhingFile $src Source path and name file to copy.
- * @param PhingFile $dest Destination path and name of new file.
- *
- * @return void
- * @throws Exception if file cannot be copied.
- */
- function copy(PhingFile $src, PhingFile $dest) {
- global $php_errormsg;
- $srcPath = $src->getAbsolutePath();
- $destPath = $dest->getAbsolutePath();
-
- if (false === @copy($srcPath, $destPath)) { // Copy FAILED. Log and return err.
- // Add error from php to end of log message. $php_errormsg.
- $msg = "FileSystem::copy() FAILED. Cannot copy $srcPath to $destPath. $php_errormsg";
- throw new Exception($msg);
- }
-
- try {
- $dest->setMode($src->getMode());
- } catch(Exception $exc) {
- // [MA] does chmod returns an error on systems that do not support it ?
- // eat it up for now.
- }
- }
-
- /**
- * Change the permissions on a file or directory.
- *
- * @param pathname String. Path and name of file or directory.
- * @param mode Int. The mode (permissions) of the file or
- * directory. If using octal add leading 0. eg. 0777.
- * Mode is affected by the umask system setting.
- *
- * @return void
- * @throws Exception if operation failed.
- */
- function chmod($pathname, $mode) {
- $str_mode = decoct($mode); // Show octal in messages.
- if (false === @chmod($pathname, $mode)) {// FAILED.
- $msg = "FileSystem::chmod() FAILED. Cannot chmod $pathname. Mode $str_mode. $php_errormsg";
- throw new Exception($msg);
- }
- }
-
- /**
- * Locks a file and throws an Exception if this is not possible.
- * @return void
- * @throws Exception
- */
- function lock(PhingFile $f) {
- $filename = $f->getPath();
- $fp = @fopen($filename, "w");
- $result = @flock($fp, LOCK_EX);
- @fclose($fp);
- if (!$result) {
- throw new Exception("Could not lock file '$filename'");
- }
- }
-
- /**
- * Unlocks a file and throws an IO Error if this is not possible.
- *
- * @throws Exception
- * @return void
- */
- function unlock(PhingFile $f) {
- $filename = $f->getPath();
- $fp = @fopen($filename, "w");
- $result = @flock($fp, LOCK_UN);
- fclose($fp);
- if (!$result) {
- throw new Exception("Could not unlock file '$filename'");
- }
- }
-
- /**
- * Delete a file.
- *
- * @param file String. Path and/or name of file to delete.
- *
- * @return void
- * @throws Exception - if an error is encountered.
- */
- function unlink($file) {
- global $php_errormsg;
- if (false === @unlink($file)) {
- $msg = "FileSystem::unlink() FAILED. Cannot unlink '$file'. $php_errormsg";
- throw new Exception($msg);
- }
- }
-
- /**
- * Symbolically link a file to another name.
- *
- * Currently symlink is not implemented on Windows. Don't use if the application is to be portable.
- *
- * @param string $target Path and/or name of file to link.
- * @param string $link Path and/or name of link to be created.
- * @return void
- */
- function symlink($target, $link) {
-
- // If Windows OS then symlink() will report it is not supported in
- // the build. Use this error instead of checking for Windows as the OS.
-
- if (false === @symlink($target, $link)) {
- // Add error from php to end of log message. $php_errormsg.
- $msg = "FileSystem::Symlink() FAILED. Cannot symlink '$target' to '$link'. $php_errormsg";
- throw new Exception($msg);
- }
-
- }
-
- /**
- * Set the modification and access time on a file to the present time.
- *
- * @param string $file Path and/or name of file to touch.
- * @param int $time
- * @return void
- */
- function touch($file, $time = null) {
- global $php_errormsg;
-
- if (null === $time) {
- $error = @touch($file);
- } else {
- $error = @touch($file, $time);
- }
-
- if (false === $error) { // FAILED.
- // Add error from php to end of log message. $php_errormsg.
- $msg = "FileSystem::touch() FAILED. Cannot touch '$file'. $php_errormsg";
- throw new Exception($msg);
- }
- }
-
- /**
- * Delete an empty directory OR a directory and all of its contents.
- *
- * @param dir String. Path and/or name of directory to delete.
- * @param children Boolean. False: don't delete directory contents.
- * True: delete directory contents.
- *
- * @return void
- */
- function rmdir($dir, $children = false) {
- global $php_errormsg;
-
- // If children=FALSE only delete dir if empty.
- if (false === $children) {
-
- if (false === @rmdir($dir)) { // FAILED.
- // Add error from php to end of log message. $php_errormsg.
- $msg = "FileSystem::rmdir() FAILED. Cannot rmdir $dir. $php_errormsg";
- throw new Exception($msg);
- }
-
- } else { // delete contents and dir.
-
- $handle = @opendir($dir);
-
- if (false === $handle) { // Error.
-
- $msg = "FileSystem::rmdir() FAILED. Cannot opendir() $dir. $php_errormsg";
- throw new Exception($msg);
-
- } else { // Read from handle.
-
- // Don't error on readdir().
- while (false !== ($entry = @readdir($handle))) {
-
- if ($entry != '.' && $entry != '..') {
-
- // Only add / if it isn't already the last char.
- // This ONLY serves the purpose of making the Logger
- // output look nice:)
-
- if (strpos(strrev($dir), DIRECTORY_SEPARATOR) === 0) {// there is a /
- $next_entry = $dir . $entry;
- } else { // no /
- $next_entry = $dir . DIRECTORY_SEPARATOR . $entry;
- }
-
- // NOTE: As of php 4.1.1 is_dir doesn't return FALSE it
- // returns 0. So use == not ===.
-
- // Don't error on is_dir()
- if (false == @is_dir($next_entry)) { // Is file.
-
- try {
- self::unlink($next_entry); // Delete.
- } catch (Exception $e) {
- $msg = "FileSystem::Rmdir() FAILED. Cannot FileSystem::Unlink() $next_entry. ". $e->getMessage();
- throw new Exception($msg);
- }
-
- } else { // Is directory.
-
- try {
- self::rmdir($next_entry, true); // Delete
- } catch (Exception $e) {
- $msg = "FileSystem::rmdir() FAILED. Cannot FileSystem::rmdir() $next_entry. ". $e->getMessage();
- throw new Exception($msg);
- }
-
- } // end is_dir else
- } // end .. if
- } // end while
- } // end handle if
-
- // Don't error on closedir()
- @closedir($handle);
-
- if (false === @rmdir($dir)) { // FAILED.
- // Add error from php to end of log message. $php_errormsg.
- $msg = "FileSystem::rmdir() FAILED. Cannot rmdir $dir. $php_errormsg";
- throw new Exception($msg);
- }
-
- }
-
- }
-
- /**
- * Set the umask for file and directory creation.
- *
- * @param mode Int. Permissions ususally in ocatal. Use leading 0 for
- * octal. Number between 0 and 0777.
- *
- * @return void
- * @throws Exception if there is an error performing operation.
- */
- function umask($mode) {
- global $php_errormsg;
-
- // CONSIDERME:
- // Throw a warning if mode is 0. PHP converts illegal octal numbers to
- // 0 so 0 might not be what the user intended.
-
- $str_mode = decoct($mode); // Show octal in messages.
-
- if (false === @umask($mode)) { // FAILED.
- // Add error from php to end of log message. $php_errormsg.
- $msg = "FileSystem::Umask() FAILED. Value $mode. $php_errormsg";
- throw new Exception($msg);
- }
- }
-
- /**
- * Compare the modified time of two files.
- *
- * @param file1 String. Path and name of file1.
- * @param file2 String. Path and name of file2.
- *
- * @return Int. 1 if file1 is newer.
- * -1 if file2 is newer.
- * 0 if files have the same time.
- * Err object on failure.
- *
- * @throws Exception - if cannot get modified time of either file.
- */
- function compareMTimes($file1, $file2) {
-
- $mtime1 = filemtime($file1);
- $mtime2 = filemtime($file2);
-
- if ($mtime1 === false) { // FAILED. Log and return err.
- // Add error from php to end of log message. $php_errormsg.
- $msg = "FileSystem::compareMTimes() FAILED. Cannot can not get modified time of $file1.";
- throw new Exception($msg);
- } elseif ($mtime2 === false) { // FAILED. Log and return err.
- // Add error from php to end of log message. $php_errormsg.
- $msg = "FileSystem::compareMTimes() FAILED. Cannot can not get modified time of $file2.";
- throw new Exception($msg);
- } else { // Worked. Log and return compare.
- // Compare mtimes.
- if ($mtime1 == $mtime2) {
- return 0;
- } else {
- return ($mtime1 < $mtime2) ? -1 : 1;
- } // end compare
- }
- }
-
-}
diff --git a/buildscripts/phing/classes/phing/system/io/FileWriter.php b/buildscripts/phing/classes/phing/system/io/FileWriter.php
deleted file mode 100644
index d6265777..00000000
--- a/buildscripts/phing/classes/phing/system/io/FileWriter.php
+++ /dev/null
@@ -1,139 +0,0 @@
-.
- */
-
-include_once 'phing/system/io/PhingFile.php';
-include_once 'phing/system/io/Writer.php';
-
-/**
- * Convenience class for reading files. The constructor of this
- *
- * @package phing.system.io
- */
-class FileWriter extends Writer {
-
- protected $file;
- protected $fd;
-
- /** Whether to append contents to file. */
- protected $append;
-
- /** Whether we should attempt to lock the file (currently disabled). */
- protected $exclusive;
-
- /**
- * Construct a new FileWriter.
- * @param mixed $file PhingFile or string pathname.
- * @param boolean $append Append to existing file?
- * @param boolean $exclusive Lock file? (currently disabled due to windows incompatibility)
- */
- function __construct($file, $append = false, $exclusive = false) {
- if ($file instanceof PhingFile) {
- $this->file = $file;
- } elseif (is_string($file)) {
- $this->file = new PhingFile($file);
- } else {
- throw new Exception("Invalid argument type for \$file.");
- }
- $this->append = $append;
- $this->exclusive = $exclusive;
- }
-
- function close() {
- if ($this->fd === null) {
- return true;
- }
-
- if (false === @fclose($this->fd)) {
- // FAILED.
- $msg = "Cannot fclose " . $this->file->__toString() . " $php_errormsg";
- throw new IOException($msg);
- } else {
- $this->fd = null;
- return true;
- }
- }
-
- function open() {
- if ($this->fd === null) {
- if ($this->append) { $flags = "ab"; } else { $flags = "wb"; }
- $this->fd = @fopen($this->file->getPath(), $flags);
- }
-
- if ($this->fd === false) {
- // fopen FAILED.
- // Add error from php to end of log message. $php_errormsg.
- $msg = "Cannot fopen ".$this->file->getPath()." $php_errormsg";
- throw new IOException($msg);
- }
-
- if (false) {
- // Locks don't seem to work on windows??? HELP!!!!!!!!!
- // if (FALSE === @flock($fp, LOCK_EX)) { // FAILED.
- $msg = "Cannot acquire flock on $file. $php_errormsg";
- throw new IOException($msg);
- }
-
- return true;
- }
-
- function reset() {
- // FIXME -- what exactly should this do, if anything?
- // reset to beginning of file (i.e. re-open)?
- }
-
- function writeBuffer($buffer) {
-
- if (!$this->file->canWrite()) {
- throw new IOException("No permission to write to file: " . $this->file->__toString());
- }
-
- $this->open();
- $result = @fwrite($this->fd, $buffer);
- $this->close();
-
- if ($result === false) {
- throw new IOException("Error writing file: ". $this->file->toString());
- } else {
- return true;
- }
- }
-
- function write($buf, $off = null, $len = null) {
- if ( $off === null && $len === null )
- $to_write = $buf;
- else
- $to_write = substr($buf, $off, $len);
-
- $this->open();
- $result = @fwrite($this->fd, $to_write);
-
- if ( $result === false ) {
- throw new IOException("Error writing file.");
- } else {
- return true;
- }
- }
-
- function getResource() {
- return $this->file->toString();
- }
-}
-?>
diff --git a/buildscripts/phing/classes/phing/system/io/FilterReader.php b/buildscripts/phing/classes/phing/system/io/FilterReader.php
deleted file mode 100644
index 8c683408..00000000
--- a/buildscripts/phing/classes/phing/system/io/FilterReader.php
+++ /dev/null
@@ -1,72 +0,0 @@
-.
- */
-
-include_once 'phing/system/io/Reader.php';
-
-/**
- * Convenience class for reading files. The constructor of this
- * @package phing.system.io
- *
- * TODO: All filters should be ProjectComponents, too!
- */
-class FilterReader extends Reader {
-
- protected $in;
-
- function __construct(Reader $in = null) {
- $this->in = $in;
- //parent::__construct(new FileReader($file, $exclusive));
- }
-
- public function setReader(Reader $in) {
- $this->in = $in;
- }
-
- public function skip($n) {
- return $this->in->skip($n);
- }
-
- /**
- * Read data from source.
- * FIXME: Clean up this function signature, as it a) params aren't being used
- * and b) it doesn't make much sense.
- */
- public function read($len = null) {
- return $this->in->read($len);
- }
-
- public function reset() {
- return $this->in->reset();
- }
-
- public function close() {
- return $this->in->close();
- }
-
- public function open() {
- return $this->in->open();
- }
-
- function getResource() {
- return $this->in->getResource();
- }
-}
-?>
diff --git a/buildscripts/phing/classes/phing/system/io/IOException.php b/buildscripts/phing/classes/phing/system/io/IOException.php
deleted file mode 100644
index e2c73b27..00000000
--- a/buildscripts/phing/classes/phing/system/io/IOException.php
+++ /dev/null
@@ -1,28 +0,0 @@
-.
- */
-
-/**
- * Extends Exception to take advantage of methods therein.
- *
- * @package phing.system.io
- */
-class IOException extends Exception {}
-?>
\ No newline at end of file
diff --git a/buildscripts/phing/classes/phing/system/io/PhingFile.php b/buildscripts/phing/classes/phing/system/io/PhingFile.php
deleted file mode 100644
index cd881963..00000000
--- a/buildscripts/phing/classes/phing/system/io/PhingFile.php
+++ /dev/null
@@ -1,866 +0,0 @@
-.
- */
-
-include_once 'phing/system/io/FileSystem.php';
-include_once 'phing/system/lang/NullPointerException.php';
-
-/**
- * An abstract representation of file and directory pathnames.
- *
- * @version $Revision: 1.1 $
- * @package phing.system.io
- */
-class PhingFile {
-
- /** separator string, static, obtained from FileSystem */
- public static $separator;
-
- /** path separator string, static, obtained from FileSystem (; or :)*/
- public static $pathSeparator;
-
- /**
- * This abstract pathname's normalized pathname string. A normalized
- * pathname string uses the default name-separator character and does not
- * contain any duplicate or redundant separators.
- */
- private $path = null;
-
- /** The length of this abstract pathname's prefix, or zero if it has no prefix. */
- private $prefixLength = 0;
-
- /** constructor */
- function __construct($arg1 = null, $arg2 = null) {
-
- if (self::$separator === null || self::$pathSeparator === null) {
- $fs = FileSystem::getFileSystem();
- self::$separator = $fs->getSeparator();
- self::$pathSeparator = $fs->getPathSeparator();
- }
-
- /* simulate signature identified constructors */
- if ($arg1 instanceof PhingFile && is_string($arg2)) {
- $this->_constructFileParentStringChild($arg1, $arg2);
- } elseif (is_string($arg1) && ($arg2 === null)) {
- $this->_constructPathname($arg1);
- } elseif(is_string($arg1) && is_string($arg2)) {
- $this->_constructStringParentStringChild($arg1, $arg2);
- } else {
- if ($arg1 === null) {
- throw new NullPointerException("Argument1 to function must not be null");
- }
- $this->path = (string) $arg1;
- $this->prefixLength = (int) $arg2;
- }
- }
-
- /** Returns the length of this abstract pathname's prefix. */
- function getPrefixLength() {
- return (int) $this->prefixLength;
- }
-
- /* -- constructors not called by signature match, so we need some helpers --*/
-
- function _constructPathname($pathname) {
- // obtain ref to the filesystem layer
- $fs = FileSystem::getFileSystem();
-
- if ($pathname === null) {
- throw new NullPointerException("Argument to function must not be null");
- }
-
- $this->path = (string) $fs->normalize($pathname);
- $this->prefixLength = (int) $fs->prefixLength($this->path);
- }
-
- function _constructStringParentStringChild($parent, $child = null) {
- // obtain ref to the filesystem layer
- $fs = FileSystem::getFileSystem();
-
- if ($child === null) {
- throw new NullPointerException("Argument to function must not be null");
- }
- if ($parent !== null) {
- if ($parent === "") {
- $this->path = $fs->resolve($fs->getDefaultParent(), $fs->normalize($child));
- } else {
- $this->path = $fs->resolve($fs->normalize($parent), $fs->normalize($child));
- }
- } else {
- $this->path = (string) $fs->normalize($child);
- }
- $this->prefixLength = (int) $fs->prefixLength($this->path);
- }
-
- function _constructFileParentStringChild($parent, $child = null) {
- // obtain ref to the filesystem layer
- $fs = FileSystem::getFileSystem();
-
- if ($child === null) {
- throw new NullPointerException("Argument to function must not be null");
- }
-
- if ($parent !== null) {
- if ($parent->path === "") {
- $this->path = $fs->resolve($fs->getDefaultParent(), $fs->normalize($child));
- } else {
- $this->path = $fs->resolve($parent->path, $fs->normalize($child));
- }
- } else {
- $this->path = $fs->normalize($child);
- }
- $this->prefixLength = $fs->prefixLength($this->path);
- }
-
- /* -- Path-component accessors -- */
-
- /**
- * Returns the name of the file or directory denoted by this abstract
- * pathname. This is just the last name in the pathname's name
- * sequence. If the pathname's name sequence is empty, then the empty
- * string is returned.
- *
- * @return The name of the file or directory denoted by this abstract
- * pathname, or the empty string if this pathname's name sequence
- * is empty
- */
- function getName() {
- // that's a lastIndexOf
- $index = ((($res = strrpos($this->path, self::$separator)) === false) ? -1 : $res);
- if ($index < $this->prefixLength) {
- return substr($this->path, $this->prefixLength);
- }
- return substr($this->path, $index + 1);
- }
-
- /**
- * Returns the pathname string of this abstract pathname's parent, or
- * null if this pathname does not name a parent directory.
- *
- * The parent of an abstract pathname consists of the pathname's prefix,
- * if any, and each name in the pathname's name sequence except for the last.
- * If the name sequence is empty then the pathname does not name a parent
- * directory.
- *
- * @return The pathname string of the parent directory named by this
- * abstract pathname, or null if this pathname does not name a parent
- */
- function getParent() {
- // that's a lastIndexOf
- $index = ((($res = strrpos($this->path, self::$separator)) === false) ? -1 : $res);
- if ($index < $this->prefixLength) {
- if (($this->prefixLength > 0) && (strlen($this->path > $this->prefixLength))) {
- return substr($this->path, 0, $this->prefixLength);
- }
- return null;
- }
- return substr($this->path, 0, $index);
- }
-
- /**
- * Returns the abstract pathname of this abstract pathname's parent,
- * or null if this pathname does not name a parent directory.
- *
- * The parent of an abstract pathname consists of the pathname's prefix,
- * if any, and each name in the pathname's name sequence except for the
- * last. If the name sequence is empty then the pathname does not name
- * a parent directory.
- *
- * @return The abstract pathname of the parent directory named by this
- * abstract pathname, or null if this pathname
- * does not name a parent
- */
- function getParentFile() {
- $p = $this->getParent();
- if ($p === null) {
- return null;
- }
- return new PhingFile((string) $p, (int) $this->prefixLength);
- }
-
- /**
- * Converts this abstract pathname into a pathname string. The resulting
- * string uses the default name-separator character to separate the names
- * in the name sequence.
- *
- * @return The string form of this abstract pathname
- */
- function getPath() {
- return (string) $this->path;
- }
-
- /**
- * Tests whether this abstract pathname is absolute. The definition of
- * absolute pathname is system dependent. On UNIX systems, a pathname is
- * absolute if its prefix is "/". On Win32 systems, a pathname is absolute
- * if its prefix is a drive specifier followed by "\\", or if its prefix
- * is "\\".
- *
- * @return true if this abstract pathname is absolute, false otherwise
- */
- function isAbsolute() {
- return ($this->prefixLength !== 0);
- }
-
-
- /**
- * Returns the absolute pathname string of this abstract pathname.
- *
- * If this abstract pathname is already absolute, then the pathname
- * string is simply returned as if by the getPath method.
- * If this abstract pathname is the empty abstract pathname then
- * the pathname string of the current user directory, which is named by the
- * system property user.dir, is returned. Otherwise this
- * pathname is resolved in a system-dependent way. On UNIX systems, a
- * relative pathname is made absolute by resolving it against the current
- * user directory. On Win32 systems, a relative pathname is made absolute
- * by resolving it against the current directory of the drive named by the
- * pathname, if any; if not, it is resolved against the current user
- * directory.
- *
- * @return The absolute pathname string denoting the same file or
- * directory as this abstract pathname
- * @see #isAbsolute()
- */
- function getAbsolutePath() {
- $fs = FileSystem::getFileSystem();
- return $fs->resolveFile($this);
- }
-
- /**
- * Returns the absolute form of this abstract pathname. Equivalent to
- * getAbsolutePath.
- *
- * @return The absolute abstract pathname denoting the same file or
- * directory as this abstract pathname
- */
- function getAbsoluteFile() {
- return new PhingFile((string) $this->getAbsolutePath());
- }
-
-
- /**
- * Returns the canonical pathname string of this abstract pathname.
- *
- * A canonical pathname is both absolute and unique. The precise
- * definition of canonical form is system-dependent. This method first
- * converts this pathname to absolute form if necessary, as if by invoking the
- * getAbsolutePath() method, and then maps it to its unique form in a
- * system-dependent way. This typically involves removing redundant names
- * such as "." and .. from the pathname, resolving symbolic links
- * (on UNIX platforms), and converting drive letters to a standard case
- * (on Win32 platforms).
- *
- * Every pathname that denotes an existing file or directory has a
- * unique canonical form. Every pathname that denotes a nonexistent file
- * or directory also has a unique canonical form. The canonical form of
- * the pathname of a nonexistent file or directory may be different from
- * the canonical form of the same pathname after the file or directory is
- * created. Similarly, the canonical form of the pathname of an existing
- * file or directory may be different from the canonical form of the same
- * pathname after the file or directory is deleted.
- *
- * @return The canonical pathname string denoting the same file or
- * directory as this abstract pathname
- */
- function getCanonicalPath() {
- $fs = FileSystem::getFileSystem();
- return $fs->canonicalize($this->path);
- }
-
-
- /**
- * Returns the canonical form of this abstract pathname. Equivalent to
- * getCanonicalPath(.
- *
- * @return PhingFile The canonical pathname string denoting the same file or
- * directory as this abstract pathname
- */
- function getCanonicalFile() {
- return new PhingFile($this->getCanonicalPath());
- }
-
- /**
- * Converts this abstract pathname into a file: URL. The
- * exact form of the URL is system-dependent. If it can be determined that
- * the file denoted by this abstract pathname is a directory, then the
- * resulting URL will end with a slash.
- *
- * Usage note: This method does not automatically escape
- * characters that are illegal in URLs. It is recommended that new code
- * convert an abstract pathname into a URL by first converting it into a
- * URI, via the toURI() method, and then converting the URI
- * into a URL via the URI::toURL()
- *
- * @return A URL object representing the equivalent file URL
- *
- *
- */
- function toURL() {
- /*
- // URL class not implemented yet
- return new URL("file", "", $this->_slashify($this->getAbsolutePath(), $this->isDirectory()));
- */
- }
-
- /**
- * Constructs a file: URI that represents this abstract pathname.
- * Not implemented yet
- */
- function toURI() {
- /*
- $f = $this->getAbsoluteFile();
- $sp = (string) $this->slashify($f->getPath(), $f->isDirectory());
- if (StringHelper::startsWith('//', $sp))
- $sp = '//' + sp;
- return new URI('file', null, $sp, null);
- */
- }
-
- function _slashify($path, $isDirectory) {
- $p = (string) $path;
-
- if (self::$separator !== '/') {
- $p = str_replace(self::$separator, '/', $p);
- }
-
- if (!StringHelper::startsWith('/', $p)) {
- $p = '/'.$p;
- }
-
- if (!StringHelper::endsWith('/', $p) && $isDirectory) {
- $p = $p.'/';
- }
-
- return $p;
- }
-
- /* -- Attribute accessors -- */
-
- /**
- * Tests whether the application can read the file denoted by this
- * abstract pathname.
- *
- * @return true if and only if the file specified by this
- * abstract pathname exists and can be read by the
- * application; false otherwise
- */
- function canRead() {
- $fs = FileSystem::getFileSystem();
-
- if ($fs->checkAccess($this)) {
- return (boolean) @is_readable($this->getAbsolutePath());
- }
- return false;
- }
-
- /**
- * Tests whether the application can modify to the file denoted by this
- * abstract pathname.
- *
- * @return true if and only if the file system actually
- * contains a file denoted by this abstract pathname and
- * the application is allowed to write to the file;
- * false otherwise.
- *
- */
- function canWrite() {
- $fs = FileSystem::getFileSystem();
- return $fs->checkAccess($this, true);
- }
-
- /**
- * Tests whether the file denoted by this abstract pathname exists.
- *
- * @return true if and only if the file denoted by this
- * abstract pathname exists; false otherwise
- *
- */
- function exists() {
- if ($this->isFile()) {
- return @file_exists($this->path);
- } else {
- return @is_dir($this->path);
- }
- }
-
- /**
- * Tests whether the file denoted by this abstract pathname is a
- * directory.
- *
- * @return true if and only if the file denoted by this
- * abstract pathname exists and is a directory;
- * false otherwise
- *
- */
- function isDirectory() {
- $fs = FileSystem::getFileSystem();
- if ($fs->checkAccess($this) !== true) {
- throw new IOException("No read access to ".$this->path);
- }
- return @is_dir($this->path);
- }
-
- /**
- * Tests whether the file denoted by this abstract pathname is a normal
- * file. A file is normal if it is not a directory and, in
- * addition, satisfies other system-dependent criteria. Any non-directory
- * file created by a Java application is guaranteed to be a normal file.
- *
- * @return true if and only if the file denoted by this
- * abstract pathname exists and is a normal file;
- * false otherwise
- */
- function isFile() {
- //$fs = FileSystem::getFileSystem();
- return @is_file($this->path);
- }
-
- /**
- * Tests whether the file named by this abstract pathname is a hidden
- * file. The exact definition of hidden is system-dependent. On
- * UNIX systems, a file is considered to be hidden if its name begins with
- * a period character ('.'). On Win32 systems, a file is considered to be
- * hidden if it has been marked as such in the filesystem. Currently there
- * seems to be no way to dermine isHidden on Win file systems via PHP
- *
- * @return true if and only if the file denoted by this
- * abstract pathname is hidden according to the conventions of the
- * underlying platform
- */
- function isHidden() {
- $fs = FileSystem::getFileSystem();
- if ($fs->checkAccess($this) !== true) {
- throw new IOException("No read access to ".$this->path);
- }
- return (($fs->getBooleanAttributes($this) & $fs->BA_HIDDEN) !== 0);
- }
-
- /**
- * Returns the time that the file denoted by this abstract pathname was
- * last modified.
- *
- * @return A integer value representing the time the file was
- * last modified, measured in milliseconds since the epoch
- * (00:00:00 GMT, January 1, 1970), or 0 if the
- * file does not exist or if an I/O error occurs
- */
- function lastModified() {
- $fs = FileSystem::getFileSystem();
- if ($fs->checkAccess($this) !== true) {
- throw new IOException("No read access to " . $this->path);
- }
- return $fs->getLastModifiedTime($this);
- }
-
- /**
- * Returns the length of the file denoted by this abstract pathname.
- * The return value is unspecified if this pathname denotes a directory.
- *
- * @return The length, in bytes, of the file denoted by this abstract
- * pathname, or 0 if the file does not exist
- */
- function length() {
- $fs = FileSystem::getFileSystem();
- if ($fs->checkAccess($this) !== true) {
- throw new IOException("No read access to ".$this->path."\n");
- }
- return $fs->getLength($this);
- }
-
- /**
- * Convenience method for returning the contents of this file as a string.
- * This method uses file_get_contents() to read file in an optimized way.
- * @return string
- * @throws Exception - if file cannot be read
- */
- function contents() {
- if (!$this->canRead() || !$this->isFile()) {
- throw new IOException("Cannot read file contents!");
- }
- return file_get_contents($this->getAbsolutePath());
- }
-
- /* -- File operations -- */
-
- /**
- * Atomically creates a new, empty file named by this abstract pathname if
- * and only if a file with this name does not yet exist. The check for the
- * existence of the file and the creation of the file if it does not exist
- * are a single operation that is atomic with respect to all other
- * filesystem activities that might affect the file.
- *
- * @return true if the named file does not exist and was
- * successfully created; false if the named file
- * already exists
- * @throws IOException if file can't be created
- */
- function createNewFile($parents=true, $mode=0777) {
- $file = FileSystem::getFileSystem()->createNewFile($this->path);
- return $file;
- }
-
- /**
- * Deletes the file or directory denoted by this abstract pathname. If
- * this pathname denotes a directory, then the directory must be empty in
- * order to be deleted.
- *
- * @return true if and only if the file or directory is
- * successfully deleted; false otherwise
- */
- function delete() {
- $fs = FileSystem::getFileSystem();
- if ($fs->checkAccess($this, true) !== true) {
- throw new IOException("No read access to " . $this->path."\n");
- }
- return $fs->delete($this);
- }
-
- /**
- * Requests that the file or directory denoted by this abstract pathname
- * be deleted when php terminates. Deletion will be attempted only for
- * normal termination of php and if and if only Phing::shutdown() is
- * called.
- *
- * Once deletion has been requested, it is not possible to cancel the
- * request. This method should therefore be used with care.
- *
- */
- function deleteOnExit() {
- $fs = FileSystem::getFileSystem();
- $fs->deleteOnExit($this);
- }
-
- /**
- * Returns an array of strings naming the files and directories in the
- * directory denoted by this abstract pathname.
- *
- * If this abstract pathname does not denote a directory, then this
- * method returns null Otherwise an array of strings is
- * returned, one for each file or directory in the directory. Names
- * denoting the directory itself and the directory's parent directory are
- * not included in the result. Each string is a file name rather than a
- * complete path.
- *
- * There is no guarantee that the name strings in the resulting array
- * will appear in any specific order; they are not, in particular,
- * guaranteed to appear in alphabetical order.
- *
- * @return An array of strings naming the files and directories in the
- * directory denoted by this abstract pathname. The array will be
- * empty if the directory is empty. Returns null if
- * this abstract pathname does not denote a directory, or if an
- * I/O error occurs.
- *
- */
- function listDir($filter = null) {
- $fs = FileSystem::getFileSystem();
- return $fs->lister($this, $filter);
- }
-
- function listFiles($filter = null) {
- $ss = $this->listDir($filter);
- if ($ss === null) {
- return null;
- }
- $n = count($ss);
- $fs = array();
- for ($i = 0; $i < $n; $i++) {
- $fs[$i] = new PhingFile((string)$this->path, (string)$ss[$i]);
- }
- return $fs;
- }
-
- /**
- * Creates the directory named by this abstract pathname, including any
- * necessary but nonexistent parent directories. Note that if this
- * operation fails it may have succeeded in creating some of the necessary
- * parent directories.
- *
- * @return true if and only if the directory was created,
- * along with all necessary parent directories; false
- * otherwise
- * @throws IOException
- */
- function mkdirs() {
- if ($this->exists()) {
- return false;
- }
- try {
- if ($this->mkdir()) {
- return true;
- }
- } catch (IOException $ioe) {
- // IOException from mkdir() means that directory propbably didn't exist.
- }
- $parentFile = $this->getParentFile();
- return (($parentFile !== null) && ($parentFile->mkdirs() && $this->mkdir()));
- }
-
- /**
- * Creates the directory named by this abstract pathname.
- *
- * @return true if and only if the directory was created; false otherwise
- * @throws IOException
- */
- function mkdir() {
- $fs = FileSystem::getFileSystem();
-
- if ($fs->checkAccess(new PhingFile($this->path), true) !== true) {
- throw new IOException("No write access to " . $this->getPath());
- }
- return $fs->createDirectory($this);
- }
-
- /**
- * Renames the file denoted by this abstract pathname.
- *
- * @param destFile The new abstract pathname for the named file
- * @return true if and only if the renaming succeeded; false otherwise
- */
- function renameTo(PhingFile $destFile) {
- $fs = FileSystem::getFileSystem();
- if ($fs->checkAccess($this) !== true) {
- throw new IOException("No write access to ".$this->getPath());
- }
- return $fs->rename($this, $destFile);
- }
-
- /**
- * Simple-copies file denoted by this abstract pathname into another
- * PhingFile
- *
- * @param PhingFile $destFile The new abstract pathname for the named file
- * @return true if and only if the renaming succeeded; false otherwise
- */
- function copyTo(PhingFile $destFile) {
- $fs = FileSystem::getFileSystem();
-
- if ($fs->checkAccess($this) !== true) {
- throw new IOException("No read access to ".$this->getPath()."\n");
- }
-
- if ($fs->checkAccess($destFile, true) !== true) {
- throw new IOException("File::copyTo() No write access to ".$destFile->getPath());
- }
- return $fs->copy($this, $destFile);
- }
-
- /**
- * Sets the last-modified time of the file or directory named by this
- * abstract pathname.
- *
- * All platforms support file-modification times to the nearest second,
- * but some provide more precision. The argument will be truncated to fit
- * the supported precision. If the operation succeeds and no intervening
- * operations on the file take place, then the next invocation of the
- * lastModified method will return the (possibly truncated) time argument
- * that was passed to this method.
- *
- * @param time The new last-modified time, measured in milliseconds since
- * the epoch (00:00:00 GMT, January 1, 1970)
- * @return true if and only if the operation succeeded; false otherwise
- */
- function setLastModified($time) {
- $time = (int) $time;
- if ($time < 0) {
- throw new Exception("IllegalArgumentException, Negative $time\n");
- }
-
- // FIXME check if accessible
- $fs = FileSystem::getFileSystem();
- if ($fs->checkAccess($this, true) !== true) {
- throw new IOException("File::setLastModified(). No write access to file\n");
- }
- return $fs->setLastModifiedTime($this, $time);
- }
-
- /**
- * Marks the file or directory named by this abstract pathname so that
- * only read operations are allowed. After invoking this method the file
- * or directory is guaranteed not to change until it is either deleted or
- * marked to allow write access. Whether or not a read-only file or
- * directory may be deleted depends upon the underlying system.
- *
- * @return true if and only if the operation succeeded; false otherwise
- */
- function setReadOnly() {
- $fs = FileSystem::getFileSystem();
- if ($fs->checkAccess($this, true) !== true) {
- // Error, no write access
- throw new IOException("No write access to " . $this->getPath());
- }
- return $fs->setReadOnly($this);
- }
-
- /**
- * Sets the mode of the file
- * @param int $mode Ocatal mode.
- */
- function setMode($mode) {
- $fs = FileSystem::getFileSystem();
- return $fs->chmod($this->getPath(), $mode);
- }
-
- /**
- * Retrieve the mode of this file.
- * @return int
- */
- function getMode() {
- return @fileperms($this->getPath());
- }
-
- /* -- Filesystem interface -- */
-
- /**
- * List the available filesystem roots.
- *
- * A particular platform may support zero or more hierarchically-organized
- * file systems. Each file system has a root directory from which all
- * other files in that file system can be reached.
- * Windows platforms, for example, have a root directory for each active
- * drive; UNIX platforms have a single root directory, namely "/".
- * The set of available filesystem roots is affected by various system-level
- * operations such the insertion or ejection of removable media and the
- * disconnecting or unmounting of physical or virtual disk drives.
- *
- * This method returns an array of PhingFile objects that
- * denote the root directories of the available filesystem roots. It is
- * guaranteed that the canonical pathname of any file physically present on
- * the local machine will begin with one of the roots returned by this
- * method.
- *
- * The canonical pathname of a file that resides on some other machine
- * and is accessed via a remote-filesystem protocol such as SMB or NFS may
- * or may not begin with one of the roots returned by this method. If the
- * pathname of a remote file is syntactically indistinguishable from the
- * pathname of a local file then it will begin with one of the roots
- * returned by this method. Thus, for example, PhingFile objects
- * denoting the root directories of the mapped network drives of a Windows
- * platform will be returned by this method, while PhingFile
- * objects containing UNC pathnames will not be returned by this method.
- *
- * @return An array of PhingFile objects denoting the available
- * filesystem roots, or null if the set of roots
- * could not be determined. The array will be empty if there are
- * no filesystem roots.
- */
- function listRoots() {
- $fs = FileSystem::getFileSystem();
- return (array) $fs->listRoots();
- }
-
- /* -- Tempfile management -- */
-
- /**
- * Returns the path to the temp directory.
- */
- function getTempDir() {
- return Phing::getProperty('php.tmpdir');
- }
-
- /**
- * Static method that creates a unique filename whose name begins with
- * $prefix and ends with $suffix in the directory $directory. $directory
- * is a reference to a PhingFile Object.
- * Then, the file is locked for exclusive reading/writing.
- *
- * @author manuel holtgrewe, grin@gmx.net
- * @throws IOException
- * @access public
- */
- function createTempFile($prefix, $suffix, PhingFile $directory) {
-
- // quick but efficient hack to create a unique filename ;-)
- $result = null;
- do {
- $result = new PhingFile($directory, $prefix . substr(md5(time()), 0, 8) . $suffix);
- } while (file_exists($result->getPath()));
-
- $fs = FileSystem::getFileSystem();
- $fs->createNewFile($result->getPath());
- $fs->lock($result);
-
- return $result;
- }
-
- /**
- * If necessary, $File the lock on $File is removed and then the file is
- * deleted
- *
- * @access public
- */
- function removeTempFile() {
- $fs = FileSystem::getFileSystem();
- // catch IO Exception
- $fs->unlock($this);
- $this->delete();
- }
-
-
- /* -- Basic infrastructure -- */
-
- /**
- * Compares two abstract pathnames lexicographically. The ordering
- * defined by this method depends upon the underlying system. On UNIX
- * systems, alphabetic case is significant in comparing pathnames; on Win32
- * systems it is not.
- *
- * @param PhingFile $file Th file whose pathname sould be compared to the pathname of this file.
- *
- * @return int Zero if the argument is equal to this abstract pathname, a
- * value less than zero if this abstract pathname is
- * lexicographically less than the argument, or a value greater
- * than zero if this abstract pathname is lexicographically
- * greater than the argument
- */
- function compareTo(PhingFile $file) {
- $fs = FileSystem::getFileSystem();
- return $fs->compare($this, $file);
- }
-
- /**
- * Tests this abstract pathname for equality with the given object.
- * Returns true if and only if the argument is not
- * null and is an abstract pathname that denotes the same file
- * or directory as this abstract pathname. Whether or not two abstract
- * pathnames are equal depends upon the underlying system. On UNIX
- * systems, alphabetic case is significant in comparing pathnames; on Win32
- * systems it is not.
- * @return boolean
- */
- function equals($obj) {
- if (($obj !== null) && ($obj instanceof PhingFile)) {
- return ($this->compareTo($obj) === 0);
- }
- return false;
- }
-
- /** Backwards compatibility -- use PHP5's native __tostring method. */
- function toString() {
- return $this->getPath();
- }
-
- /** PHP5's native method. */
- function __toString() {
- return $this->getPath();
- }
-}
-?>
diff --git a/buildscripts/phing/classes/phing/system/io/Reader.php b/buildscripts/phing/classes/phing/system/io/Reader.php
deleted file mode 100644
index 1e377378..00000000
--- a/buildscripts/phing/classes/phing/system/io/Reader.php
+++ /dev/null
@@ -1,88 +0,0 @@
-.
-*/
-
-/**
- * Abstract class for reading character streams.
- * @author Hans Lellelid
- * @author Yannick Lecaillez
- * @version $Revision: 1.5 $
- * @package phing.system.io
- */
-abstract class Reader {
-
- /**
- * Read data from source.
- * If length is specified, then only that number of chars is read,
- * otherwise stream is read until EOF.
- * @param int $len
- */
- abstract public function read($len = null);
-
- /**
- * Close stream.
- */
- abstract public function close();
-
- /**
- * Open stream for reading.
- */
- abstract public function open();
-
- /**
- * Returns the filename, url, etc. that is being read from.
- * This is critical for, e.g., ExpatParser's ability to know
- * the filename that is throwing an ExpatParserException, etc.
- * @return string
- */
- abstract function getResource();
-
- /**
- * Move stream position relative to current pos.
- * @param int $n
- */
- public function skip($n) {}
-
- /**
- * Reset the current position in stream to beginning or last mark (if supported).
- */
- public function reset() {}
-
- /**
- * If supported, places a "marker" (like a bookmark) at current stream position.
- * A subsequent call to reset() will move stream position back
- * to last marker (if supported).
- */
- public function mark() {}
-
- /**
- * Whether marking is supported.
- * @return boolean
- */
- public function markSupported() {}
-
- /**
- * Is stream ready for reading.
- * @return boolean
- */
- public function ready() {}
-
-}
-?>
diff --git a/buildscripts/phing/classes/phing/system/io/StringReader.php b/buildscripts/phing/classes/phing/system/io/StringReader.php
deleted file mode 100644
index 689a2115..00000000
--- a/buildscripts/phing/classes/phing/system/io/StringReader.php
+++ /dev/null
@@ -1,73 +0,0 @@
-.
- */
-
-/**
- * Dummy class for reading character streams.
- * @package phing.system.io
- */
-class StringReader extends Reader {
-
- private $_string;
- private $mark = 0;
- private $currPos = 0;
-
- function __construct($string) {
- $this->_string = $string;
- }
-
- function skip($n) {}
-
- function read($len = null) {
- if ($len === null) {
- return $this->_string;
- } else {
- if ($this->currPos >= strlen($this->_string)) {
- return -1;
- }
- $out = substr($this->_string, $this->currPos, $len);
- $this->currPos += $len;
- return $out;
- }
- }
-
- function mark() {
- $this->mark = $this->currPos;
- }
-
- function reset() {
- $this->currPos = $this->mark;
- }
-
- function close() {}
-
- function open() {}
-
- function ready() {}
-
- function markSupported() {
- return true;
- }
-
- function getResource() {
- return '(string) "'.$this->_string . '"';
- }
-}
-?>
diff --git a/buildscripts/phing/classes/phing/system/io/TokenReader.php b/buildscripts/phing/classes/phing/system/io/TokenReader.php
deleted file mode 100644
index a57d994c..00000000
--- a/buildscripts/phing/classes/phing/system/io/TokenReader.php
+++ /dev/null
@@ -1,51 +0,0 @@
-.
-*/
-
-include_once 'phing/system/io/Reader.php';
-include_once 'phing/filters/ReplaceTokens.php'; // for class Token
-
-/**
- * Abstract class for reading Tokens from a resource
- *
- * @author Manuel Holtgewe
- * @version $Revision: 1.3 $
- * @access public
- * @package phing.system.io
- */
-class TokenReader extends Reader {
-
- /**
- * Constructor
- */
- function __construct() {
- }
-
- /**
- * Reads a token from the resource and returns it as a
- * Token object.
- *
- * @access public
- */
- function readToken() {
- }
-}
-
-?>
diff --git a/buildscripts/phing/classes/phing/system/io/UnixFileSystem.php b/buildscripts/phing/classes/phing/system/io/UnixFileSystem.php
deleted file mode 100644
index fb4e49b4..00000000
--- a/buildscripts/phing/classes/phing/system/io/UnixFileSystem.php
+++ /dev/null
@@ -1,266 +0,0 @@
-.
- */
-
-include_once 'phing/system/io/FileSystem.php';
-
-/**
- * UnixFileSystem class. This class encapsulates the basic file system functions
- * for platforms using the unix (posix)-stylish filesystem. It wraps php native
- * functions suppressing normal PHP error reporting and instead uses Exception
- * to report and error.
- *
- * This class is part of a oop based filesystem abstraction and targeted to run
- * on all supported php platforms.
- *
- * Note: For debugging turn track_errors on in the php.ini. The error messages
- * and log messages from this class will then be clearer because $php_errormsg
- * is passed as part of the message.
- *
- * FIXME:
- * - Comments
- * - Error handling reduced to min, error are handled by PhingFile mainly
- *
- * @author Andreas Aderhold, andi@binarycloud.com
- * @version $Revision: 1.10 $
- * @package phing.system.io
- */
-class UnixFileSystem extends FileSystem {
-
- /**
- * returns OS dependant path separator char
- */
- function getSeparator() {
- return '/';
- }
-
- /**
- * returns OS dependant directory separator char
- */
- function getPathSeparator() {
- return ':';
- }
-
- /**
- * A normal Unix pathname contains no duplicate slashes and does not end
- * with a slash. It may be the empty string.
- *
- * Check that the given pathname is normal. If not, invoke the real
- * normalizer on the part of the pathname that requires normalization.
- * This way we iterate through the whole pathname string only once.
- */
- function normalize($strPathname) {
-
- if (empty($strPathname)) {
- return;
- }
-
- // Resolve home directories. We assume /home is where all home
- // directories reside, b/c there is no other way to do this with
- // PHP AFAIK.
- if ($strPathname{0} === "~") {
- if ($strPathname{1} === "/") { // like ~/foo => /home/user/foo
- $strPathname = "/home/" . get_current_user() . substr($strPathname, 1);
- } else { // like ~foo => /home/foo
- $pos = strpos($strPathname, "/");
- $name = substr($strPathname, 1, $pos - 2);
- $strPathname = "/home/" . $name . substr($strPathname, $pos);
- }
- }
-
- $n = strlen($strPathname);
- $prevChar = 0;
- for ($i=0; $i < $n; $i++) {
- $c = $strPathname{$i};
- if (($prevChar === '/') && ($c === '/')) {
- return self::normalizer($strPathname, $n, $i - 1);
- }
- $prevChar = $c;
- }
- if ($prevChar === '/') {
- return self::normalizer($strPathname, $n, $n - 1);
- }
- return $strPathname;
- }
-
- /**
- * Normalize the given pathname, whose length is $len, starting at the given
- * $offset; everything before this offset is already normal.
- */
- protected function normalizer($pathname, $len, $offset) {
- if ($len === 0) {
- return $pathname;
- }
- $n = (int) $len;
- while (($n > 0) && ($pathname{$n-1} === '/')) {
- $n--;
- }
- if ($n === 0) {
- return '/';
- }
- $sb = "";
-
- if ($offset > 0) {
- $sb .= substr($pathname, 0, $offset);
- }
- $prevChar = 0;
- for ($i = $offset; $i < $n; $i++) {
- $c = $pathname{$i};
- if (($prevChar === '/') && ($c === '/')) {
- continue;
- }
- $sb .= $c;
- $prevChar = $c;
- }
- return $sb;
- }
-
- /**
- * Compute the length of the pathname string's prefix. The pathname
- * string must be in normal form.
- */
- function prefixLength($pathname) {
- if (strlen($pathname === 0)) {
- return 0;
- }
- return (($pathname{0} === '/') ? 1 : 0);
- }
-
- /**
- * Resolve the child pathname string against the parent.
- * Both strings must be in normal form, and the result
- * will be in normal form.
- */
- function resolve($parent, $child) {
-
- if ($child === "") {
- return $parent;
- }
-
- if ($child{0} === '/') {
- if ($parent === '/') {
- return $child;
- }
- return $parent.$child;
- }
-
- if ($parent === '/') {
- return $parent.$child;
- }
-
- return $parent.'/'.$child;
- }
-
- function getDefaultParent() {
- return '/';
- }
-
- function isAbsolute(PhingFile $f) {
- return ($f->getPrefixLength() !== 0);
- }
-
- /**
- * the file resolver
- */
- function resolveFile(PhingFile $f) {
- // resolve if parent is a file oject only
- if ($this->isAbsolute($f)) {
- return $f->getPath();
- } else {
- return $this->resolve(Phing::getProperty("user.dir"), $f->getPath());
- }
- }
-
- /* -- most of the following is mapped to the php natives wrapped by FileSystem */
-
- /* -- Attribute accessors -- */
- function getBooleanAttributes(&$f) {
- //$rv = getBooleanAttributes0($f);
- $name = $f->getName();
- $hidden = (strlen($name) > 0) && ($name{0} == '.');
- return ($hidden ? $this->BA_HIDDEN : 0);
- }
-
- /**
- * set file readonly on unix
- */
- function setReadOnly($f) {
- if ($f instanceof File) {
- $strPath = (string) $f->getPath();
- $perms = (int) (@fileperms($strPath) & 0444);
- return FileSystem::Chmod($strPath, $perms);
- } else {
- throw new Exception("IllegalArgutmentType: Argument is not File");
- }
- }
-
- /**
- * compares file paths lexicographically
- */
- function compare($f1, $f2) {
- if ( ($f1 instanceof PhingFile) && ($f2 instanceof PhingFile) ) {
- $f1Path = $f1->getPath();
- $f2Path = $f2->getPath();
- return (boolean) strcmp((string) $f1Path, (string) $f2Path);
- } else {
- throw new Exception("IllegalArgutmentType: Argument is not PhingFile");
- }
- }
-
- /* -- fs interface --*/
-
- function listRoots() {
- if (!$this->checkAccess('/', false)) {
- die ("Can not access root");
- }
- return array(new PhingFile("/"));
- }
-
- /**
- * returns the contents of a directory in an array
- */
- function lister($f) {
- $dir = @opendir($f->getAbsolutePath());
- if (!$dir) {
- throw new Exception("Can't open directory " . $f->__toString());
- }
- $vv = array();
- while (($file = @readdir($dir)) !== false) {
- if ($file == "." || $file == "..") {
- continue;
- }
- $vv[] = (string) $file;
- }
- @closedir($dir);
- return $vv;
- }
-
- function fromURIPath($p) {
- if (StringHelper::endsWith("/", $p) && (strlen($p) > 1)) {
-
- // "/foo/" --> "/foo", but "/" --> "/"
- $p = substr($p, 0, strlen($p) - 1);
-
- }
-
- return $p;
- }
-
-}
diff --git a/buildscripts/phing/classes/phing/system/io/Win32FileSystem.php b/buildscripts/phing/classes/phing/system/io/Win32FileSystem.php
deleted file mode 100644
index c32c21ff..00000000
--- a/buildscripts/phing/classes/phing/system/io/Win32FileSystem.php
+++ /dev/null
@@ -1,477 +0,0 @@
-.
- */
-
-include_once 'phing/system/io/FileSystem.php';
-
-/**
- * @package phing.system.io
- */
-class Win32FileSystem extends FileSystem {
-
- protected $slash;
- protected $altSlash;
- protected $semicolon;
-
- private static $driveDirCache = array();
-
- function __construct() {
- $this->slash = self::getSeparator();
- $this->semicolon = self::getPathSeparator();
- $this->altSlash = ($this->slash === '\\') ? '/' : '\\';
- }
-
- function isSlash($c) {
- return ($c == '\\') || ($c == '/');
- }
-
- function isLetter($c) {
- return ((ord($c) >= ord('a')) && (ord($c) <= ord('z')))
- || ((ord($c) >= ord('A')) && (ord($c) <= ord('Z')));
- }
-
- function slashify($p) {
- if ((strlen($p) > 0) && ($p{0} != $this->slash)) {
- return $this->slash.$p;
- }
- else {
- return $p;
- }
- }
-
- /* -- Normalization and construction -- */
-
- function getSeparator() {
- // the ascii value of is the \
- return chr(92);
- }
-
- function getPathSeparator() {
- return ';';
- }
-
- /**
- * A normal Win32 pathname contains no duplicate slashes, except possibly
- * for a UNC prefix, and does not end with a slash. It may be the empty
- * string. Normalized Win32 pathnames have the convenient property that
- * the length of the prefix almost uniquely identifies the type of the path
- * and whether it is absolute or relative:
- *
- * 0 relative to both drive and directory
- * 1 drive-relative (begins with '\\')
- * 2 absolute UNC (if first char is '\\'), else directory-relative (has form "z:foo")
- * 3 absolute local pathname (begins with "z:\\")
- */
- function normalizePrefix($strPath, $len, $sb) {
- $src = 0;
- while (($src < $len) && $this->isSlash($strPath{$src})) {
- $src++;
- }
- $c = "";
- if (($len - $src >= 2)
- && $this->isLetter($c = $strPath{$src})
- && $strPath{$src + 1} === ':') {
- /* Remove leading slashes if followed by drive specifier.
- * This hack is necessary to support file URLs containing drive
- * specifiers (e.g., "file://c:/path"). As a side effect,
- * "/c:/path" can be used as an alternative to "c:/path". */
- $sb .= $c;
- $sb .= ':';
- $src += 2;
- }
- else {
- $src = 0;
- if (($len >= 2)
- && $this->isSlash($strPath{0})
- && $this->isSlash($strPath{1})) {
- /* UNC pathname: Retain first slash; leave src pointed at
- * second slash so that further slashes will be collapsed
- * into the second slash. The result will be a pathname
- * beginning with "\\\\" followed (most likely) by a host
- * name. */
- $src = 1;
- $sb.=$this->slash;
- }
- }
- return $src;
- }
-
- /** Normalize the given pathname, whose length is len, starting at the given
- offset; everything before this offset is already normal. */
- protected function normalizer($strPath, $len, $offset) {
- if ($len == 0) {
- return $strPath;
- }
- if ($offset < 3) {
- $offset = 0; //Avoid fencepost cases with UNC pathnames
- }
- $src = 0;
- $slash = $this->slash;
- $sb = "";
-
- if ($offset == 0) {
- // Complete normalization, including prefix
- $src = $this->normalizePrefix($strPath, $len, $sb);
- } else {
- // Partial normalization
- $src = $offset;
- $sb .= substr($strPath, 0, $offset);
- }
-
- // Remove redundant slashes from the remainder of the path, forcing all
- // slashes into the preferred slash
- while ($src < $len) {
- $c = $strPath{$src++};
- if ($this->isSlash($c)) {
- while (($src < $len) && $this->isSlash($strPath{$src})) {
- $src++;
- }
- if ($src === $len) {
- /* Check for trailing separator */
- $sn = (int) strlen($sb);
- if (($sn == 2) && ($sb{1} === ':')) {
- // "z:\\"
- $sb .= $slash;
- break;
- }
- if ($sn === 0) {
- // "\\"
- $sb .= $slash;
- break;
- }
- if (($sn === 1) && ($this->isSlash($sb{0}))) {
- /* "\\\\" is not collapsed to "\\" because "\\\\" marks
- the beginning of a UNC pathname. Even though it is
- not, by itself, a valid UNC pathname, we leave it as
- is in order to be consistent with the win32 APIs,
- which treat this case as an invalid UNC pathname
- rather than as an alias for the root directory of
- the current drive. */
- $sb .= $slash;
- break;
- }
- // Path does not denote a root directory, so do not append
- // trailing slash
- break;
- } else {
- $sb .= $slash;
- }
- } else {
- $sb.=$c;
- }
- }
- $rv = (string) $sb;
- return $rv;
- }
-
- /**
- * Check that the given pathname is normal. If not, invoke the real
- * normalizer on the part of the pathname that requires normalization.
- * This way we iterate through the whole pathname string only once.
- * @param string $strPath
- * @return string
- */
- function normalize($strPath) {
- $n = strlen($strPath);
- $slash = $this->slash;
- $altSlash = $this->altSlash;
- $prev = 0;
- for ($i = 0; $i < $n; $i++) {
- $c = $strPath{$i};
- if ($c === $altSlash) {
- return $this->normalizer($strPath, $n, ($prev === $slash) ? $i - 1 : $i);
- }
- if (($c === $slash) && ($prev === $slash) && ($i > 1)) {
- return $this->normalizer($strPath, $n, $i - 1);
- }
- if (($c === ':') && ($i > 1)) {
- return $this->normalizer($strPath, $n, 0);
- }
- $prev = $c;
- }
- if ($prev === $slash) {
- return $this->normalizer($strPath, $n, $n - 1);
- }
- return $strPath;
- }
-
- function prefixLength($strPath) {
- $path = (string) $strPath;
- $slash = (string) $this->slash;
- $n = (int) strlen($path);
- if ($n === 0) {
- return 0;
- }
- $c0 = $path{0};
- $c1 = ($n > 1) ? $path{1} :
- 0;
- if ($c0 === $slash) {
- if ($c1 === $slash) {
- return 2; // absolute UNC pathname "\\\\foo"
- }
- return 1; // drive-relative "\\foo"
- }
-
- if ($this->isLetter($c0) && ($c1 === ':')) {
- if (($n > 2) && ($path{2}) === $slash) {
- return 3; // Absolute local pathname "z:\\foo" */
- }
- return 2; // Directory-relative "z:foo"
- }
- return 0; // Completely relative
- }
-
- function resolve($parent, $child) {
- $parent = (string) $parent;
- $child = (string) $child;
- $slash = (string) $this->slash;
-
- $pn = (int) strlen($parent);
- if ($pn === 0) {
- return $child;
- }
- $cn = (int) strlen($child);
- if ($cn === 0) {
- return $parent;
- }
-
- $c = $child;
- if (($cn > 1) && ($c{0} === $slash)) {
- if ($c{1} === $slash) {
- // drop prefix when child is a UNC pathname
- $c = substr($c, 2);
- }
- else {
- //Drop prefix when child is drive-relative */
- $c = substr($c, 1);
- }
- }
-
- $p = $parent;
- if ($p{$pn - 1} === $slash) {
- $p = substr($p, 0, $pn - 1);
- }
- return $p.$this->slashify($c);
- }
-
- function getDefaultParent() {
- return (string) ("".$this->slash);
- }
-
- function fromURIPath($strPath) {
- $p = (string) $strPath;
- if ((strlen($p) > 2) && ($p{2} === ':')) {
-
- // "/c:/foo" --> "c:/foo"
- $p = substr($p,1);
-
- // "c:/foo/" --> "c:/foo", but "c:/" --> "c:/"
- if ((strlen($p) > 3) && StringHelper::endsWith('/', $p)) {
- $p = substr($p, 0, strlen($p) - 1);
- }
- } elseif ((strlen($p) > 1) && StringHelper::endsWith('/', $p)) {
- // "/foo/" --> "/foo"
- $p = substr($p, 0, strlen($p) - 1);
- }
- return (string) $p;
- }
-
-
- /* -- Path operations -- */
-
- function isAbsolute(PhingFile $f) {
- $pl = (int) $f->getPrefixLength();
- $p = (string) $f->getPath();
- return ((($pl === 2) && ($p{0} === $this->slash)) || ($pl === 3) || ($pl === 1 && $p{0} === $this->slash));
- }
-
- /** private */
- function _driveIndex($d) {
- $d = (string) $d{0};
- if ((ord($d) >= ord('a')) && (ord($d) <= ord('z'))) {
- return ord($d) - ord('a');
- }
- if ((ord($d) >= ord('A')) && (ord($d) <= ord('Z'))) {
- return ord($d) - ord('A');
- }
- return -1;
- }
-
- /** private */
- function _getDriveDirectory($drive) {
- $drive = (string) $drive{0};
- $i = (int) $this->_driveIndex($drive);
- if ($i < 0) {
- return null;
- }
-
- $s = (isset(self::$driveDirCache[$i]) ? self::$driveDirCache[$i] : null);
-
- if ($s !== null) {
- return $s;
- }
-
- $s = $this->_getDriveDirectory($i + 1);
- self::$driveDirCache[$i] = $s;
- return $s;
- }
-
- function _getUserPath() {
- //For both compatibility and security, we must look this up every time
- return (string) $this->normalize(Phing::getProperty("user.dir"));
- }
-
- function _getDrive($path) {
- $path = (string) $path;
- $pl = $this->prefixLength($path);
- return ($pl === 3) ? substr($path, 0, 2) : null;
- }
-
- function resolveFile(PhingFile $f) {
- $path = $f->getPath();
- $pl = (int) $f->getPrefixLength();
-
- if (($pl === 2) && ($path{0} === $this->slash)) {
- return path; // UNC
- }
-
- if ($pl === 3) {
- return $path; // Absolute local
- }
-
- if ($pl === 0) {
- return (string) ($this->_getUserPath().$this->slashify($path)); //Completely relative
- }
-
- if ($pl === 1) { // Drive-relative
- $up = (string) $this->_getUserPath();
- $ud = (string) $this->_getDrive($up);
- if ($ud !== null) {
- return (string) $ud.$path;
- }
- return (string) $up.$path; //User dir is a UNC path
- }
-
- if ($pl === 2) { // Directory-relative
- $up = (string) $this->_getUserPath();
- $ud = (string) $this->_getDrive($up);
- if (($ud !== null) && StringHelper::startsWith($ud, $path)) {
- return (string) ($up . $this->slashify(substr($path,2)));
- }
- $drive = (string) $path{0};
- $dir = (string) $this->_getDriveDirectory($drive);
-
- $np = (string) "";
- if ($dir !== null) {
- /* When resolving a directory-relative path that refers to a
- drive other than the current drive, insist that the caller
- have read permission on the result */
- $p = (string) $drive . (':'.$dir.$this->slashify(substr($path,2)));
-
- if (!$this->checkAccess($p, false)) {
- // FIXME
- // throw security error
- die("Can't resolve path $p");
- }
- return $p;
- }
- return (string) $drive.':'.$this->slashify(substr($path,2)); //fake it
- }
-
- throw new Exception("Unresolvable path: " . $path);
- }
-
- /* -- most of the following is mapped to the functions mapped th php natives in FileSystem */
-
- /* -- Attribute accessors -- */
-
- function setReadOnly($f) {
- // dunno how to do this on win
- throw new Exception("WIN32FileSystem doesn't support read-only yet.");
- }
-
- /* -- Filesystem interface -- */
-
- protected function _access($path) {
- if (!$this->checkAccess($path, false)) {
- throw new Exception("Can't resolve path $p");
- }
- return true;
- }
-
- function _nativeListRoots() {
- // FIXME
- }
-
- function listRoots() {
- $ds = _nativeListRoots();
- $n = 0;
- for ($i = 0; $i < 26; $i++) {
- if ((($ds >> $i) & 1) !== 0) {
- if (!$this->access((string)( chr(ord('A') + $i) . ':' . $this->slash))) {
- $ds &= ~(1 << $i);
- } else {
- $n++;
- }
- }
- }
- $fs = array();
- $j = (int) 0;
- $slash = (string) $this->slash;
- for ($i = 0; $i < 26; $i++) {
- if ((($ds >> $i) & 1) !== 0) {
- $fs[$j++] = new PhingFile(chr(ord('A') + $i) . ':' . $this->slash);
- }
- }
- return $fs;
- }
-
- /* -- Basic infrastructure -- */
-
- /** compares file paths lexicographically */
- function compare(PhingFile $f1, PhingFile $f2) {
- $f1Path = $f1->getPath();
- $f2Path = $f2->getPath();
- return (boolean) strcasecmp((string) $f1Path, (string) $f2Path);
- }
-
-
- /**
- * returns the contents of a directory in an array
- */
- function lister($f) {
- $dir = @opendir($f->getAbsolutePath());
- if (!$dir) {
- throw new Exception("Can't open directory " . $f->__toString());
- }
- $vv = array();
- while (($file = @readdir($dir)) !== false) {
- if ($file == "." || $file == "..") {
- continue;
- }
- $vv[] = (string) $file;
- }
- @closedir($dir);
- return $vv;
- }
-
-}
-
-?>
diff --git a/buildscripts/phing/classes/phing/system/io/WinNTFileSystem.php b/buildscripts/phing/classes/phing/system/io/WinNTFileSystem.php
deleted file mode 100644
index 86f76d80..00000000
--- a/buildscripts/phing/classes/phing/system/io/WinNTFileSystem.php
+++ /dev/null
@@ -1,35 +0,0 @@
-.
- */
-
-include_once 'phing/system/io/Win32FileSystem.php';
-
-/**
- * FileSystem for Windows NT/2000.
- * @package phing.system.io
- */
-
-class WinNTFileSystem extends Win32FileSystem {
-
- /* -- class only for convenience and future use everything is inherinted --*/
-
-
-}
-?>
diff --git a/buildscripts/phing/classes/phing/system/io/Writer.php b/buildscripts/phing/classes/phing/system/io/Writer.php
deleted file mode 100644
index 5e1a69b9..00000000
--- a/buildscripts/phing/classes/phing/system/io/Writer.php
+++ /dev/null
@@ -1,48 +0,0 @@
-.
- */
-
-/**
- * Abstract class for writing character streams.
- * @package phing.system.io
- */
-abstract class Writer {
-
- abstract public function write($buf, $off = null, $len = null);
-
- abstract public function reset();
-
- abstract public function close();
-
- abstract public function open();
-
- public function mark() {}
-
- public function ready() {}
-
- public function markSupported() {}
-
- /**
- * Returns the filename, url, etc. that is being written to.
- * @return string
- */
- abstract function getResource();
-}
-?>
diff --git a/buildscripts/phing/classes/phing/system/lang/Character.php b/buildscripts/phing/classes/phing/system/lang/Character.php
deleted file mode 100644
index bb7a5589..00000000
--- a/buildscripts/phing/classes/phing/system/lang/Character.php
+++ /dev/null
@@ -1,49 +0,0 @@
-.
- */
-
-/**
- * @package phing.system.lang
- */
-class Character {
-
- // this class might be extended with plenty of ordinal char constants
- // and the like to support the multibyte aware datatype (char) in php
- // in form of an object.
- // anyway just a thought
-
- function isLetter($char) {
-
- if (strlen($char) !== 1)
- $char = 0;
-
- $char = (int) ord($char);
-
- if ($char >= ord('A') && $char <= ord('Z'))
- return true;
-
- if ($char >= ord('a') && $char <= ord('z'))
- return true;
-
- return false;
- }
-
-}
-?>
diff --git a/buildscripts/phing/classes/phing/system/lang/EventObject.php b/buildscripts/phing/classes/phing/system/lang/EventObject.php
deleted file mode 100644
index 4a2211bc..00000000
--- a/buildscripts/phing/classes/phing/system/lang/EventObject.php
+++ /dev/null
@@ -1,52 +0,0 @@
-.
- */
-
-/**
- * @package phing.system.lang
- */
-class EventObject {
-
- /** The object on which the Event initially occurred. */
- protected $source;
-
- /** Constructs a prototypical Event. */
- function __construct($source) {
- if ($source === null) {
- throw new Exception("Null source");
- }
- $this->source = $source;
- }
-
- /** The object on which the Event initially occurred. */
- function getSource() {
- return $this->source;
- }
-
- /** Returns a String representation of this EventObject.*/
- function toString() {
- if (method_exists($this->source, "toString")) {
- return get_class($this)."[source=".$this->source->toString()."]";
- } else {
- return get_class($this)."[source=".get_class($this->source)."]";
- }
- }
-}
-?>
diff --git a/buildscripts/phing/classes/phing/system/lang/FileNotFoundException.php b/buildscripts/phing/classes/phing/system/lang/FileNotFoundException.php
deleted file mode 100644
index ff48c785..00000000
--- a/buildscripts/phing/classes/phing/system/lang/FileNotFoundException.php
+++ /dev/null
@@ -1,27 +0,0 @@
-.
- */
-
-/**
- * @package phing.system.lang
- */
-class FileNotFoundException extends Exception {}
-
-?>
\ No newline at end of file
diff --git a/buildscripts/phing/classes/phing/system/lang/NullPointerException.php b/buildscripts/phing/classes/phing/system/lang/NullPointerException.php
deleted file mode 100644
index 38fa5c10..00000000
--- a/buildscripts/phing/classes/phing/system/lang/NullPointerException.php
+++ /dev/null
@@ -1,27 +0,0 @@
-.
- */
-
-/**
- * @package phing.system.lang
- */
-class NullPointerException extends Exception {}
-
-?>
\ No newline at end of file
diff --git a/buildscripts/phing/classes/phing/system/lang/SecurityException.php b/buildscripts/phing/classes/phing/system/lang/SecurityException.php
deleted file mode 100644
index 21e8b1c3..00000000
--- a/buildscripts/phing/classes/phing/system/lang/SecurityException.php
+++ /dev/null
@@ -1,27 +0,0 @@
-.
- */
-
-/**
- * @package phing.system.lang
- */
-class SecurityException extends Exception {}
-
-?>
\ No newline at end of file
diff --git a/buildscripts/phing/classes/phing/system/util/Message.php b/buildscripts/phing/classes/phing/system/util/Message.php
deleted file mode 100644
index bf7bb56b..00000000
--- a/buildscripts/phing/classes/phing/system/util/Message.php
+++ /dev/null
@@ -1,9 +0,0 @@
-
diff --git a/buildscripts/phing/classes/phing/system/util/Properties.php b/buildscripts/phing/classes/phing/system/util/Properties.php
deleted file mode 100644
index deff2cdf..00000000
--- a/buildscripts/phing/classes/phing/system/util/Properties.php
+++ /dev/null
@@ -1,270 +0,0 @@
-.
- */
-
-include_once 'phing/system/io/PhingFile.php';
-include_once 'phing/system/io/FileWriter.php';
-
-/**
- * Convenience class for reading and writing property files.
- *
- * FIXME
- * - Add support for arrays (separated by ',')
- *
- * @package phing.system.util
- * @version $Revision: 1.13 $
- */
-class Properties {
-
- private $properties = array();
-
- /**
- * Load properties from a file.
- *
- * @param PhingFile $file
- * @return void
- * @throws IOException - if unable to read file.
- */
- function load(PhingFile $file) {
- if ($file->canRead()) {
- $this->parse($file->getPath(), false);
- } else {
- throw new IOException("Can not read file ".$file->getPath());
- }
-
- }
-
- /**
- * Replaces parse_ini_file() or better_parse_ini_file().
- * Saves a step since we don't have to parse and then check return value
- * before throwing an error or setting class properties.
- *
- * @param string $filePath
- * @param boolean $processSections Whether to honor [SectionName] sections in INI file.
- * @return array Properties loaded from file (no prop replacements done yet).
- */
- protected function parse($filePath) {
-
- // load() already made sure that file is readable
- // but we'll double check that when reading the file into
- // an array
-
- if (($lines = @file($filePath)) === false) {
- throw new IOException("Unable to parse contents of $filePath");
- }
-
- $this->properties = array();
- $sec_name = "";
-
- foreach($lines as $line) {
-
- $line = trim($line);
-
- if($line == "")
- continue;
-
- if ($line{0} == '#' or $line{0} == ';') {
- // it's a comment, so continue to next line
- continue;
- } else {
- $pos = strpos($line, '=');
- $property = trim(substr($line, 0, $pos));
- $value = trim(substr($line, $pos + 1));
- $this->properties[$property] = $this->inVal($value);
- }
-
- } // for each line
- }
-
- /**
- * Process values when being read in from properties file.
- * does things like convert "true" => true
- * @param string $val Trimmed value.
- * @return mixed The new property value (may be boolean, etc.)
- */
- protected function inVal($val) {
- if ($val === "true") {
- $val = true;
- } elseif ($val === "false") {
- $val = false;
- }
- return $val;
- }
-
- /**
- * Process values when being written out to properties file.
- * does things like convert true => "true"
- * @param mixed $val The property value (may be boolean, etc.)
- * @return string
- */
- protected function outVal($val) {
- if ($val === true) {
- $val = "true";
- } elseif ($val === false) {
- $val = "false";
- }
- return $val;
- }
-
- /**
- * Create string representation that can be written to file and would be loadable using load() method.
- *
- * Essentially this function creates a string representation of properties that is ready to
- * write back out to a properties file. This is used by store() method.
- *
- * @return string
- */
- public function toString() {
- $buf = "";
- foreach($this->properties as $key => $item) {
- $buf .= $key . "=" . $this->outVal($item) . Phing::getProperty('line.separator');
- }
- return $buf;
- }
-
- /**
- * Stores current properties to specified file.
- *
- * @param PhingFile $file File to create/overwrite with properties.
- * @param string $header Header text that will be placed (within comments) at the top of properties file.
- * @return void
- * @throws IOException - on error writing properties file.
- */
- function store(PhingFile $file, $header = null) {
- // stores the properties in this object in the file denoted
- // if file is not given and the properties were loaded from a
- // file prior, this method stores them in the file used by load()
- try {
- $fw = new FileWriter($file);
- $fw->open();
- if ($header !== null) {
- $fw->write( "# " . $header . Phing::getProperty("line.separator") );
- }
- $fw->write($this->toString());
- $fw->close();
- } catch (IOException $e) {
- throw new IOException("Error writing property file: " . $e->getMessage());
- }
- }
-
- /**
- * Returns copy of internal properties hash.
- * Mostly for performance reasons, property hashes are often
- * preferable to passing around objects.
- *
- * @return array
- */
- function getProperties() {
- return $this->properties;
- }
-
- /**
- * Get value for specified property.
- * This is the same as get() method.
- *
- * @param string $prop The property name (key).
- * @return mixed
- * @see get()
- */
- function getProperty($prop) {
- if (!isset($this->properties[$prop])) {
- return null;
- }
- return $this->properties[$prop];
- }
-
- /**
- * Get value for specified property.
- * This function exists to provide a hashtable-like interface for
- * properties.
- *
- * @param string $prop The property name (key).
- * @return mixed
- * @see getProperty()
- */
- function get($prop) {
- if (!isset($this->properties[$prop])) {
- return null;
- }
- return $this->properties[$prop];
- }
-
- /**
- * Set the value for a property.
- *
- * @param string $key
- * @param mixed $value
- * @return mixed Old property value or NULL if none was set.
- */
- function setProperty($key, $value) {
- $oldValue = @$this->properties[$key];
- $this->properties[$key] = $value;
- return $oldValue;
- }
-
- /**
- * Set the value for a property.
- * This function exists to provide hashtable-lie
- * interface for properties.
- *
- * @param string $key
- * @param mixed $value
- */
- function put($key, $value) {
- return $this->setProperty($key, $value);
- }
-
- /**
- * Same as keys() function, returns an array of property names.
- * @return array
- */
- function propertyNames() {
- return $this->keys();
- }
-
- /**
- * Whether loaded properties array contains specified property name.
- * @return boolean
- */
- function containsKey($key) {
- return isset($this->properties[$key]);
- }
-
- /**
- * Returns properties keys.
- * Use this for foreach() {} iterations, as this is
- * faster than looping through property values.
- * @return array
- */
- function keys() {
- return array_keys($this->properties);
- }
-
- /**
- * Whether properties list is empty.
- * @return boolean
- */
- function isEmpty() {
- return empty($this->properties);
- }
-
-}
-?>
diff --git a/buildscripts/phing/classes/phing/system/util/Register.php b/buildscripts/phing/classes/phing/system/util/Register.php
deleted file mode 100644
index 5ef2b2fd..00000000
--- a/buildscripts/phing/classes/phing/system/util/Register.php
+++ /dev/null
@@ -1,115 +0,0 @@
-
- *
- *
- *
- * The task/type must provide a supporting setter for the attribute:
- *
- *
- * function setListeningReplace(RegisterSlot $slot) {
- * $this->replace = $slot;
- * }
- *
- * // in main()
- * if ($this->replace instanceof RegisterSlot) {
- * $this->regexp->setReplace($this->replace->getValue());
- * } else {
- * $this->regexp->setReplace($this->replace);
- * }
- *
- *
- * @author Hans Lellelid
- * @version $Revision: 1.3 $
- * @package phing.system.util
- */
-class Register {
-
- /** Slots that have been registered */
- private static $slots = array();
-
- /**
- * Returns RegisterSlot for specified key.
- *
- * If not slot exists a new one is created for key.
- *
- * @param string $key
- * @return RegisterSlot
- */
- public static function getSlot($key) {
- if (!isset(self::$slots[$key])) {
- self::$slots[$key] = new RegisterSlot($key);
- }
- return self::$slots[$key];
- }
-}
-
-
-/**
- * Represents a slot in the register.
- */
-class RegisterSlot {
-
- /** The name of this slot. */
- private $key;
-
- /** The value for this slot. */
- private $value;
-
- /**
- * Constructs a new RegisterSlot, setting the key to passed param.
- * @param string $key
- */
- public function __construct($key) {
- $this->key = (string) $key;
- }
-
- /**
- * Sets the key / name for this slot.
- * @param string $k
- */
- public function setKey($k) {
- $this->key = (string) $k;
- }
-
- /**
- * Gets the key / name for this slot.
- * @return string
- */
- public function getKey() {
- return $this->key;
- }
-
- /**
- * Sets the value for this slot.
- * @param mixed
- */
- public function setValue($v) {
- $this->value = $v;
- }
-
- /**
- * Returns the value at this slot.
- * @return mixed
- */
- public function getValue() {
- return $this->value;
- }
-
-}
-?>
diff --git a/buildscripts/phing/classes/phing/system/util/Timer.php b/buildscripts/phing/classes/phing/system/util/Timer.php
deleted file mode 100644
index a2a665b0..00000000
--- a/buildscripts/phing/classes/phing/system/util/Timer.php
+++ /dev/null
@@ -1,96 +0,0 @@
-.
- */
-
-
-/**
- * This class can be used to obtain the execution time of all of the scripts
- * that are executed in the process of building a page.
- *
- * Example:
- * To be done before any scripts execute:
- *
- * $Timer = new Timer;
- * $Timer->Start_Timer();
- *
- * To be done after all scripts have executed:
- *
- * $timer->Stop_Timer();
- * $timer->Get_Elapsed_Time(int number_of_places);
- *
- * @author Charles Killian
- * @author Hans Lellelid
- * @package phing.system.util
- * @version $Revision: 1.5 $ $Date: 2003/12/24 13:02:09 $
- */
-class Timer {
-
- /** start time */
- protected $stime;
-
- /** end time */
- protected $etime;
-
- /**
- * This function sets the class variable $stime to the current time in
- * microseconds.
- * @return void
- */
- public function start() {
- $this->stime = $this->getMicrotime();
- }
-
- /**
- * This function sets the class variable $etime to the current time in
- * microseconds.
- * @return void
- */
- function stop() {
- $this->etime = $this->getMicrotime();
- }
-
- /**
- * This function returns the elapsed time in seconds.
- *
- * Call start_time() at the beginning of script execution and end_time() at
- * the end of script execution. Then, call elapsed_time() to obtain the
- * difference between start_time() and end_time().
- *
- * @param $places decimal place precision of elapsed time (default is 5)
- * @return string Properly formatted time.
- */
- function getElapsedTime($places=5) {
- $etime = $this->etime - $this->stime;
- $format = "%0.".$places."f";
- return (sprintf ($format, $etime));
- }
-
- /**
- * This function returns the current time in microseconds.
- *
- * @author Everett Michaud, Zend.com
- * @return current time in microseconds
- * @access private
- */
- function getMicrotime() {
- list($usec, $sec) = explode(" ", microtime());
- return ((float)$usec + (float)$sec);
- }
-}
diff --git a/buildscripts/phing/classes/phing/tasks/defaults.properties b/buildscripts/phing/classes/phing/tasks/defaults.properties
deleted file mode 100644
index d0e62eff..00000000
--- a/buildscripts/phing/classes/phing/tasks/defaults.properties
+++ /dev/null
@@ -1,69 +0,0 @@
-; -------------------------------------
-; These taskdefs are loaded at startup.
-; -------------------------------------
-
-; Internal system tasks
-;
-adhoc=phing.tasks.system.AdhocTask
-adhoc-task=phing.tasks.system.AdhocTaskdefTask
-adhoc-type=phing.tasks.system.AdhocTypedefTask
-append=phing.tasks.system.AppendTask
-available=phing.tasks.system.AvailableTask
-chmod=phing.tasks.system.ChmodTask
-condition=phing.tasks.system.ConditionTask
-copy=phing.tasks.system.CopyTask
-cvs=phing.tasks.system.CvsTask
-cvspass=phing.tasks.system.CvsPassTask
-delete=phing.tasks.system.DeleteTask
-echo=phing.tasks.system.EchoTask
-exec=phing.tasks.system.ExecTask
-fail=phing.tasks.system.ExitTask
-foreach=phing.tasks.system.ForeachTask
-includepath=phing.tasks.system.IncludePathTask
-input=phing.tasks.system.InputTask
-mkdir=phing.tasks.system.MkdirTask
-move=phing.tasks.system.MoveTask
-phing=phing.tasks.system.PhingTask
-phingcall=phing.tasks.system.PhingCallTask
-php=phing.tasks.system.PhpEvalTask
-property=phing.tasks.system.PropertyTask
-propertyprompt=phing.tasks.system.PropertyPromptTask
-reflexive=phing.tasks.system.ReflexiveTask
-resolvepath=phing.tasks.system.ResolvePathTask
-taskdef=phing.tasks.system.TaskdefTask
-touch=phing.tasks.system.TouchTask
-tstamp=phing.tasks.system.TstampTask
-typedef=phing.tasks.system.TypedefTask
-uptodate=phing.tasks.system.UpToDateTask
-xslt=phing.tasks.system.XsltTask
-if=phing.tasks.system.IfTask
-warn=phing.tasks.system.WarnTask
-
-; "Core" contributed tasks
-; -- i.e. no taskdef needed.
-
-sql=phing.tasks.ext.CreoleSQLExecTask
-package-as-path=phing.tasks.ext.PackageAsPathTask
-smarty=phing.tasks.ext.SmartyTask
-capsule=phing.tasks.ext.CapsuleTask
-tar=phing.tasks.ext.TarTask
-pearpkg=phing.tasks.ext.PearPackageTask
-mail=phing.tasks.ext.MailTask
-zip=phing.tasks.ext.ZipTask
-phplint=phing.tasks.ext.PhpLintTask
-
-; "ext" tasks
-phpdoc=phing.tasks.ext.phpdoc.PHPDocumentorTask
-svnlastrevision=phing.tasks.ext.svn.SvnLastRevisionTask
-svnexport=phing.tasks.ext.svn.SvnExportTask
-phpunit2=phing.tasks.ext.phpunit2.PHPUnit2Task
-phpunit2report=phing.tasks.ext.phpunit2.PHPUnit2ReportTask
-coverage-setup=phing.tasks.ext.coverage.CoverageSetupTask
-coverage-merger=phing.tasks.ext.coverage.CoverageMergerTask
-coverage-report=phing.tasks.ext.coverage.CoverageReportTask
-ioncubeencoder=phing.tasks.ext.ioncube.IoncubeEncoderTask
-ioncubelicense=phing.tasks.ext.ioncube.IoncubeLicenseTask
-simpletest=phing.tasks.ext.simpletest.SimpleTestTask
-phplint=phing.tasks.ext.PhpLintTask
-xmllint=phing.tasks.ext.XmlLintTask
-analyze=phing.tasks.ext.ZendCodeAnalyzerTask
\ No newline at end of file
diff --git a/buildscripts/phing/classes/phing/tasks/ext/CapsuleTask.php b/buildscripts/phing/classes/phing/tasks/ext/CapsuleTask.php
deleted file mode 100644
index aa43a0e4..00000000
--- a/buildscripts/phing/classes/phing/tasks/ext/CapsuleTask.php
+++ /dev/null
@@ -1,478 +0,0 @@
-.
- */
-
-include_once 'phing/Task.php';
-include_once 'phing/BuildException.php';
-include_once 'phing/lib/Capsule.php';
-include_once 'phing/util/StringHelper.php';
-
-/**
- * A phing task for generating output by using Capsule.
- *
- * This is based on the interface to TexenTask from Apache's Velocity engine.
- *
- * @author Hans Lellelid
- * @version $Revision: 1.17 $
- * @package phing.tasks.ext
- */
-class CapsuleTask extends Task {
-
- /**
- * Capsule "template" engine.
- * @var Capsule
- */
- protected $context;
-
- /**
- * Any vars assigned via the build file.
- * @var array AssignedVar[]
- */
- protected $assignedVars = array();
-
- /**
- * This is the control template that governs the output.
- * It may or may not invoke the services of worker
- * templates.
- * @var string
- */
- protected $controlTemplate;
-
- /**
- * This is where Velocity will look for templates
- * using the file template loader.
- * @var string
- */
- protected $templatePath;
-
- /**
- * This is where texen will place all the output
- * that is a product of the generation process.
- * @var string
- */
- protected $outputDirectory;
-
- /**
- * This is the file where the generated text
- * will be placed.
- * @var string
- */
- protected $outputFile;
-
- /**
- *
- * These are properties that are fed into the
- * initial context from a properties file. This
- * is simply a convenient way to set some values
- * that you wish to make available in the context.
- *
- *
- * These values are not critical, like the template path
- * or output path, but allow a convenient way to
- * set a value that may be specific to a particular
- * generation task.
- *
- *
- * For example, if you are generating scripts to allow
- * user to automatically create a database, then
- * you might want the $databaseName
- * to be placed
- * in the initial context so that it is available
- * in a script that might look something like the
- * following:
- *
- * The value of $databaseName isn't critical to
- * output, and you obviously don't want to change
- * the ant task to simply take a database name.
- * So initial context values can be set with
- * properties file.
- *
- * @var array
- */
- protected $contextProperties;
-
- // -----------------------------------------------------------------------
- // The following getters & setters are used by phing to set properties
- // specified in the XML for the capsule task.
- // -----------------------------------------------------------------------
-
- /**
- * [REQUIRED] Set the control template for the
- * generating process.
- * @param string $controlTemplate
- * @return void
- */
- public function setControlTemplate ($controlTemplate) {
- $this->controlTemplate = $controlTemplate;
- }
-
- /**
- * Get the control template for the
- * generating process.
- * @return string
- */
- public function getControlTemplate() {
- return $this->controlTemplate;
- }
-
- /**
- * [REQUIRED] Set the path where Velocity will look
- * for templates using the file template
- * loader.
- * @return void
- * @throws Exception
- */
- public function setTemplatePath($templatePath) {
- $resolvedPath = "";
- $tok = strtok($templatePath, ",");
- while ( $tok ) {
- // resolve relative path from basedir and leave
- // absolute path untouched.
- $fullPath = $this->project->resolveFile($tok);
- $cpath = $fullPath->getCanonicalPath();
- if ($cpath === false) {
- $this->log("Template directory does not exist: " . $fullPath->getAbsolutePath());
- } else {
- $resolvedPath .= $cpath;
- }
- $tok = strtok(",");
- if ( $tok ) {
- $resolvedPath .= ",";
- }
- }
- $this->templatePath = $resolvedPath;
- }
-
- /**
- * Get the path where Velocity will look
- * for templates using the file template
- * loader.
- * @return string
- */
- public function getTemplatePath() {
- return $this->templatePath;
- }
-
- /**
- * [REQUIRED] Set the output directory. It will be
- * created if it doesn't exist.
- * @param PhingFile $outputDirectory
- * @return void
- * @throws Exception
- */
- public function setOutputDirectory(PhingFile $outputDirectory) {
- try {
- if (!$outputDirectory->exists()) {
- $this->log("Output directory does not exist, creating: " . $outputDirectory->getPath(),PROJECT_MSG_VERBOSE);
- if (!$outputDirectory->mkdirs()) {
- throw new IOException("Unable to create Ouptut directory: " . $outputDirectory->getAbsolutePath());
- }
- }
- $this->outputDirectory = $outputDirectory->getCanonicalPath();
- } catch (IOException $ioe) {
- throw new BuildException($ioe);
- }
- }
-
- /**
- * Get the output directory.
- * @return string
- */
- public function getOutputDirectory() {
- return $this->outputDirectory;
- }
-
- /**
- * [REQUIRED] Set the output file for the
- * generation process.
- * @param string $outputFile (TODO: change this to File)
- * @return void
- */
- public function setOutputFile($outputFile) {
- $this->outputFile = $outputFile;
- }
-
- /**
- * Get the output file for the
- * generation process.
- * @return string
- */
- public function getOutputFile() {
- return $this->outputFile;
- }
-
- /**
- * Set the context properties that will be
- * fed into the initial context be the
- * generating process starts.
- * @param string $file
- * @return void
- */
- public function setContextProperties($file) {
- $sources = explode(",", $file);
- $this->contextProperties = new Properties();
-
- // Always try to get the context properties resource
- // from a file first. Templates may be taken from a JAR
- // file but the context properties resource may be a
- // resource in the filesystem. If this fails than attempt
- // to get the context properties resource from the
- // classpath.
- for ($i=0, $sourcesLength=count($sources); $i < $sourcesLength; $i++) {
- $source = new Properties();
-
- try {
-
- // resolve relative path from basedir and leave
- // absolute path untouched.
- $fullPath = $this->project->resolveFile($sources[$i]);
- $this->log("Using contextProperties file: " . $fullPath->toString());
- $source->load($fullPath);
-
- } catch (Exception $e) {
-
- throw new BuildException("Context properties file " . $sources[$i] .
- " could not be found in the file system!");
-
- }
-
- $keys = $source->keys();
-
- foreach ($keys as $key) {
- $name = $key;
- $value = $this->project->replaceProperties($source->getProperty($name));
- $this->contextProperties->setProperty($name, $value);
- }
- }
- }
-
- /**
- * Get the context properties that will be
- * fed into the initial context be the
- * generating process starts.
- * @return Properties
- */
- public function getContextProperties() {
- return $this->contextProperties;
- }
-
- /**
- * Creates an "AssignedVar" class.
- */
- public function createAssign() {
- $a = new AssignedVar();
- $this->assignedVars[] = $a;
- return $a;
- }
-
- // ---------------------------------------------------------------
- // End of XML setters & getters
- // ---------------------------------------------------------------
-
- /**
- * Creates a Smarty object.
- *
- * @return Smarty initialized (cleared) Smarty context.
- * @throws Exception the execute method will catch
- * and rethrow as a BuildException
- */
- public function initControlContext() {
- $this->context->clear();
- foreach($this->assignedVars as $var) {
- $this->context->put($var->getName(), $var->getValue());
- }
- return $this->context;
- }
-
- /**
- * Execute the input script with Velocity
- *
- * @throws BuildException
- * BuildExceptions are thrown when required attributes are missing.
- * Exceptions thrown by Velocity are rethrown as BuildExceptions.
- */
- public function main() {
-
- // Make sure the template path is set.
- if (empty($this->templatePath)) {
- throw new BuildException("The template path needs to be defined!");
- }
-
- // Make sure the control template is set.
- if ($this->controlTemplate === null) {
- throw new BuildException("The control template needs to be defined!");
- }
-
- // Make sure the output directory is set.
- if ($this->outputDirectory === null) {
- throw new BuildException("The output directory needs to be defined!");
- }
-
- // Make sure there is an output file.
- if ($this->outputFile === null) {
- throw new BuildException("The output file needs to be defined!");
- }
-
- // Setup Smarty runtime.
-
- // Smarty uses one object to store properties and to store
- // the context for the template (unlike Velocity). We setup this object, calling it
- // $this->context, and then initControlContext simply zeros out
- // any assigned variables.
- $this->context = new Capsule();
-
- if ($this->templatePath !== null) {
- $this->log("Using templatePath: " . $this->templatePath);
- $this->context->setTemplatePath($this->templatePath);
- }
-
- // Make sure the output directory exists, if it doesn't
- // then create it.
- $outputDir = new PhingFile($this->outputDirectory);
- if (!$outputDir->exists()) {
- $this->log("Output directory does not exist, creating: " . $outputDir->getAbsolutePath());
- $outputDir->mkdirs();
- }
-
- $this->context->setOutputDirectory($outputDir->getAbsolutePath());
-
- $path = $this->outputDirectory . DIRECTORY_SEPARATOR . $this->outputFile;
- $this->log("Generating to file " . $path);
-
- //$writer = new FileWriter($path);
-
- // The generator and the output path should
- // be placed in the init context here and
- // not in the generator class itself.
- $c = $this->initControlContext();
-
- // Set any variables that need to always
- // be loaded
- $this->populateInitialContext($c);
-
- // Feed all the options into the initial
- // control context so they are available
- // in the control/worker templates.
- if ($this->contextProperties !== null) {
-
- foreach($this->contextProperties->keys() as $property) {
-
- $value = $this->contextProperties->getProperty($property);
-
- // Special exception (from Texen)
- // for properties ending in file.contents:
- // in that case we dump the contents of the file
- // as the "value" for the Property.
- if (preg_match('/file\.contents$/', $property)) {
- // pull in contents of file specified
-
- $property = substr($property, 0, strpos($property, "file.contents") - 1);
-
- // reset value, and then
- // read in teh contents of the file into that var
- $value = "";
- $f = new PhingFile($project->resolveFile($value)->getCanonicalPath());
- if ($f->exists()) {
- $fr = new FileReader($f);
- $fr->readInto($value);
- }
-
- } // if ends with file.contents
-
- if (StringHelper::isBoolean($value)) {
- $value = StringHelper::booleanValue($value);
- }
-
- $c->put($property, $value);
-
- } // foreach property
-
- } // if contextProperties !== null
-
- try {
- $this->log("Parsing control template: " . $this->controlTemplate);
- $c->parse($this->controlTemplate, $path);
- } catch (Exception $ioe) {
- throw new BuildException("Cannot write parsed template: ". $ioe->getMessage());
- }
-
- $this->cleanup();
- }
-
- /**
- * Place useful objects into the initial context.
- *
- *
- * @param Capsule $context The context to populate, as retrieved from
- * {@link #initControlContext()}.
- * @return void
- * @throws Exception Error while populating context. The {@link
- * #main()} method will catch and rethrow as a
- * BuildException.
- */
- protected function populateInitialContext(Capsule $context) {
- $this->context->put("now", strftime("%c", time()));
- $this->context->put("task", $this);
- }
-
- /**
- * A hook method called at the end of {@link #execute()} which can
- * be overridden to perform any necessary cleanup activities (such
- * as the release of database connections, etc.). By default,
- * does nothing.
- * @return void
- * @throws Exception Problem cleaning up.
- */
- protected function cleanup() {
- }
-}
-
-
-/**
- * An "inner" class for holding assigned var values.
- * May be need to expand beyond name/value in the future.
- */
-class AssignedVar {
-
- private $name;
- private $value;
-
- function setName($v) {
- $this->name = $v;
- }
-
- function setValue($v) {
- $this->value = $v;
- }
-
- function getName() {
- return $this->name;
- }
-
- function getValue() {
- return $this->value;
- }
-
-}
\ No newline at end of file
diff --git a/buildscripts/phing/classes/phing/tasks/ext/CreoleSQLExecTask.php b/buildscripts/phing/classes/phing/tasks/ext/CreoleSQLExecTask.php
deleted file mode 100644
index d35e44f4..00000000
--- a/buildscripts/phing/classes/phing/tasks/ext/CreoleSQLExecTask.php
+++ /dev/null
@@ -1,556 +0,0 @@
-.
- */
-
-require_once 'phing/tasks/ext/CreoleTask.php';
-include_once 'phing/system/io/StringReader.php';
-
-/**
- * Executes a series of SQL statements on a database using Creole.
- *
- *
Statements can
- * either be read in from a text file using the src attribute or from
- * between the enclosing SQL tags.
- *
- *
Multiple statements can be provided, separated by semicolons (or the
- * defined delimiter). Individual lines within the statements can be
- * commented using either --, // or REM at the start of the line.
- *
- *
The autocommit attribute specifies whether auto-commit should be
- * turned on or off whilst executing the statements. If auto-commit is turned
- * on each statement will be executed and committed. If it is turned off the
- * statements will all be executed as one transaction.
- *
- *
The onerror attribute specifies how to proceed when an error occurs
- * during the execution of one of the statements.
- * The possible values are: continue execution, only show the error;
- * stop execution and commit transaction;
- * and abort execution and transaction and fail task.
- *
- * @author Hans Lellelid (Phing)
- * @author Jeff Martin (Ant)
- * @author Michael McCallum (Ant)
- * @author Tim Stephenson (Ant)
- * @package phing.tasks.ext
- * @version $Revision: 1.21 $
- */
-class CreoleSQLExecTask extends CreoleTask {
-
- private $goodSql = 0;
- private $totalSql = 0;
-
- const DELIM_ROW = "row";
- const DELIM_NORMAL = "normal";
-
- /**
- * Database connection
- */
- private $conn = null;
-
- /**
- * files to load
- */
- private $filesets = array();
-
- /**
- * SQL statement
- */
- private $statement = null;
-
- /**
- * SQL input file
- */
- private $srcFile = null;
-
- /**
- * SQL input command
- */
- private $sqlCommand = "";
-
- /**
- * SQL transactions to perform
- */
- private $transactions = array();
-
- /**
- * SQL Statement delimiter
- */
- private $delimiter = ";";
-
- /**
- * The delimiter type indicating whether the delimiter will
- * only be recognized on a line by itself
- */
- private $delimiterType = "normal"; // can't use constant just defined
-
- /**
- * Print SQL results.
- */
- private $print = false;
-
- /**
- * Print header columns.
- */
- private $showheaders = true;
-
- /**
- * Results Output file.
- */
- private $output = null;
-
-
- /**
- * Action to perform if an error is found
- **/
- private $onError = "abort";
-
- /**
- * Encoding to use when reading SQL statements from a file
- */
- private $encoding = null;
-
- /**
- * Append to an existing file or overwrite it?
- */
- private $append = false;
-
- /**
- * Set the name of the SQL file to be run.
- * Required unless statements are enclosed in the build file
- */
- public function setSrc(PhingFile $srcFile) {
- $this->srcFile = $srcFile;
- }
-
- /**
- * Set an inline SQL command to execute.
- * NB: Properties are not expanded in this text.
- */
- public function addText($sql) {
- $this->sqlCommand .= $sql;
- }
-
- /**
- * Adds a set of files (nested fileset attribute).
- */
- public function addFileset(FileSet $set) {
- $this->filesets[] = $set;
- }
-
- /**
- * Add a SQL transaction to execute
- */
- public function createTransaction() {
- $t = new SQLExecTransaction($this);
- $this->transactions[] = $t;
- return $t;
- }
-
- /**
- * Set the file encoding to use on the SQL files read in
- *
- * @param encoding the encoding to use on the files
- */
- public function setEncoding($encoding) {
- $this->encoding = $encoding;
- }
-
- /**
- * Set the statement delimiter.
- *
- *
For example, set this to "go" and delimitertype to "ROW" for
- * Sybase ASE or MS SQL Server.
- *
- * @param delimiter
- */
- public function setDelimiter($delimiter)
- {
- $this->delimiter = $delimiter;
- }
-
- /**
- * Set the Delimiter type for this sql task. The delimiter type takes two
- * values - normal and row. Normal means that any occurence of the delimiter
- * terminate the SQL command whereas with row, only a line containing just
- * the delimiter is recognized as the end of the command.
- *
- * @param string $delimiterType
- */
- public function setDelimiterType($delimiterType)
- {
- $this->delimiterType = $delimiterType;
- }
-
- /**
- * Set the print flag.
- *
- * @param boolean $print
- */
- public function setPrint($print)
- {
- $this->print = (boolean) $print;
- }
-
- /**
- * Print headers for result sets from the
- * statements; optional, default true.
- * @param boolean $showheaders
- */
- public function setShowheaders($showheaders) {
- $this->showheaders = (boolean) $showheaders;
- }
-
- /**
- * Set the output file;
- * optional, defaults to the console.
- * @param PhingFile $output
- */
- public function setOutput(PhingFile $output) {
- $this->output = $output;
- }
-
- /**
- * whether output should be appended to or overwrite
- * an existing file. Defaults to false.
- * @param $append
- */
- public function setAppend($append) {
- $this->append = (boolean) $append;
- }
-
-
- /**
- * Action to perform when statement fails: continue, stop, or abort
- * optional; default "abort"
- */
- public function setOnerror($action) {
- $this->onError = $action;
- }
-
- /**
- * Load the sql file and then execute it
- * @throws BuildException
- */
- public function main() {
-
- $savedTransaction = array();
- for($i=0,$size=count($this->transactions); $i < $size; $i++) {
- $savedTransaction[] = clone $this->transactions[$i];
- }
-
- $savedSqlCommand = $this->sqlCommand;
-
- $this->sqlCommand = trim($this->sqlCommand);
-
- try {
- if ($this->srcFile === null && $this->sqlCommand === ""
- && empty($this->filesets)) {
- if (count($this->transactions) === 0) {
- throw new BuildException("Source file or fileset, "
- . "transactions or sql statement "
- . "must be set!", $this->location);
- }
- }
-
- if ($this->srcFile !== null && !$this->srcFile->exists()) {
- throw new BuildException("Source file does not exist!", $this->location);
- }
-
- // deal with the filesets
- for ($i = 0,$size=count($this->filesets); $i < $size; $i++) {
- $fs = $this->filesets[$i];
- $ds = $fs->getDirectoryScanner($this->project);
- $srcDir = $fs->getDir($this->project);
-
- $srcFiles = $ds->getIncludedFiles();
-
- // Make a transaction for each file
- for ($j=0, $size=count($srcFiles); $j < $size; $j++) {
- $t = $this->createTransaction();
- $t->setSrc(new PhingFile($srcDir, $srcFiles[$j]));
- }
- }
-
- // Make a transaction group for the outer command
- $t = $this->createTransaction();
- if ($this->srcFile) $t->setSrc($this->srcFile);
- $t->addText($this->sqlCommand);
- $this->conn = $this->getConnection();
-
- try {
-
- $this->statement = $this->conn->createStatement();
-
- $out = null;
-
- try {
-
- if ($this->output !== null) {
- $this->log("Opening output file " . $this->output, PROJECT_MSG_VERBOSE);
- $out = new BufferedWriter(new FileWriter($this->output->getAbsolutePath(), $this->append));
- }
-
- // Process all transactions
- for ($i=0,$size=count($this->transactions); $i < $size; $i++) {
- $this->transactions[$i]->runTransaction($out);
- if (!$this->isAutocommit()) {
- $this->log("Commiting transaction", PROJECT_MSG_VERBOSE);
- $this->conn->commit();
- }
- }
- if ($out) $out->close();
- } catch (Exception $e) {
- if ($out) $out->close();
- throw $e;
- }
- } catch (IOException $e) {
- if (!$this->isAutocommit() && $this->conn !== null && $this->onError == "abort") {
- try {
- $this->conn->rollback();
- } catch (SQLException $ex) {}
- }
- throw new BuildException($e->getMessage(), $this->location);
- } catch (SQLException $e){
- if (!$this->isAutocommit() && $this->conn !== null && $this->onError == "abort") {
- try {
- $this->conn->rollback();
- } catch (SQLException $ex) {}
- }
- throw new BuildException($e->getMessage(), $this->location);
- }
-
- $this->log($this->goodSql . " of " . $this->totalSql .
- " SQL statements executed successfully");
- } catch (Exception $e) {
- $this->transactions = $savedTransaction;
- $this->sqlCommand = $savedSqlCommand;
- throw $e;
- }
- // finally {
- $this->transactions = $savedTransaction;
- $this->sqlCommand = $savedSqlCommand;
-
- }
-
-
- /**
- * read in lines and execute them
- * @throws SQLException, IOException
- */
- public function runStatements(Reader $reader, $out = null) {
- $sql = "";
- $line = "";
- $in = new BufferedReader($reader);
- try {
- while (($line = $in->readLine()) !== null) {
- $line = trim($line);
- $line = ProjectConfigurator::replaceProperties($this->project, $line,
- $this->project->getProperties());
-
- if (StringHelper::startsWith("//", $line) ||
- StringHelper::startsWith("--", $line) ||
- StringHelper::startsWith("#", $line)) {
- continue;
- }
-
- if (strlen($line) > 4
- && strtoupper(substr($line,0, 4)) == "REM ") {
- continue;
- }
-
- $sql .= " " . $line;
- $sql = trim($sql);
-
- // SQL defines "--" as a comment to EOL
- // and in Oracle it may contain a hint
- // so we cannot just remove it, instead we must end it
- if (strpos($line, "--") !== false) {
- $sql .= "\n";
- }
-
- if ($this->delimiterType == self::DELIM_NORMAL
- && StringHelper::endsWith($this->delimiter, $sql)
- || $this->delimiterType == self::DELIM_ROW
- && $line == $this->delimiter) {
- $this->log("SQL: " . $sql, PROJECT_MSG_VERBOSE);
- $this->execSQL(StringHelper::substring($sql, 0, strlen($sql) - strlen($this->delimiter)) - 1, $out);
- $sql = "";
- }
- }
-
- // Catch any statements not followed by ;
- if ($sql !== "") {
- $this->execSQL($sql, $out);
- }
- } catch (SQLException $e) {
- throw new BuildException("Error running statements", $e);
- }
- }
-
-
- /**
- * Exec the sql statement.
- * @throws SQLException
- */
- protected function execSQL($sql, $out = null) {
- // Check and ignore empty statements
- if (trim($sql) == "") {
- return;
- }
-
- try {
- $this->totalSql++;
- if (!$this->statement->execute($sql)) {
- $this->log($this->statement->getUpdateCount() . " rows affected", PROJECT_MSG_VERBOSE);
- } else {
- if ($this->print) {
- $this->printResults($out);
- }
- }
-
- $this->goodSql++;
-
- } catch (SQLException $e) {
- $this->log("Failed to execute: " . $sql, PROJECT_MSG_ERR);
- if ($this->onError != "continue") {
- throw new BuildException("Failed to execute SQL", $e);
- }
- $this->log($e->getMessage(), PROJECT_MSG_ERR);
- }
- }
-
- /**
- * print any results in the statement.
- * @throw SQLException
- */
- protected function printResults($out = null) {
- $lSep = Phing::getProperty('line.separator');
- $rs = null;
- do {
- $rs = $this->statement->getResultSet();
-
- if ($rs !== null) {
-
- $this->log("Processing new result set.", PROJECT_MSG_VERBOSE);
-
- $line = "";
-
- $colsprinted = false;
-
- while ($rs->next()) {
- $fields = $rs->getRow();
-
- if (!$colsprinted && $this->showheaders) {
- $first = true;
- foreach($fields as $fieldName => $ignore) {
- if ($first) $first = false; else $line .= ",";
- $line .= $fieldName;
- }
- if ($out !== null) {
- $out->write($line);
- $out->newLine();
- } else {
- print($line.$lSep);
- }
- $line = "";
- $colsprinted = true;
- } // if show headers
-
- $first = true;
- foreach($fields as $columnValue) {
-
- if ($columnValue != null) {
- $columnValue = trim($columnValue);
- }
-
- if ($first) {
- $first = false;
- } else {
- $line .= ",";
- }
- $line .= $columnValue;
- }
-
- if ($out !== null) {
- $out->write($line);
- $out->newLine();
- } else {
- print($line . $lSep);
- }
- $line = "";
-
- } // while rs->next()
- }
- } while ($this->statement->getMoreResults());
- print($lSep);
- if ($out !== null) $out->newLine();
- }
-}
-
-
-/**
- * "Inner" class that contains the definition of a new transaction element.
- * Transactions allow several files or blocks of statements
- * to be executed using the same JDBC connection and commit
- * operation in between.
- */
-class SQLExecTransaction {
-
- private $tSrcFile = null;
- private $tSqlCommand = "";
- private $parent;
-
- function __construct($parent)
- {
- // Parent is required so that we can log things ...
- $this->parent = $parent;
- }
-
- public function setSrc(PhingFile $src)
- {
- $this->tSrcFile = $src;
- }
-
- public function addText($sql)
- {
- $this->tSqlCommand .= $sql;
- }
-
- /**
- * @throws IOException, SQLException
- */
- public function runTransaction($out = null)
- {
- if (!empty($this->tSqlCommand)) {
- $this->parent->log("Executing commands", PROJECT_MSG_INFO);
- $this->parent->runStatements(new StringReader($this->tSqlCommand), $out);
- }
-
- if ($this->tSrcFile !== null) {
- $this->parent->log("Executing file: " . $this->tSrcFile->getAbsolutePath(),
- PROJECT_MSG_INFO);
- $reader = new FileReader($this->tSrcFile);
- $this->parent->runStatements($reader, $out);
- $reader->close();
- }
- }
-}
-
-
diff --git a/buildscripts/phing/classes/phing/tasks/ext/CreoleTask.php b/buildscripts/phing/classes/phing/tasks/ext/CreoleTask.php
deleted file mode 100644
index a1b439e5..00000000
--- a/buildscripts/phing/classes/phing/tasks/ext/CreoleTask.php
+++ /dev/null
@@ -1,242 +0,0 @@
-.
- */
-
-require_once 'phing/Task.php';
-include_once 'phing/types/Reference.php';
-
-/**
- * Handles Creole configuration needed by SQL type tasks.
- *
- * @author Hans Lellelid (Phing)
- * @author Nick Chalko (Ant)
- * @author Jeff Martin (Ant)
- * @author Michael McCallum (Ant)
- * @author Tim Stephenson (Ant)
- * @version $Revision: 1.13 $
- * @package phing.tasks.system
- */
-abstract class CreoleTask extends Task {
-
- /**
- * Used for caching loaders / driver. This is to avoid
- * getting an OutOfMemoryError when calling this task
- * multiple times in a row.
- *
- * NOT IMPLEMENTED YET
- */
- private static $loaderMap = array();
-
- private $caching = true;
-
- /**
- * Autocommit flag. Default value is false
- */
- private $autocommit = false;
-
- /**
- * [optional] Classpath to Creole driver to use.
- * @param string
- */
- private $driver;
-
- /**
- * DB url.
- */
- private $url;
-
- /**
- * User name.
- */
- private $userId;
-
- /**
- * Password
- */
- private $password;
-
- /**
- * RDBMS Product needed for this SQL.
- **/
- private $rdbms;
-
- /**
- * Initialize CreoleTask.
- * This method includes any necessary Creole libraries and triggers
- * appropriate error if they cannot be found. This is not done in header
- * because we may want this class to be loaded w/o triggering an error.
- */
- function init() {
- include_once 'creole/Creole.php';
- if (!class_exists('Creole')) {
- throw new Exception("Creole task depends on Creole classes being on include_path. (i.e. include of 'creole/Creole.php' failed.)");
- }
- }
-
- /**
- * Caching loaders / driver. This is to avoid
- * getting an OutOfMemoryError when calling this task
- * multiple times in a row; default: true
- * @param $enable
- */
- public function setCaching($enable) {
- $this->caching = $enable;
- }
-
- /**
- * Sets the database connection URL; required.
- * @param url The url to set
- */
- public function setUrl($url) {
- $this->url = $url;
- }
-
- /**
- * Set the Creole driver to be used.
- *
- * @param string $driver driver class name
- */
- public function setDriver($driver)
- {
- $this->driver = $driver;
- }
-
- /**
- * Sets the password; required.
- * @param password The password to set
- */
- public function setPassword($password) {
- $this->password = $password;
- }
-
- /**
- * Auto commit flag for database connection;
- * optional, default false.
- * @param autocommit The autocommit to set
- */
- public function setAutocommit($autocommit) {
- $this->autocommit = $autocommit;
- }
-
- /**
- * Sets the version string, execute task only if
- * rdbms version match; optional.
- * @param version The version to set
- */
- public function setVersion($version) {
- $this->version = $version;
- }
-
- protected function getLoaderMap() {
- return self::$loaderMap;
- }
-
-
- /**
- * Creates a new Connection as using the driver, url, userid and password specified.
- * The calling method is responsible for closing the connection.
- * @return Connection the newly created connection.
- * @throws BuildException if the UserId/Password/Url is not set or there is no suitable driver or the driver fails to load.
- */
- protected function getConnection() {
-
- if ($this->url === null) {
- throw new BuildException("Url attribute must be set!", $this->location);
- }
-
- try {
-
- $this->log("Connecting to " . $this->getUrl(), PROJECT_MSG_VERBOSE);
- $info = new Properties();
-
- $dsn = Creole::parseDSN($this->url);
-
- if (!isset($dsn["username"]) && $this->userId === null) {
- throw new BuildException("Username must be in URL or userid attribute must be set.", $this->location);
- }
-
- if ($this->userId) {
- $dsn["username"] = $this->getUserId();
- }
-
- if ($this->password) {
- $dsn["password"] = $this->getPassword();
- }
-
- if ($this->driver) {
- Creole::registerDriver($dsn['phptype'], $this->driver);
- }
-
- $conn = Creole::getConnection($dsn);
- $conn->setAutoCommit($this->autocommit);
- return $conn;
-
- } catch (SQLException $e) {
- throw new BuildException($e->getMessage(), $this->location);
- }
-
- }
-
- public function isCaching($value) {
- $this->caching = $value;
- }
-
- /**
- * Gets the autocommit.
- * @return Returns a boolean
- */
- public function isAutocommit() {
- return $this->autocommit;
- }
-
- /**
- * Gets the url.
- * @return Returns a String
- */
- public function getUrl() {
- return $this->url;
- }
-
- /**
- * Gets the userId.
- * @return Returns a String
- */
- public function getUserId() {
- return $this->userId;
- }
-
- /**
- * Set the user name for the connection; required.
- * @param userId The userId to set
- */
- public function setUserid($userId) {
- $this->userId = $userId;
- }
-
- /**
- * Gets the password.
- * @return Returns a String
- */
- public function getPassword() {
- return $this->password;
- }
-
-}
diff --git a/buildscripts/phing/classes/phing/tasks/ext/MailTask.php b/buildscripts/phing/classes/phing/tasks/ext/MailTask.php
deleted file mode 100644
index 16d29fb8..00000000
--- a/buildscripts/phing/classes/phing/tasks/ext/MailTask.php
+++ /dev/null
@@ -1,77 +0,0 @@
-.
- */
-
-include_once 'phing/Task.php';
-
-/**
- * Send a message by mail()
- *
- * The build process is a success...
- *
- * @author Francois Harvey at SecuriWeb (http://www.securiweb.net)
- * @version $Revision: 1.1 $
- * @package phing.tasks.ext
- */
-class MailTask extends Task {
-
- protected $recipient;
-
- protected $subject;
-
- protected $msg;
-
- function main() {
- $this->log('Sending mail to ' . $this->recipient );
- mail($this->recipient, $this->subject, $this->msg);
- }
-
- /** setter for message */
- function setMsg($msg) {
- $this->setMessage($msg);
- }
-
- /** alias setter */
- function setMessage($msg) {
- $this->msg = (string) $msg;
- }
-
- /** setter for subject **/
- function setSubject($subject) {
- $this->subject = (string) $subject;
- }
-
- /** setter for recipient **/
- function setRecipient($recipient) {
- $this->recipient = (string) $recipient;
- }
-
- /** alias for recipient **/
- function setTo($recipient) {
- $this->recipient = (string) $recipient;
- }
-
- /** Supporting the Message syntax. */
- function addText($msg)
- {
- $this->msg = (string) $msg;
- }
-}
-
diff --git a/buildscripts/phing/classes/phing/tasks/ext/PackageAsPathTask.php b/buildscripts/phing/classes/phing/tasks/ext/PackageAsPathTask.php
deleted file mode 100644
index b8664aac..00000000
--- a/buildscripts/phing/classes/phing/tasks/ext/PackageAsPathTask.php
+++ /dev/null
@@ -1,65 +0,0 @@
-.
- */
-
-require_once 'phing/Task.php';
-
-/**
- * Convert dot-notation packages to relative paths.
- *
- * @author Hans Lellelid
- * @version $Revision: 1.5 $
- * @package phing.tasks.ext
- */
-class PackageAsPathTask extends Task {
-
- /** The package to convert. */
- protected $pckg;
-
- /** The value to store the conversion in. */
- protected $name;
-
- /**
- * Executes the package to patch converstion and stores it
- * in the user property value.
- */
- public function main()
- {
- $this->project->setUserProperty($this->name, strtr($this->pckg, '.', '/'));
- }
-
- /**
- * @param string $pckg the package to convert
- */
- public function setPackage($pckg)
- {
- $this->pckg = $pckg;
- }
-
- /**
- * @param string $name the Ant variable to store the path in
- */
- public function setName($name)
- {
- $this->name = $name;
- }
-
-}
diff --git a/buildscripts/phing/classes/phing/tasks/ext/PearPackageTask.php b/buildscripts/phing/classes/phing/tasks/ext/PearPackageTask.php
deleted file mode 100644
index 4f8ee3ab..00000000
--- a/buildscripts/phing/classes/phing/tasks/ext/PearPackageTask.php
+++ /dev/null
@@ -1,421 +0,0 @@
-.
- */
-
-require_once 'phing/tasks/system/MatchingTask.php';
-include_once 'phing/types/FileSet.php';
-
-/**
- * A task to create PEAR package.xml file.
- *
- * This class uses the PEAR_PackageFileMaintainer class to perform the work.
- *
- * This class is designed to be very flexible -- i.e. account for changes to the package.xml w/o
- * requiring changes to this class. We've accomplished this by having generic