mirror of
https://github.com/flarum/core.git
synced 2025-10-13 07:54:25 +02:00
@@ -14,7 +14,6 @@ namespace Flarum\Extension;
|
||||
use Flarum\Extension\Event\Disabling;
|
||||
use Flarum\Http\Exception\ForbiddenException;
|
||||
use Flarum\Settings\SettingsRepositoryInterface;
|
||||
use Illuminate\Contracts\Events\Dispatcher;
|
||||
|
||||
class DefaultLanguagePackGuard
|
||||
{
|
||||
@@ -28,19 +27,7 @@ class DefaultLanguagePackGuard
|
||||
$this->settings = $settings;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Dispatcher $events
|
||||
*/
|
||||
public function subscribe(Dispatcher $events)
|
||||
{
|
||||
$events->listen(Disabling::class, [$this, 'whenExtensionWillBeDisabled']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Disabling $event
|
||||
* @throws ForbiddenException
|
||||
*/
|
||||
public function whenExtensionWillBeDisabled(Disabling $event)
|
||||
public function handle(Disabling $event)
|
||||
{
|
||||
if (! in_array('flarum-locale', $event->extension->extra)) {
|
||||
return;
|
||||
|
@@ -11,6 +11,7 @@
|
||||
|
||||
namespace Flarum\Extension;
|
||||
|
||||
use Flarum\Extension\Event\Disabling;
|
||||
use Flarum\Foundation\AbstractServiceProvider;
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
|
||||
@@ -38,8 +39,9 @@ class ExtensionServiceProvider extends AbstractServiceProvider
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
$events = $this->app->make('events');
|
||||
|
||||
$events->subscribe(DefaultLanguagePackGuard::class);
|
||||
$this->app->make('events')->listen(
|
||||
Disabling::class,
|
||||
DefaultLanguagePackGuard::class
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user