1
0
mirror of https://github.com/flarum/core.git synced 2025-07-20 16:21:18 +02:00

Move events to Flarum\Settings\Event namespace

This commit is contained in:
Franz Liedke
2017-06-24 13:16:02 +02:00
parent a39103a472
commit 5a6d28f8a7
7 changed files with 16 additions and 16 deletions

View File

@@ -13,7 +13,7 @@ namespace Flarum\Admin;
use Flarum\Event\ExtensionWasDisabled; use Flarum\Event\ExtensionWasDisabled;
use Flarum\Event\ExtensionWasEnabled; use Flarum\Event\ExtensionWasEnabled;
use Flarum\Event\SettingWasSet; use Flarum\Settings\Event\Saved;
use Flarum\Foundation\AbstractServiceProvider; use Flarum\Foundation\AbstractServiceProvider;
use Flarum\Http\Handler\RouteHandlerFactory; use Flarum\Http\Handler\RouteHandlerFactory;
use Flarum\Http\RouteCollection; use Flarum\Http\RouteCollection;
@@ -63,7 +63,7 @@ class AdminServiceProvider extends AbstractServiceProvider
protected function flushWebAppAssetsWhenThemeChanged() protected function flushWebAppAssetsWhenThemeChanged()
{ {
$this->app->make('events')->listen(SettingWasSet::class, function (SettingWasSet $event) { $this->app->make('events')->listen(Saved::class, function (Saved $event) {
if (preg_match('/^theme_|^custom_less$/i', $event->key)) { if (preg_match('/^theme_|^custom_less$/i', $event->key)) {
$this->getWebAppAssets()->flushCss(); $this->getWebAppAssets()->flushCss();
} }

View File

@@ -13,7 +13,7 @@ namespace Flarum\Admin\Controller;
use Flarum\Admin\Frontend; use Flarum\Admin\Frontend;
use Flarum\Core\Permission; use Flarum\Core\Permission;
use Flarum\Event\PrepareUnserializedSettings; use Flarum\Settings\Event\Deserializing;
use Flarum\Extension\ExtensionManager; use Flarum\Extension\ExtensionManager;
use Flarum\Frontend\AbstractFrontendController; use Flarum\Frontend\AbstractFrontendController;
use Flarum\Settings\SettingsRepositoryInterface; use Flarum\Settings\SettingsRepositoryInterface;
@@ -56,7 +56,7 @@ class FrontendController extends AbstractFrontendController
$settings = $this->settings->all(); $settings = $this->settings->all();
$this->events->fire( $this->events->fire(
new PrepareUnserializedSettings($settings) new Deserializing($settings)
); );
$view->setVariable('settings', $settings); $view->setVariable('settings', $settings);

View File

@@ -12,8 +12,8 @@
namespace Flarum\Api\Controller; namespace Flarum\Api\Controller;
use Flarum\Core\Access\AssertPermissionTrait; use Flarum\Core\Access\AssertPermissionTrait;
use Flarum\Event\PrepareSerializedSetting; use Flarum\Settings\Event\Serializing;
use Flarum\Event\SettingWasSet; use Flarum\Settings\Event\Saved;
use Flarum\Http\Controller\ControllerInterface; use Flarum\Http\Controller\ControllerInterface;
use Flarum\Settings\SettingsRepositoryInterface; use Flarum\Settings\SettingsRepositoryInterface;
use Illuminate\Contracts\Events\Dispatcher; use Illuminate\Contracts\Events\Dispatcher;
@@ -53,11 +53,11 @@ class SetSettingsController implements ControllerInterface
$settings = $request->getParsedBody(); $settings = $request->getParsedBody();
foreach ($settings as $k => $v) { foreach ($settings as $k => $v) {
$this->dispatcher->fire(new PrepareSerializedSetting($k, $v)); $this->dispatcher->fire(new Serializing($k, $v));
$this->settings->set($k, $v); $this->settings->set($k, $v);
$this->dispatcher->fire(new SettingWasSet($k, $v)); $this->dispatcher->fire(new Saved($k, $v));
} }
return new EmptyResponse(204); return new EmptyResponse(204);

View File

@@ -14,7 +14,7 @@ namespace Flarum\Forum;
use Flarum\Event\ConfigureForumRoutes; use Flarum\Event\ConfigureForumRoutes;
use Flarum\Event\ExtensionWasDisabled; use Flarum\Event\ExtensionWasDisabled;
use Flarum\Event\ExtensionWasEnabled; use Flarum\Event\ExtensionWasEnabled;
use Flarum\Event\SettingWasSet; use Flarum\Settings\Event\Saved;
use Flarum\Foundation\AbstractServiceProvider; use Flarum\Foundation\AbstractServiceProvider;
use Flarum\Http\Handler\RouteHandlerFactory; use Flarum\Http\Handler\RouteHandlerFactory;
use Flarum\Http\RouteCollection; use Flarum\Http\RouteCollection;
@@ -82,7 +82,7 @@ class ForumServiceProvider extends AbstractServiceProvider
protected function flushWebAppAssetsWhenThemeChanged() protected function flushWebAppAssetsWhenThemeChanged()
{ {
$this->app->make('events')->listen(SettingWasSet::class, function (SettingWasSet $event) { $this->app->make('events')->listen(Saved::class, function (Saved $event) {
if (preg_match('/^theme_|^custom_less$/i', $event->key)) { if (preg_match('/^theme_|^custom_less$/i', $event->key)) {
$this->getWebAppAssets()->flushCss(); $this->getWebAppAssets()->flushCss();
} }

View File

@@ -9,7 +9,7 @@
* file that was distributed with this source code. * file that was distributed with this source code.
*/ */
namespace Flarum\Event; namespace Flarum\Settings\Event;
/** /**
* Prepare settings for display in the client. * Prepare settings for display in the client.
@@ -17,7 +17,7 @@ namespace Flarum\Event;
* This event is fired when settings have been retrieved from the database and * This event is fired when settings have been retrieved from the database and
* are being unserialized for display in the client. * are being unserialized for display in the client.
*/ */
class PrepareUnserializedSettings class Deserializing
{ {
/** /**
* The settings array to be unserialized. * The settings array to be unserialized.

View File

@@ -9,9 +9,9 @@
* file that was distributed with this source code. * file that was distributed with this source code.
*/ */
namespace Flarum\Event; namespace Flarum\Settings\Event;
class SettingWasSet class Saved
{ {
/** /**
* The setting key that was set. * The setting key that was set.

View File

@@ -9,9 +9,9 @@
* file that was distributed with this source code. * file that was distributed with this source code.
*/ */
namespace Flarum\Event; namespace Flarum\Settings\Event;
class PrepareSerializedSetting class Serializing
{ {
/** /**
* The settings key being saved. * The settings key being saved.