From 07856bd53ea1ba1d56532e5539c845060cd9f692 Mon Sep 17 00:00:00 2001 From: Toby Zerner Date: Thu, 18 Jun 2015 17:46:49 +0930 Subject: [PATCH] Load extensions after other service providers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit And let them know what kind of request this is via a “type” binding on the container. Not sure if there is a better way to do this. But they need to know somehow, so extenders can act selectively (e.g. the ForumClient extender should only act on forum requests, not on API or admin requests) --- admin.php | 2 ++ api.php | 2 ++ index.php | 2 ++ system/config/app.php | 1 - 4 files changed, 6 insertions(+), 1 deletion(-) diff --git a/admin.php b/admin.php index 8f8f0d9..d60bd33 100644 --- a/admin.php +++ b/admin.php @@ -9,7 +9,9 @@ use Zend\Stratigility\MiddlewarePipe; $app = require __DIR__.'/system/bootstrap.php'; // Set up everything we need for the frontend +$app->instance('type', 'admin'); $app->register('Flarum\Admin\AdminServiceProvider'); +$app->register('Flarum\Support\Extensions\ExtensionsServiceProvider'); $admin = new MiddlewarePipe(); $admin->pipe($app->make('Flarum\Admin\Middleware\LoginWithCookieAndCheckAdmin')); diff --git a/api.php b/api.php index cb0b109..d690818 100644 --- a/api.php +++ b/api.php @@ -9,7 +9,9 @@ use Zend\Stratigility\MiddlewarePipe; $app = require __DIR__.'/system/bootstrap.php'; // Set up everything we need for the API +$app->instance('type', 'api'); $app->register('Flarum\Api\ApiServiceProvider'); +$app->register('Flarum\Support\Extensions\ExtensionsServiceProvider'); // Build a middleware pipeline for the API $api = new MiddlewarePipe(); diff --git a/index.php b/index.php index 31d5901..0068614 100644 --- a/index.php +++ b/index.php @@ -9,7 +9,9 @@ use Zend\Stratigility\MiddlewarePipe; $app = require __DIR__.'/system/bootstrap.php'; // Set up everything we need for the frontend +$app->instance('type', 'forum'); $app->register('Flarum\Forum\ForumServiceProvider'); +$app->register('Flarum\Support\Extensions\ExtensionsServiceProvider'); // Build a middleware pipeline for Flarum $flarum = new MiddlewarePipe(); diff --git a/system/config/app.php b/system/config/app.php index ed54dd2..41820cc 100644 --- a/system/config/app.php +++ b/system/config/app.php @@ -133,7 +133,6 @@ return [ 'Illuminate\View\ViewServiceProvider', 'Flarum\Core\CoreServiceProvider', - 'Flarum\Support\Extensions\ExtensionsServiceProvider', 'Flarum\Console\ConsoleServiceProvider',