/**
  * @see sfTask
  */
 protected function execute($arguments = array(), $options = array())
 {
     // load Propel configuration before Phing
     $databaseManager = new sfDatabaseManager($this->configuration);
     $buildAll = new sfPropelBuildAllTask($this->dispatcher, $this->formatter);
     $buildAll->setCommandApplication($this->commandApplication);
     $buildAll->setConfiguration($this->configuration);
     $ret = $buildAll->run(array(), array('phing-arg' => $options['phing-arg'], 'skip-forms' => $options['skip-forms'], 'classes-only' => $options['classes-only'], 'no-confirmation' => $options['no-confirmation'], 'connection' => $options['connection']));
     if (0 == $ret) {
         $loadData = new sfPropelDataLoadTask($this->dispatcher, $this->formatter);
         $loadData->setCommandApplication($this->commandApplication);
         $loadData->setConfiguration($this->configuration);
         $loadData->run($options['dir'], array('append' => $options['append'], 'connection' => $options['connection']));
     }
     $this->cleanup();
     return $ret;
 }
Exemple #2
0
 protected function execute($arguments = array(), $options = array())
 {
     ini_set('memory_limit', '128M');
     // initialize the database connection
     $databaseManager = new sfDatabaseManager($this->configuration);
     $connection = $databaseManager->getDatabase($options['connection'])->getConnection();
     // delete previous tables
     $deleteTablesTask = new deleteTablesTask($this->dispatcher, $this->formatter);
     $return = $deleteTablesTask->run(array(), array('no-confirmation', 'connection' => $options['connection']));
     if ($return) {
         return $return;
     }
     // generates Propel model and form classes, SQL and initializes the database
     $propelBuildAllTask = new sfPropelBuildAllTask($this->dispatcher, $this->formatter);
     $return = $propelBuildAllTask->run(array(), array('no-confirmation'));
     if ($return) {
         return $return;
     }
     // loads YAML fixture data
     $propelDataLoadTask = new sfPropelDataLoadTask($this->dispatcher, $this->formatter);
     $return = $propelDataLoadTask->run(array(), array());
     if ($return) {
         return $return;
     }
     // clear cache
     $clearCacheTask = new cacheClearTask($this->dispatcher, $this->formatter);
     $return = $clearCacheTask->run(array(), array());
     if ($return) {
         return $return;
     }
     // clear log
     $clearLogTask = new logClearTask($this->dispatcher, $this->formatter);
     $return = $clearLogTask->run(array(), array());
     if ($return) {
         return $return;
     }
     // permission
     $permissionsTask = new sfProjectPermissionsTask($this->dispatcher, $this->formatter);
     $return = $permissionsTask->run(array(), array());
     if ($return) {
         return $return;
     }
     return 0;
 }
 /**
  * @see sfTask
  */
 protected function execute($arguments = array(), $options = array())
 {
     if (!($mode = $this->calculateMode($options))) {
         throw new InvalidArgumentException(sprintf("You must include one or more of the following build options:\n--%s\n\nSee this task's help page for more information:\n\n  php symfony help propel:build", join(', --', array_keys($this->getBuildOptions()))));
     }
     if (self::BUILD_MODEL == (self::BUILD_MODEL & $mode)) {
         $task = new sfPropelBuildModelTask($this->dispatcher, $this->formatter);
         $task->setCommandApplication($this->commandApplication);
         $task->setConfiguration($this->configuration);
         $ret = $task->run();
         if ($ret) {
             return $ret;
         }
     }
     if (self::BUILD_FORMS == (self::BUILD_FORMS & $mode)) {
         $task = new sfPropelBuildFormsTask($this->dispatcher, $this->formatter);
         $task->setCommandApplication($this->commandApplication);
         $task->setConfiguration($this->configuration);
         $ret = $task->run();
         if ($ret) {
             return $ret;
         }
     }
     if (self::BUILD_FILTERS == (self::BUILD_FILTERS & $mode)) {
         $task = new sfPropelBuildFiltersTask($this->dispatcher, $this->formatter);
         $task->setCommandApplication($this->commandApplication);
         $task->setConfiguration($this->configuration);
         $ret = $task->run();
         if ($ret) {
             return $ret;
         }
     }
     if (self::BUILD_SQL == (self::BUILD_SQL & $mode)) {
         $task = new sfPropelBuildSqlTask($this->dispatcher, $this->formatter);
         $task->setCommandApplication($this->commandApplication);
         $task->setConfiguration($this->configuration);
         $ret = $task->run();
         if ($ret) {
             return $ret;
         }
     }
     if (self::BUILD_DB == (self::BUILD_DB & $mode)) {
         $task = new sfPropelInsertSqlTask($this->dispatcher, $this->formatter);
         $task->setCommandApplication($this->commandApplication);
         $task->setConfiguration($this->configuration);
         $ret = $task->run(array(), array('no-confirmation' => $options['no-confirmation']));
         if ($ret) {
             return $ret;
         }
     }
     if (count($options['and-load']) || count($options['and-append'])) {
         $task = new sfPropelDataLoadTask($this->dispatcher, $this->formatter);
         $task->setCommandApplication($this->commandApplication);
         $task->setConfiguration($this->configuration);
         if (count($options['and-load'])) {
             $ret = $task->run(array('dir_or_file' => in_array(array(), $options['and-load'], true) ? null : $options['and-load']));
             if ($ret) {
                 return $ret;
             }
         }
         if (count($options['and-append'])) {
             $ret = $task->run(array('dir_or_file' => in_array(array(), $options['and-append'], true) ? null : $options['and-append']), array('append' => true));
             if ($ret) {
                 return $ret;
             }
         }
     }
 }
 public static function loadData()
 {
     $object = new QubitInformationObject();
     $object->id = QubitInformationObject::ROOT_ID;
     $object->save();
     $object = new QubitActor();
     $object->id = QubitActor::ROOT_ID;
     $object->save();
     $object = new QubitSetting();
     $object->name = 'plugins';
     $object->value = serialize(array('sfCaribouPlugin', 'sfEhriThemePlugin', 'sfDcPlugin', 'sfEacPlugin', 'sfEadPlugin', 'sfIsaarPlugin', 'sfIsadPlugin', 'sfEhriIsadPlugin', 'sfIsdfPlugin', 'sfIsdiahPlugin', 'sfEhriIsdiahPlugin', 'sfModsPlugin', 'sfRadPlugin', 'sfSkosPlugin'));
     $object->save();
     $dispatcher = sfContext::getInstance()->getEventDispatcher();
     $formatter = new sfAnsiColorFormatter();
     chdir(sfConfig::get('sf_root_dir'));
     $loadData = new sfPropelDataLoadTask($dispatcher, $formatter);
     $loadData->run();
 }