. require_once('phing/Task.php'); /** * The ExtractMantisBTVersion is a custom task which extracts the MantisBT version * as defined by the constants file. * * @author Robert Munteanu */ class ExtractMantisBTVersion extends Task { private $file; public function setFile(PhingFile $file) { $this->file = $file; } public function main() { if ( ! isset ( $this->file ) ) { throw new BuildException("Missing 'file' attribute."); } $contents = file($this->file->getPath()); foreach ( $contents as $line ) { if ( strstr($line, 'MANTIS_VERSION')) { eval($line); break; } } if ( !constant('MANTIS_VERSION' ) ) throw new BuildException('No constant named MANTIS_VERSION found in ' . $this->file->getPath()); $this->project->setProperty('mantisbtversion', MANTIS_VERSION); } } ?>