Skip to content
This repository was archived by the owner on Sep 18, 2024. It is now read-only.

Commit a07ca58

Browse files
author
Gleez Technologies
committed
Update feature: Minor refactor to minion module
1 parent 7cbf731 commit a07ca58

4 files changed

Lines changed: 15 additions & 7 deletions

File tree

modules/minion/classes/migration.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,13 @@ class Migration {
4444
* @param Database $db The database connection that should be passed to migrations
4545
* @param Model_Migration $model Inject an instance of the minion model into the manager
4646
*/
47-
public function __construct(Database $db, Model_Migration $model = NULL)
47+
public function __construct($db = NULL, Model_Migration $model = NULL)
4848
{
49+
if($db == NULL)
50+
{
51+
$db = Database::instance(NULL);
52+
}
53+
4954
if ($model === NULL)
5055
{
5156
$model = new Model_Migration($db);

modules/minion/classes/model/migration.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,13 @@ class Model_Migration extends Model
2323
*
2424
* @param Kohana_Database $db Database connection to use
2525
*/
26-
public function __construct(Database $db)
26+
public function __construct($db = NULL)
2727
{
28+
if($db == NULL)
29+
{
30+
$db = Database::instance(NULL);
31+
}
32+
2833
$this->_db = $db;
2934

3035
$this->_table = Config::get('migration.table', 'migrations');

modules/minion/classes/task/db/migrate.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,10 @@ protected function _execute(array $options)
9393
}
9494
}
9595

96-
$db = Database::instance();
97-
$model = new Model_Migration($db);
98-
96+
$model = new Model_Migration();
9997
$model->ensure_table_exists();
10098

101-
$manager = new Migration($db, $model);
99+
$manager = new Migration(NULL, $model);
102100

103101
// Sync the available migrations with those in the db
104102
$manager

modules/minion/classes/task/db/migrate/status.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class Task_Db_Migrate_Status extends Minion_Task
1717
*/
1818
protected function _execute(array $options)
1919
{
20-
$model = new Model_Migration(Database::instance());
20+
$model = new Model_Migration();
2121
$view = new View('minion/db/status');
2222

2323
$view->groups = $model->get_group_statuses();

0 commit comments

Comments
 (0)