summaryrefslogtreecommitdiffstats
path: root/system
diff options
context:
space:
mode:
authorAndrey Andreev <narf@bofh.bg>2012-11-28 18:06:20 +0100
committerAndrey Andreev <narf@bofh.bg>2012-11-28 18:06:20 +0100
commite1d6c46b7d5e3d82dc6953af29f0b02ccb03e2dc (patch)
treeb23f222598013060e674fc4ba7ad61d3ceaa0373 /system
parent539f34e2d15b3745cc73c45738c2d8a160473dd2 (diff)
Fix #2037
Diffstat (limited to 'system')
-rw-r--r--system/libraries/Migration.php14
1 files changed, 8 insertions, 6 deletions
diff --git a/system/libraries/Migration.php b/system/libraries/Migration.php
index e96791cef..bf2d18e07 100644
--- a/system/libraries/Migration.php
+++ b/system/libraries/Migration.php
@@ -233,11 +233,6 @@ class CI_Migration {
$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 @@ class CI_Migration {
($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);
}