mirror of
https://github.com/Oreolek/kohana-migrations.git
synced 2024-06-28 20:55:08 +03:00
Making it easier to pass data into db:migrate task outside of the cli
This commit is contained in:
parent
0a2863ae9a
commit
181e2d7b67
|
@ -95,6 +95,9 @@ class Minion_Task_Db_Migrate extends Minion_Task
|
||||||
*/
|
*/
|
||||||
protected function _parse_locations($location)
|
protected function _parse_locations($location)
|
||||||
{
|
{
|
||||||
|
if(is_array($location))
|
||||||
|
return $location;
|
||||||
|
|
||||||
$locations = array();
|
$locations = array();
|
||||||
$location = trim($location, ',');
|
$location = trim($location, ',');
|
||||||
|
|
||||||
|
@ -125,24 +128,29 @@ class Minion_Task_Db_Migrate extends Minion_Task
|
||||||
*/
|
*/
|
||||||
protected function _parse_target_versions($versions)
|
protected function _parse_target_versions($versions)
|
||||||
{
|
{
|
||||||
|
if(empty($versions))
|
||||||
|
return array();
|
||||||
|
|
||||||
$targets = array();
|
$targets = array();
|
||||||
|
|
||||||
if( ! empty($versions) AND $versions = explode(',', $versions))
|
if( ! is_array($versions))
|
||||||
{
|
{
|
||||||
foreach($versions as $version)
|
$versions = explode(',', trim($versions));
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach($versions as $version)
|
||||||
|
{
|
||||||
|
$target = $this->_parse_version($version);
|
||||||
|
|
||||||
|
if(is_array($target))
|
||||||
{
|
{
|
||||||
$target = $this->_parse_version($version);
|
list($location, $version) = $target;
|
||||||
|
|
||||||
if(is_array($target))
|
$targets[$location] = $version;
|
||||||
{
|
}
|
||||||
list($location, $version) = $target;
|
else
|
||||||
|
{
|
||||||
$targets[$location] = $version;
|
$this->_default_direction = $target;
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$this->_default_direction = $target;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -157,6 +165,9 @@ class Minion_Task_Db_Migrate extends Minion_Task
|
||||||
*/
|
*/
|
||||||
protected function _parse_version($version)
|
protected function _parse_version($version)
|
||||||
{
|
{
|
||||||
|
if(is_bool($version))
|
||||||
|
return $version;
|
||||||
|
|
||||||
if($version === 'TRUE' OR $version == FALSE)
|
if($version === 'TRUE' OR $version == FALSE)
|
||||||
return $version === 'TRUE';
|
return $version === 'TRUE';
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue