Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clear cache files from storage/views #2648

Merged
merged 1 commit into from
Mar 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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