diff options
author | Greg Aker <greg@gregaker.net> | 2011-12-25 07:34:59 +0100 |
---|---|---|
committer | Greg Aker <greg@gregaker.net> | 2011-12-25 07:34:59 +0100 |
commit | 11ce5da8c743b5f6592c83a2b91e545d76a8789b (patch) | |
tree | c06c69608eddb73bd903fefa447f16ce29ea3b6e /system/libraries/Migration.php | |
parent | 03abee3df4534028c795e3c3da91034a3d3ee0f4 (diff) | |
parent | 39b441c5d37b5345ee73e716d423750c12ecaad3 (diff) |
Merge branch 'develop' of github.com:EllisLab/CodeIgniter into develop
Diffstat (limited to 'system/libraries/Migration.php')
-rw-r--r-- | system/libraries/Migration.php | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/system/libraries/Migration.php b/system/libraries/Migration.php index 94961b568..eb5161d76 100644 --- a/system/libraries/Migration.php +++ b/system/libraries/Migration.php @@ -1,4 +1,4 @@ -<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); +<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); /** * CodeIgniter * @@ -101,12 +101,9 @@ class CI_Migration { } // Do we auto migrate to the latest migration? - if ($this->_migration_auto_latest == TRUE) + if ($this->_migration_auto_latest === TRUE AND ! $this->latest()) { - if ( ! $this->latest() ) - { - show_error($this->error_string()); - } + show_error($this->error_string()); } } @@ -134,7 +131,6 @@ class CI_Migration { ++$stop; $step = 1; } - else { // Moving Down @@ -158,11 +154,11 @@ class CI_Migration { } // Migration step not found - if (count($f) == 0) + if (count($f) === 0) { // If trying to migrate up to a version greater than the last // existing one, migrate to the last one. - if ($step == 1) + if ($step === 1) { break; } @@ -214,7 +210,7 @@ class CI_Migration { log_message('debug', 'Current migration: '.$current_version); - $version = $i + ($step == 1 ? -1 : 0); + $version = $i + ($step === 1 ? -1 : 0); // If there is nothing to do so quit if ($migrations === array()) @@ -301,13 +297,11 @@ class CI_Migration { { // Load all *_*.php files in the migrations path $files = glob($this->_migration_path.'*_*.php'); - $file_count = count($files); - for ($i = 0; $i < $file_count; $i++) + for ($i = 0, $c = count($files); $i < $c; $i++) { // Mark wrongly formatted files as false for later filtering - $name = basename($files[$i], '.php'); - if ( ! preg_match('/^\d{3}_(\w+)$/', $name)) + if ( ! preg_match('/^\d{3}_(\w+)$/', basename($files[$i], '.php'))) { $files[$i] = FALSE; } @@ -364,4 +358,4 @@ class CI_Migration { } /* End of file Migration.php */ -/* Location: ./system/libraries/Migration.php */
\ No newline at end of file +/* Location: ./system/libraries/Migration.php */ |