Skip to content

Commit 1a4f30b

Browse files
committed
fix(extensions): re-sort extension order during migrate
After a composer update, new or changed optional-dependencies in an extension's composer.json are not reflected in the stored boot order until the extension is manually disabled and re-enabled. The migrate command now calls syncExtensionOrder() before running extension migrations, re-sorting and persisting the enabled extension list based on the current composer.json declarations.
1 parent 57ed2e4 commit 1a4f30b

2 files changed

Lines changed: 16 additions & 0 deletions

File tree

framework/core/src/Database/Console/MigrateCommand.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@ public function upgrade(): void
6161
$extensions = $this->container->make(ExtensionManager::class);
6262
$extensions->getMigrator()->setOutput($this->output);
6363

64+
// Re-sort and persist the enabled extension order so that any optional-dependencies
65+
// added or changed since the last enable/disable cycle take effect immediately.
66+
$extensions->syncExtensionOrder();
67+
6468
foreach ($extensions->getEnabledExtensions() as $name => $extension) {
6569
if ($extension->hasMigrations()) {
6670
$this->info('Migrating extension: '.$name);

framework/core/src/Extension/ExtensionManager.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,18 @@ public function getEnabled(): array
348348
return json_decode($this->config->get('extensions_enabled'), true) ?? [];
349349
}
350350

351+
/**
352+
* Re-sort and persist the enabled extension order based on current composer.json dependency
353+
* declarations. Call this after a composer update so that any new or changed
354+
* optional-dependencies are reflected without requiring a manual enable/disable cycle.
355+
*
356+
* @throws CircularDependenciesException
357+
*/
358+
public function syncExtensionOrder(): void
359+
{
360+
$this->setEnabledExtensions($this->getEnabledExtensions());
361+
}
362+
351363
/**
352364
* Persist the currently enabled extensions.
353365
*

0 commit comments

Comments
 (0)