Permalink
Browse files

Backport fix for issue #1699

  • Loading branch information...
1 parent da4f9e1 commit 7ad72975fa3cda4bf8797f788ba7445bdb4ae67a @narfbg narfbg committed Oct 4, 2012
Showing with 12 additions and 21 deletions.
  1. +11 −21 system/libraries/Migration.php
  2. +1 −0 user_guide/changelog.html
@@ -57,7 +57,7 @@ public function __construct($config = array())
}
// 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 @@ public function __construct($config = array())
* 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 @@ public function version($target_version)
++$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 @@ public function version($target_version)
/**
* 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 @@ public function latest()
}
$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 @@ public function latest()
/**
* 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 @@ public function current()
/**
* Error string
*
- * @access public
* @return string Error message returned as a string
*/
public function error_string()
@@ -265,15 +260,14 @@ public function error_string()
/**
* 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()
{
// 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 @@ protected function find_migrations()
$files[$i] = FALSE;
}
}
-
- sort($files);
+ sort($files);
return $files;
}
@@ -294,8 +287,7 @@ protected function find_migrations()
/**
* Retrieves current schema version
*
- * @access protected
- * @return integer Current Migration
+ * @return int Current Migration
*/
protected function _get_version()
{
@@ -308,9 +300,8 @@ protected function _get_version()
/**
* 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 @@ protected function _update_version($migrations)
/**
* Enable the use of CI super-global
*
- * @access public
- * @param $var
+ * @param mixed $var
* @return mixed
*/
public function __get($var)
@@ -65,6 +65,7 @@
<li>Fixed a bug (#1543) - <a href="libraries/caching.html#file">File-based Caching</a> method <samp>get_metadata()</samp> used a non-existent array key to look for the TTL value.</li>
<li>Fixed a bug (#1314) - <a href="libraries/session.html">Session Library</a> method <samp>sess_destroy()</samp> didn't destroy the userdata array.
<li>Fixed a bug where the <a href="libraries/profiler.html">Profiler Library</a> issued an E_WARNING error if <a href="libraries/session.html">Session</a> userdata contains objects.</li>
+ <li>Fixed a bug (#1699) - <a href="libraries/migration.html">Migration Library</a> ignored the <samp>$config['migration_path']</samp> setting.
</ul>
<h2>Version 2.1.2</h2>

0 comments on commit 7ad7297

Please sign in to comment.