Skip to content

Commit

Permalink
clear cache files from storage/views (#2648)
Browse files Browse the repository at this point in the history
Co-authored-by: Emamul Khan <emamul.khan@oxid-esales.com>
  • Loading branch information
emamulkhan and Emamul Khan authored Mar 1, 2021
1 parent f0c6050 commit 7fa22a1
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
25 changes: 24 additions & 1 deletion src/Extend/View.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [];

Expand Down Expand Up @@ -48,4 +49,26 @@ public function extend(Container $container, Extension $extension = null)
}
});
}

/**
* @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/*'));
}
}
1 change: 1 addition & 0 deletions src/Foundation/Console/CacheClearCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ protected function fire()
$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);
}
Expand Down

0 comments on commit 7fa22a1

Please sign in to comment.