diff --git a/composer.json b/composer.json index 1ee4195f0e..5bfcb2a57d 100644 --- a/composer.json +++ b/composer.json @@ -46,6 +46,7 @@ "nikic/fast-route": "^0.6", "oyejorge/less.php": "~1.5", "psr/http-message": "^1.0", + "symfony/config": "^2.7", "symfony/console": "^2.7", "symfony/http-foundation": "^2.7", "symfony/translation": "^2.7", diff --git a/src/Debug/Console/CacheClearCommand.php b/src/Debug/Console/CacheClearCommand.php index cf8e4b4668..97142ad6e4 100644 --- a/src/Debug/Console/CacheClearCommand.php +++ b/src/Debug/Console/CacheClearCommand.php @@ -14,35 +14,43 @@ use Flarum\Admin\WebApp as AdminWebApp; use Flarum\Console\Command\AbstractCommand; use Flarum\Forum\WebApp as ForumWebApp; +use Flarum\Foundation\Application; use Illuminate\Contracts\Cache\Store; class CacheClearCommand extends AbstractCommand { /** - * @var \Illuminate\Contracts\Cache\Store + * @var Store */ protected $cache; /** - * @var \Flarum\Forum\WebApp + * @var ForumWebApp */ protected $forum; /** - * @var \Flarum\Admin\WebApp + * @var AdminWebApp */ protected $admin; + /** + * @var Application + */ + protected $app; + /** * @param Store $cache * @param ForumWebApp $forum * @param AdminWebApp $admin + * @param Application $app */ - public function __construct(Store $cache, ForumWebApp $forum, AdminWebApp $admin) + public function __construct(Store $cache, ForumWebApp $forum, AdminWebApp $admin, Application $app) { $this->cache = $cache; $this->forum = $forum; $this->admin = $admin; + $this->app = $app; parent::__construct(); } @@ -68,5 +76,9 @@ protected function fire() $this->admin->getAssets()->flush(); $this->cache->flush(); + + $storagePath = $this->app->storagePath(); + array_map('unlink', glob($storagePath.'/formatter/*')); + array_map('unlink', glob($storagePath.'/locale/*')); } } diff --git a/src/Locale/LocaleServiceProvider.php b/src/Locale/LocaleServiceProvider.php index 034e21a1c6..3e038950bc 100644 --- a/src/Locale/LocaleServiceProvider.php +++ b/src/Locale/LocaleServiceProvider.php @@ -41,7 +41,7 @@ public function register() $this->app->singleton('translator', function () { $defaultLocale = $this->getDefaultLocale(); - $translator = new Translator($defaultLocale, new MessageSelector()); + $translator = new Translator($defaultLocale, null, $this->app->storagePath().'/locale', $this->app->inDebugMode()); $translator->setFallbackLocales([$defaultLocale, 'en']); $translator->addLoader('prefixed_yaml', new PrefixedYamlFileLoader());