/**
  * Marks that we think this migration class can continue to migrate
  */
 public function reattempt()
 {
     parent::reattempt();
     //also, we want to reattempt any stages that were marked as borked
     foreach ($this->stages() as $stage) {
         if ($stage->is_broken()) {
             $stage->reattempt();
         }
     }
 }
コード例 #2
0
 /**
  * A lot like "__sleep()" magic method in purpose, this is meant for persisting this class'
  * properties to the DB. However, we don't want to use __sleep() because its quite
  * possible that this class is defined when it goes to sleep, but NOT available when it
  * awakes (eg, this class is part of an addon that is deactivated at some point).
  */
 public function properties_as_array()
 {
     $properties = parent::properties_as_array();
     $properties['_migration_stages'] = array();
     foreach ($this->_migration_stages as $migration_stage_priority => $migration_stage_class) {
         $properties['_migration_stages'][$migration_stage_priority] = $migration_stage_class->properties_as_array();
     }
     unset($properties['_mappings']);
     foreach ($this->_mappings as $old_table_name => $mapping_to_new_table) {
         foreach ($mapping_to_new_table as $new_table_name => $mapping) {
             $success = $this->_set_mapping_option($old_table_name, $new_table_name, $mapping);
         }
     }
     return $properties;
 }