/**
  * @see sfTask
  */
 protected function execute($arguments = array(), $options = array())
 {
     $databaseManager = new sfDatabaseManager($this->configuration);
     $database_dir = sfConfig::get('sf_data_dir');
     $default_build_sequence_file = $database_dir . '/build-sequence.xml';
     $default_update_log_file = $database_dir . '/update-log.xml';
     $default_updater_configuration_file = $database_dir . '/updater-configuration.xml';
     $command = $arguments['command'];
     //initialize updater, if there is meaningful work to do
     if (in_array($command, array('update', 'drop'))) {
         $xml_build_sequence = new \sfAltumoPlugin\Build\DatabaseBuildSequenceFile($default_build_sequence_file);
         $xml_sf_altumo_build_sequence = new \sfAltumoPlugin\Build\DatabaseBuildSequenceFile($database_dir . '/../plugins/sfAltumoPlugin/data/build-sequence.xml');
         $xml_update_log = new \sfAltumoPlugin\Deployment\DatabaseUpdateLogFile($default_update_log_file, false);
         $xml_updater_configuration = new \sfAltumoPlugin\Deployment\DatabaseUpdaterConfigurationFile($default_updater_configuration_file);
         $xml_updater_configuration->setDatabaseDirectory($database_dir);
         $database_updater = new \sfAltumoPlugin\Deployment\DatabaseUpdater($xml_updater_configuration, $xml_build_sequence, $xml_update_log, $xml_sf_altumo_build_sequence);
     }
     switch ($command) {
         case 'update':
             $ignore_working_tree_changes = \Altumo\Validation\Booleans::assertLooseBoolean($options['ignore-working-tree-changes']);
             $has_upcoming_data_updates = $database_updater->hasUpcomingDataUpdates();
             if ($has_upcoming_data_updates && \Altumo\Git\Status::hasChanges() && !$ignore_working_tree_changes) {
                 throw new \Exception('Your working tree currently has changes. You must commit or stage these before performing an update or pass the ignore-working-tree-changes flag.');
             }
             $number_of_scripts_executed = $database_updater->update($arguments);
             break;
         case 'drop':
             $number_of_scripts_executed = $database_updater->drop($arguments);
             break;
         case 'init':
             $xml_updater_configuration = new \sfAltumoPlugin\Deployment\DatabaseUpdaterConfigurationFile($default_updater_configuration_file, false);
             $xml_update_log = new \sfAltumoPlugin\Deployment\DatabaseUpdateLogFile($default_update_log_file, false);
             $number_of_scripts_executed = 0;
             break;
         default:
             throw new sfCommandException(sprintf('Command "%s" does not exist.', $arguments['command']));
     }
     $this->log($number_of_scripts_executed . ' scripts executed successfully.' . "\n");
 }
 /**
  * Determines if widget should display the difference between the primary
  * and secondary value as an absolute value (true) or per cent value (false)
  * 
  * @param bool $v
  *
  * @return \sfAltumoPlugin\Geckoboard\Widget\NumberAndSecondaryStatWidget
  *
  * @throws \Exception if $v doesn't validate
  */
 public function setAbsolute($v)
 {
     $this->absolute = \Altumo\Validation\Booleans::assertLooseBoolean($v);
     return $this;
 }
Exemplo n.º 3
0
 /**
  * Setter for the update field on this ApiWriteOperation.
  * 
  * @param boolean $update
  * @throws \Exception //if $update cannot be interpreted as a boolean
  */
 public function setUpdate($update)
 {
     $this->update = \Altumo\Validation\Booleans::assertLooseBoolean($update);
 }
Exemplo n.º 4
0
 /**
  * Setter for the read_only field on this \sfAltumoPlugin\Api\ApiFieldMap.
  * 
  * @param boolean $read_only
  */
 public function setReadOnly($read_only)
 {
     $this->setFlag(self::FLAG_READONLY, \Altumo\Validation\Booleans::assertLooseBoolean($read_only));
 }
 /**
  * (non-PHPdoc)
  * @see BaseSystemEventSubscription::setEnabled()
  *
  * @throws \Exception if value fails to validate
  */
 public function setEnabled($v)
 {
     return parent::setEnabled(\Altumo\Validation\Booleans::assertLooseBoolean($v));
 }
Exemplo n.º 6
0
 /**
  * Sets the subject of this email Message
  * 
  * 
  * @param bool $enabled
  * 
  * @return \sfAltumoPlugin\Email\Message
  */
 protected function setEnabled($enabled)
 {
     $this->enabled = \Altumo\Validation\Booleans::assertLooseBoolean($enabled);
     return $this;
 }
Exemplo n.º 7
0
 /**
  * Setter for the https field on this ApiClient.
  *
  * @param boolean $https
  * @throws \Exception                    //if $https is not a boolean
  */
 public function setHttps($https)
 {
     $this->https = \Altumo\Validation\Booleans::assertLooseBoolean($https);
 }
Exemplo n.º 8
0
 /**
  * Determines whether or not percentages should be shown in the widget
  * 
  * @param bool $enabled
  * 
  * @return \sfAltumoPlugin\Geckoboard\Widget\FunnelWidget
  * 
  * @throws \Exception if value doesn't validate
  */
 public function setPercentageEnabled($enabled = true)
 {
     $this->is_percentage_enabled = \Altumo\Validation\Booleans::assertLooseBoolean($enabled);
     return $this;
 }
 /**
  * Determines whether the builder should drop all tables when a new snapshot
  * is found.
  * 
  * @throws \Exception                    //if DropOnNewSnapshot cannot be 
  *                                         interpreted as boolean
  * @return boolean
  */
 public function dropOnNewSnapshots()
 {
     $this->assertFileOpen();
     return \Altumo\Validation\Booleans::assertLooseBoolean($this->getXmlRoot()->xpath('Settings/DropOnNewSnapshot', false));
 }