Fix incorrect migration notes for extensions without any migrations

When running migrations for an extension without any migrations (eg.
BBCode), the migration notes for the previous extension were being
displayed, because the Migrator never had a chance to clear them.
This commit is contained in:
Toby Zerner 2017-07-22 11:43:50 +09:30
parent 54be3ad3c8
commit 4f3e67714e
2 changed files with 7 additions and 4 deletions

View File

@ -219,6 +219,7 @@ class ExtensionManager
*
* @param Extension $extension
* @param bool|true $up
* @return array Notes from the migrator.
*/
public function migrate(Extension $extension, $up = true)
{
@ -234,7 +235,11 @@ class ExtensionManager
} else {
$this->migrator->reset($migrationDir, $extension);
}
return $this->migrator->getNotes();
}
return [];
}
/**

View File

@ -69,8 +69,6 @@ class MigrateCommand extends AbstractCommand
$extensions = $this->container->make('Flarum\Extension\ExtensionManager');
$migrator = $extensions->getMigrator();
foreach ($extensions->getExtensions() as $name => $extension) {
if (! $extension->isEnabled()) {
continue;
@ -78,9 +76,9 @@ class MigrateCommand extends AbstractCommand
$this->info('Migrating extension: '.$name);
$extensions->migrate($extension);
$notes = $extensions->migrate($extension);
foreach ($migrator->getNotes() as $note) {
foreach ($notes as $note) {
$this->info($note);
}
}