/** * @see sfTask */ protected function execute($arguments = array(), $options = array()) { // load Propel configuration before Phing $databaseManager = new sfDatabaseManager($this->configuration); require_once sfConfig::get('sf_symfony_lib_dir') . '/plugins/sfPropelPlugin/lib/propel/sfPropelAutoload.php'; $buildAll = new sfPropelBuildAllTask($this->dispatcher, $this->formatter); $buildAll->setCommandApplication($this->commandApplication); $buildAll->run(array(), $options['skip-forms'] ? array('--skip-forms') : array()); $loadData = new sfPropelLoadDataTask($this->dispatcher, $this->formatter); $loadData->setCommandApplication($this->commandApplication); $loadData->run(array('application' => $arguments['application']), array('--env=' . $options['env'], '--connection=' . $options['connection'])); }
function installQubit($qubitWebRoot, $qubitDataRoot) { global $fileSystemPathToWebFiles; global $fileSystemPathToDataFiles; // Verify that $fileSystemPathToWebFiles and $fileSystemPathToDataFiles exist. Don't bother // reporting if they are found. if (!file_exists($fileSystemPathToWebFiles)) { reportOnProgress("Verifying location of source files", 'Problem', "Can't find {$fileSystemPathToWebFiles}", "Verify that '{$fileSystemPathToWebFiles}' exists"); $error = true; } if (!file_exists($fileSystemPathToDataFiles)) { reportOnProgress("Verifying location of source files", 'Problem', "Can't find {$fileSystemPathToDataFiles}", "Verify that '{$fileSystemPathToDataFiles}' exists"); $error = true; } // If there are errors, return here since we can't go any further, and we don't want to copy any files. // return $error; // If we made it this far, copy files needed to install Qubit $error = copyFiles($fileSystemPathToWebFiles, $qubitWebRoot, 'web'); $error = copyFiles($fileSystemPathToDataFiles, $qubitDataRoot, 'data'); // Write out index.php controller file $error = writeIndexPhp($qubitWebRoot . 'index.php', $qubitDataRoot . 'lib/QubitConfiguration.class.php'); // Populate db with structure and sample data. We use Symfony's sfPropelInsertSqlTask() and // sfPropelLoadDataTask() objects to do this. To do: Trap errors here and report them with // reportOnProgress(). // First, include Symfony config flass, initialize objects require_once $qubitDataRoot . 'lib/QubitConfiguration.class.php'; $configuration = new QubitConfiguration('dev', true); $dispatcher = new sfEventDispatcher(); $formatter = new sfAnsiColorFormatter(); // We need to chdir into the data directory or symfony complains chdir($qubitDataRoot); // Next, copy template for propel.ini and call a symphony task to populate it and databases.yml $error = copyPropelIni($qubitDataRoot . 'config/propel.ini.tmpl', $qubitDataRoot . 'config/propel.ini'); $error = writeDatabaseConfigFiles($dispatcher, $formatter); // Then, perform SQL tasks. We're no longer checking for $error here, but the user will see errors // if these tasks generate any. $insertSql = new sfPropelInsertSqlTask($dispatcher, $formatter); $insertSql->run(); $loadData = new sfPropelLoadDataTask($dispatcher, $formatter); $loadData->run(array('qubit')); // To do: Perform check to see if mod_rewrite is enabled. We do this by issuing an fopen to a Qubit URL return $error; }
/** * @see sfTask */ protected function execute($arguments = array(), $options = array()) { // load Propel configuration before Phing $databaseManager = new sfDatabaseManager($this->configuration); require_once dirname(__FILE__) . '/../addon/sfPropelAutoload.php'; $buildAll = new sfPropelBuildAllTask($this->dispatcher, $this->formatter); $buildAll->setCommandApplication($this->commandApplication); $buildAllOptions = array('--env=' . $options['env'], '--connection=' . $options['connection']); foreach ($options['phing-arg'] as $arg) { $buildAllOptions[] = '--phing-arg=' . escapeshellarg($arg); } if ($options['application']) { $buildAllOptions[] = '--application=' . $options['application']; } if ($options['skip-forms']) { $buildAllOptions[] = '--skip-forms'; } if ($options['classes-only']) { $buildAllOptions[] = '--classes-only'; } if ($options['no-confirmation']) { $buildAllOptions[] = '--no-confirmation'; } $ret = $buildAll->run(array(), $buildAllOptions); if (0 == $ret) { $loadData = new sfPropelLoadDataTask($this->dispatcher, $this->formatter); $loadData->setCommandApplication($this->commandApplication); $dataLoadOptions = array('--env=' . $options['env'], '--connection=' . $options['connection']); if ($options['application']) { $dataLoadOptions[] = '--application=' . $options['application']; } if ($options['dir']) { foreach ($options['dir'] as $dir) { $dataLoadOptions[] = '--dir=' . $dir; } } if ($options['append']) { $dataLoadOptions[] = '--append'; } $loadData->run(array(), $dataLoadOptions); } $this->cleanup(); return $ret; }