Skip to content

Commit

Permalink
clear cache files from storage/views
Browse files Browse the repository at this point in the history
  • Loading branch information
Emamul Khan committed Mar 1, 2021
1 parent 023871e commit 6c867ce
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 6c867ce

Please sign in to comment.