/** * * @param string $taskName */ public function runPhing($taskName) { // Copy Files $this->mySchemaBuilder->loadXmlFiles(); // Create build.properties file $this->createBuildPropertiesFile($this->tmpDir . '/build.properties'); // Create buildtime-conf file $this->createBuildTimeConfFile($this->tmpDir . '/buildtime-conf.xml'); // $args = array(); $args = $this->getPhingArguments(); $args[] = $taskName; // Enable output buffering \Phing::setOutputStream(new \OutputStream(fopen('php://output', 'w'))); \Phing::setErrorStream(new \OutputStream(fopen('php://output', 'w'))); \Phing::startup(); \Phing::setProperty('phing.home', getenv('PHING_HOME')); // $myPhing = new \Phing(); //$returnStatus = true; $myPhing->execute($args); $myPhing->runBuild(); /*$this->buffer = ob_get_contents(); // Guess errors if (strstr($this->buffer, 'failed. Aborting.') || strstr($this->buffer, 'Failed to execute') || strstr($this->buffer, 'failed for the following reason:')) { }*/ }
/** * Run propel phing commands * * @param string $cmd phing target * @param array $argv arguments * @return string */ public static function propelGen($cmd = '', $argv = array()) { $autoloader = App::getInstance()->autoloader; $generatorBase = dirname(dirname(dirname($autoloader->findFile('AbstractPropelDataModelTask')))); $buildXml = $generatorBase . '/build.xml'; $projectPath = \Curry\App::getInstance()['projectPath'] . '/propel'; $argv[] = '-logger'; $argv[] = 'phing.listener.AnsiColorLogger'; $argv[] = '-f'; $argv[] = $buildXml; $argv[] = '-Dproject.dir=' . $projectPath; if ($cmd) { $argv[] = $cmd; } $cwd = getcwd(); $stream = fopen("php://temp", 'r+'); $outputStream = new OutputStream($stream); Phing::setOutputStream($outputStream); Phing::setErrorStream($outputStream); Phing::startup(); Phing::fire($argv); rewind($stream); $content = stream_get_contents($stream); Phing::shutdown(); chdir($cwd); if (extension_loaded('apc')) { @apc_clear_cache(); } return $content; }