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:
@@ -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) {
|
||||
|
Reference in New Issue
Block a user