Skip to content

Commit

Permalink
Make site extenders run after extensions
Browse files Browse the repository at this point in the history
Fixes #1708.
  • Loading branch information
franzliedke committed Dec 19, 2018
1 parent 209d13a commit ba594de
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/Extension/ExtensionServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function register()
// Boot extensions when the app is booting. This must be done as a boot
// listener on the app rather than in the service provider's boot method
// below, so that extensions have a chance to register things on the
// container before the core boot code runs.
// container before the core boots up (and starts resolving services).
$this->app->booting(function (Container $app) {
$app->make('flarum.extensions')->extend($app);
});
Expand Down
12 changes: 9 additions & 3 deletions src/Foundation/InstalledSite.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
use Illuminate\Config\Repository as ConfigRepository;
use Illuminate\Contracts\Cache\Repository;
use Illuminate\Contracts\Cache\Store;
use Illuminate\Contracts\Container\Container;
use Illuminate\Filesystem\Filesystem;
use Illuminate\Filesystem\FilesystemServiceProvider;
use Illuminate\Hashing\HashServiceProvider;
Expand Down Expand Up @@ -146,9 +147,14 @@ private function bootLaravel(): Application

$laravel->register(ExtensionServiceProvider::class);

foreach ($this->extenders as $extension) {
$extension->extend($laravel);
}
$laravel->booting(function (Container $app) {
// Run all local-site extenders before booting service providers
// (but after those from "real" extensions, which have been set up
// in a service provider above).
foreach ($this->extenders as $extension) {
$extension->extend($app);
}
});

$laravel->boot();

Expand Down

2 comments on commit ba594de

@luceos
Copy link
Member

@luceos luceos commented on ba594de Dec 20, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh 🤦‍♂️ good solution @franzliedke 👍

@franzliedke
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, I hope it actually works. 😁

Still have tests for this behavior on my list for when we have infrastructure to test extender behavior (that's also on my list).

Please sign in to comment.