/** * Create installation script. */ public function showInstallScript() { $classes = array('Curry_Install', 'Curry_String', 'Curry_Util', 'Curry_Archive_FileInfo', 'Curry_Archive_Reader', 'Curry_Archive_Iterator', 'Curry_Archive'); $contents = "<?php\n\n// CurryCMS v" . Curry_Core::VERSION . " Installation Script\n// Created on " . strftime('%Y-%m-%d %H:%M:%S') . "\n"; $contents .= str_repeat('/', 60) . "\n\n"; $contents .= "ini_set('error_reporting', E_ALL & ~E_NOTICE);\n"; $contents .= "ini_set('display_errors', 1);\n"; $contents .= "umask(0002);\n\n"; $autoloader = Curry_Core::getAutoloader(); foreach ($classes as $clazz) { $file = $autoloader->findFile($clazz); $contents .= "// {$clazz} ({$file})\n"; $contents .= str_repeat('/', 60) . "\n\n"; $contents .= preg_replace('/^<\\?php\\s+/', '', file_get_contents($file)) . "\n\n"; } $contents .= "//////////////////////////////////////////////////////////\n\n"; $contents .= 'Curry_Install::show(isset($_GET[\'step\']) ? $_GET[\'step\'] : \'\');'; $contents = str_replace("{{INSTALL_CSS}}", file_get_contents(Curry_Core::$config->curry->basePath . '/shared/backend/common/css/install.css'), $contents); Curry_Application::returnData($contents, 'text/plain', 'install.php'); }
/** * Run propel phing commands * * @param string $cmd phing target * @param array $argv arguments * @return string */ public static function propelGen($cmd = '', $argv = array()) { $autoloader = Curry_Core::getAutoloader(); $generatorBase = dirname(dirname(dirname($autoloader->findFile('AbstractPropelDataModelTask')))); $buildXml = $generatorBase . '/build.xml'; $projectPath = Curry_Core::$config->curry->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; }