chg: [migration] Added support of plugin migrations

pull/72/head
mokaddem 2021-09-03 09:47:13 +02:00
parent 0458bbc76f
commit 8df647cdb9
2 changed files with 16 additions and 0 deletions

View File

@ -9,6 +9,8 @@ use Migrations\Migrations;
class InstanceTable extends AppTable class InstanceTable extends AppTable
{ {
protected $activePlugins = ['Tags'];
public function initialize(array $config): void public function initialize(array $config): void
{ {
parent::initialize($config); parent::initialize($config);
@ -23,6 +25,16 @@ class InstanceTable extends AppTable
{ {
$migrations = new Migrations(); $migrations = new Migrations();
$status = $migrations->status(); $status = $migrations->status();
foreach ($this->activePlugins as $pluginName) {
$pluginStatus = $migrations->status([
'plugin' => $pluginName
]);
$pluginStatus = array_map(function ($entry) use ($pluginName) {
$entry['plugin'] = $pluginName;
return $entry;
}, $pluginStatus);
$status = array_merge($status, $pluginStatus);
}
$status = array_reverse($status); $status = array_reverse($status);
$updateAvailables = array_filter($status, function ($update) { $updateAvailables = array_filter($status, function ($update) {

View File

@ -27,6 +27,10 @@ foreach ($status as $i => &$update) {
} else if ($update['status'] == 'down') { } else if ($update['status'] == 'down') {
$update['_rowVariant'] = 'danger'; $update['_rowVariant'] = 'danger';
} }
if (!empty($update['plugin'])) {
$update['name'] = "{$update['plugin']}.{$update['name']}";
}
} }
echo $this->Bootstrap->table([], [ echo $this->Bootstrap->table([], [