mirror of
https://github.com/flarum/core.git
synced 2025-10-20 03:06:07 +02:00
Merge branch 'master' into 1236-database-changes
This commit is contained in:
35
src/User/SessionServiceProvider.php
Normal file
35
src/User/SessionServiceProvider.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Flarum.
|
||||
*
|
||||
* (c) Toby Zerner <toby.zerner@gmail.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Flarum\User;
|
||||
|
||||
use Flarum\Foundation\AbstractServiceProvider;
|
||||
use Illuminate\Session\FileSessionHandler;
|
||||
use SessionHandlerInterface;
|
||||
|
||||
class SessionServiceProvider extends AbstractServiceProvider
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
$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);
|
||||
}
|
||||
}
|
@@ -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