From e1d6c46b7d5e3d82dc6953af29f0b02ccb03e2dc Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Wed, 28 Nov 2012 19:06:20 +0200 Subject: Fix #2037 --- system/libraries/Migration.php | 14 ++++++++------ 1 file 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); } -- cgit v1.2.3-24-g4f1b