diff options
author | Florian Pritz <bluewind@xinu.at> | 2012-10-08 18:04:12 +0200 |
---|---|---|
committer | Florian Pritz <bluewind@xinu.at> | 2012-10-08 18:04:12 +0200 |
commit | 74dcbbf816deb0cb05e43f1843f6b84b51966470 (patch) | |
tree | b4ceb0a46fb54366d8943325d9e91895e78a03c0 /system/libraries/Migration.php | |
parent | b12d7cb03ab1ef63baab4a8d4b1380e6990c1437 (diff) | |
parent | 05e8c03b6742033cf88885cb86217cadca3a4567 (diff) |
Merge tag '2.1.3'
Conflicts:
user_guide
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'system/libraries/Migration.php')
-rw-r--r-- | system/libraries/Migration.php | 32 |
1 files changed, 11 insertions, 21 deletions
diff --git a/system/libraries/Migration.php b/system/libraries/Migration.php index 5a41377ea..df2dd7ce3 100644 --- a/system/libraries/Migration.php +++ b/system/libraries/Migration.php @@ -57,7 +57,7 @@ class CI_Migration { } // If not set, set it - $this->_migration_path == '' OR $this->_migration_path = APPPATH . 'migrations/'; + $this->_migration_path == '' AND $this->_migration_path = APPPATH . 'migrations/'; // Add trailing slash if not set $this->_migration_path = rtrim($this->_migration_path, '/').'/'; @@ -89,8 +89,7 @@ class CI_Migration { * Calls each migration step required to get to the schema version of * choice * - * @access public - * @param $version integer Target schema version + * @param int Target schema version * @return mixed TRUE if already latest, FALSE if failed, int if upgraded */ public function version($target_version) @@ -105,14 +104,13 @@ class CI_Migration { ++$stop; $step = 1; } - else { // Moving Down $step = -1; } - - $method = $step === 1 ? 'up' : 'down'; + + $method = ($step === 1) ? 'up' : 'down'; $migrations = array(); // We now prepare to actually DO the migrations @@ -216,7 +214,6 @@ class CI_Migration { /** * Set's the schema to the latest migration * - * @access public * @return mixed true if already latest, false if failed, int if upgraded */ public function latest() @@ -228,7 +225,7 @@ class CI_Migration { } $last_migration = basename(end($migrations)); - + // Calculate the last migration step from existing migration // filenames and procceed to the standard version migration return $this->version((int) substr($last_migration, 0, 3)); @@ -239,7 +236,6 @@ class CI_Migration { /** * Set's the schema to the migration version set in config * - * @access public * @return mixed true if already current, false if failed, int if upgraded */ public function current() @@ -252,7 +248,6 @@ class CI_Migration { /** * Error string * - * @access public * @return string Error message returned as a string */ public function error_string() @@ -265,7 +260,6 @@ class CI_Migration { /** * Set's the schema to the latest migration * - * @access protected * @return mixed true if already latest, false if failed, int if upgraded */ protected function find_migrations() @@ -273,7 +267,7 @@ 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++) { // Mark wrongly formatted files as false for later filtering @@ -283,9 +277,8 @@ class CI_Migration { $files[$i] = FALSE; } } - - sort($files); + sort($files); return $files; } @@ -294,8 +287,7 @@ class CI_Migration { /** * Retrieves current schema version * - * @access protected - * @return integer Current Migration + * @return int Current Migration */ protected function _get_version() { @@ -308,9 +300,8 @@ class CI_Migration { /** * Stores the current schema version * - * @access protected - * @param $migrations integer Migration reached - * @return void Outputs a report of the migration + * @param int Migration reached + * @return bool */ protected function _update_version($migrations) { @@ -324,8 +315,7 @@ class CI_Migration { /** * Enable the use of CI super-global * - * @access public - * @param $var + * @param mixed $var * @return mixed */ public function __get($var) |