1
0
mirror of https://github.com/flarum/core.git synced 2025-10-14 00:15:51 +02:00

Split SessionServiceProvider from UserServiceProvider

This lets us register the former during installation, where the
latter is not yet registered.

That, in turn, means we can finally re-enable the StartSession
middleware in the installer app, which we need to log in the new
admin user when installation is complete.
This commit is contained in:
Franz Liedke
2018-08-14 23:30:49 +02:00
parent 32ad926cbc
commit fb5740926a
6 changed files with 42 additions and 17 deletions

View File

@@ -15,9 +15,7 @@ use Flarum\Event\ConfigureUserPreferences;
use Flarum\Event\GetPermission;
use Flarum\Foundation\AbstractServiceProvider;
use Illuminate\Contracts\Container\Container;
use Illuminate\Session\FileSessionHandler;
use RuntimeException;
use SessionHandlerInterface;
class UserServiceProvider extends AbstractServiceProvider
{
@@ -26,24 +24,10 @@ class UserServiceProvider extends AbstractServiceProvider
*/
public function register()
{
$this->registerSession();
$this->registerGate();
$this->registerAvatarsFilesystem();
}
protected function registerSession()
{
$this->app->singleton('session.handler', function ($app) {
return new FileSessionHandler(
$app['files'],
$app['config']['session.files'],
$app['config']['session.lifetime']
);
});
$this->app->alias('session.handler', SessionHandlerInterface::class);
}
protected function registerGate()
{
$this->app->singleton('flarum.gate', function ($app) {