diff --git a/src/Extend/View.php b/src/Extend/View.php index fd00ba2f6..8850d96db 100644 --- a/src/Extend/View.php +++ b/src/Extend/View.php @@ -10,10 +10,11 @@ namespace Flarum\Extend; use Flarum\Extension\Extension; +use Flarum\Foundation\Paths; use Illuminate\Contracts\Container\Container; use Illuminate\Contracts\View\Factory; -class View implements ExtenderInterface +class View implements ExtenderInterface, LifecycleInterface { private $namespaces = []; @@ -48,4 +49,26 @@ class View implements ExtenderInterface } }); } + + /** + * @param Container $container + * @param Extension $extension + * @throws \Illuminate\Contracts\Container\BindingResolutionException + */ + public function onEnable(Container $container, Extension $extension) + { + $storagePath = $container->make(Paths::class)->storage; + array_map('unlink', glob($storagePath.'/views/*')); + } + + /** + * @param Container $container + * @param Extension $extension + * @throws \Illuminate\Contracts\Container\BindingResolutionException + */ + public function onDisable(Container $container, Extension $extension) + { + $storagePath = $container->make(Paths::class)->storage; + array_map('unlink', glob($storagePath.'/views/*')); + } } diff --git a/src/Foundation/Console/CacheClearCommand.php b/src/Foundation/Console/CacheClearCommand.php index 1229f74fa..5659976b2 100644 --- a/src/Foundation/Console/CacheClearCommand.php +++ b/src/Foundation/Console/CacheClearCommand.php @@ -60,6 +60,7 @@ class CacheClearCommand extends AbstractCommand $storagePath = $this->paths->storage; array_map('unlink', glob($storagePath.'/formatter/*')); array_map('unlink', glob($storagePath.'/locale/*')); + array_map('unlink', glob($storagePath.'/views/*')); event(new ClearingCache); }