Permalink
Browse files

Fix #2037

  • Loading branch information...
1 parent 539f34e commit e1d6c46b7d5e3d82dc6953af29f0b02ccb03e2dc @narfbg narfbg committed Nov 28, 2012
Showing with 8 additions and 6 deletions.
  1. +8 −6 system/libraries/Migration.php
@@ -233,11 +233,6 @@ public function version($target_version)
$this->_error_string = sprintf($this->lang->line('migration_class_doesnt_exist'), $class);
return FALSE;
}
- elseif ( ! is_callable(array($class, $method)))
- {
- $this->_error_string = sprintf($this->lang->line('migration_missing_'.$method.'_method'), $class);
- return FALSE;
- }
$previous = $number;
@@ -247,8 +242,15 @@ public function version($target_version)
($method === 'down' && $number <= $current_version && $number > $target_version)
)
{
+ $instance = new $class();
+ if ( ! is_callable(array($instance, $method)))
+ {
+ $this->_error_string = sprintf($this->lang->line('migration_missing_'.$method.'_method'), $class);
+ return FALSE;
+ }
+
log_message('debug', 'Migrating '.$method.' from version '.$current_version.' to version '.$number);
- call_user_func(array(new $class, $method));
+ call_user_func(array($instance, $method));
$current_version = $number;
$this->_update_version($current_version);
}

0 comments on commit e1d6c46

Please sign in to comment.