Fix clear cache, update storage paths
This commit is contained in:
parent
0990487359
commit
9a616b6174
|
|
@ -9,12 +9,13 @@ $writablePaths = [
|
|||
$uploadsDir,
|
||||
$uploadsDir.'/public',
|
||||
$uploadsDir.'/protected',
|
||||
'/app/storage',
|
||||
'/app/storage/logs',
|
||||
'/app/storage/cache',
|
||||
'/app/storage/twig',
|
||||
'/app/storage/meta',
|
||||
'/app/storage/combiner',
|
||||
'/storage',
|
||||
'/storage/logs',
|
||||
'/storage/framework',
|
||||
'/storage/cms',
|
||||
'/storage/cms/cache',
|
||||
'/storage/cms/twig',
|
||||
'/storage/cms/combiner',
|
||||
];
|
||||
$requiredExtensions = [
|
||||
'GD' => extension_loaded('gd'),
|
||||
|
|
|
|||
|
|
@ -174,7 +174,7 @@ class CodeParser
|
|||
protected function getFilePath()
|
||||
{
|
||||
$hash = abs(crc32($this->filePath));
|
||||
$result = storage_path().'/cache/';
|
||||
$result = storage_path().'/cms/cache/';
|
||||
$result .= substr($hash, 0, 2).'/';
|
||||
$result .= substr($hash, 2, 2).'/';
|
||||
$result .= basename($this->filePath).'.php';
|
||||
|
|
|
|||
|
|
@ -361,7 +361,7 @@ class Controller
|
|||
'debug' => $isDebugMode,
|
||||
];
|
||||
if (!Config::get('cms.twigNoCache')) {
|
||||
$options['cache'] = storage_path().'/twig';
|
||||
$options['cache'] = storage_path().'/cms/twig';
|
||||
}
|
||||
|
||||
$this->twig = new Twig_Environment($this->loader, $options);
|
||||
|
|
|
|||
|
|
@ -38,11 +38,6 @@ class ServiceProvider extends ModuleServiceProvider
|
|||
*/
|
||||
parent::register('system');
|
||||
|
||||
/*
|
||||
* Register core providers
|
||||
*/
|
||||
// App::register('October\Rain\Translation\TranslationServiceProvider');
|
||||
|
||||
/*
|
||||
* Define path constants
|
||||
*/
|
||||
|
|
@ -121,7 +116,7 @@ class ServiceProvider extends ModuleServiceProvider
|
|||
/*
|
||||
* Register basic Twig
|
||||
*/
|
||||
App::bindShared('twig', function ($app) {
|
||||
App::singleton('twig', function ($app) {
|
||||
$twig = new Twig_Environment(new TwigLoader(), ['auto_reload' => true]);
|
||||
$twig->addExtension(new TwigExtension);
|
||||
return $twig;
|
||||
|
|
@ -137,7 +132,7 @@ class ServiceProvider extends ModuleServiceProvider
|
|||
/*
|
||||
* Register Twig that will parse strings
|
||||
*/
|
||||
App::bindShared('twig.string', function ($app) {
|
||||
App::singleton('twig.string', function ($app) {
|
||||
$twig = $app['twig'];
|
||||
$twig->setLoader(new Twig_Loader_String);
|
||||
return $twig;
|
||||
|
|
@ -321,6 +316,13 @@ class ServiceProvider extends ModuleServiceProvider
|
|||
]);
|
||||
});
|
||||
|
||||
/*
|
||||
* Override clear cache command
|
||||
*/
|
||||
App::singleton('command.cache.clear', function ($app) {
|
||||
return new \System\Console\CacheClear($app['cache'], $app['files']);
|
||||
});
|
||||
|
||||
/*
|
||||
* Register console commands
|
||||
*/
|
||||
|
|
@ -332,13 +334,6 @@ class ServiceProvider extends ModuleServiceProvider
|
|||
$this->registerConsoleCommand('plugin.remove', 'System\Console\PluginRemove');
|
||||
$this->registerConsoleCommand('plugin.refresh', 'System\Console\PluginRefresh');
|
||||
|
||||
/*
|
||||
* Override clear cache command
|
||||
*/
|
||||
App::bindShared('command.cache.clear', function ($app) {
|
||||
return new \System\Console\CacheClear($app['cache'], $app['files']);
|
||||
});
|
||||
|
||||
/*
|
||||
* Register the sidebar for the System main menu
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -171,7 +171,7 @@ class CombineAssets
|
|||
}
|
||||
|
||||
$this->path = $cacheInfo['path'];
|
||||
$this->storagePath = storage_path().'/combiner/cms';
|
||||
$this->storagePath = storage_path().'/cms/combiner';
|
||||
|
||||
$combiner = $this->prepareCombiner($cacheInfo['files']);
|
||||
$contents = $combiner->dump();
|
||||
|
|
@ -278,7 +278,7 @@ class CombineAssets
|
|||
}
|
||||
|
||||
$this->path = public_path().$path;
|
||||
$this->storagePath = storage_path().'/combiner/cms';
|
||||
$this->storagePath = storage_path().'/cms/combiner';
|
||||
|
||||
list($assets, $extension) = $this->prepareAssets($assets);
|
||||
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ class PluginManager
|
|||
/**
|
||||
* @var string Path to the disarm file.
|
||||
*/
|
||||
protected $metaPath;
|
||||
protected $metaFile;
|
||||
|
||||
/**
|
||||
* @var array Collection of disabled plugins
|
||||
|
|
@ -67,7 +67,7 @@ class PluginManager
|
|||
protected function init()
|
||||
{
|
||||
$this->app = App::make('app');
|
||||
$this->metaPath = Config::get('app.manifest');
|
||||
$this->metaFile = storage_path() . '/cms/disabled.json';
|
||||
$this->loadDisabled();
|
||||
$this->loadPlugins();
|
||||
$this->loadDependencies();
|
||||
|
|
@ -369,7 +369,7 @@ class PluginManager
|
|||
|
||||
public function clearDisabledCache()
|
||||
{
|
||||
File::delete($this->metaPath.'/disabled.json');
|
||||
File::delete($this->metaFile);
|
||||
$this->disabledPlugins = [];
|
||||
}
|
||||
|
||||
|
|
@ -378,7 +378,7 @@ class PluginManager
|
|||
*/
|
||||
protected function loadDisabled()
|
||||
{
|
||||
$path = $this->metaPath.'/disabled.json';
|
||||
$path = $this->metaFile;
|
||||
|
||||
if (($configDisabled = Config::get('cms.disablePlugins')) && is_array($configDisabled)) {
|
||||
foreach ($configDisabled as $disabled) {
|
||||
|
|
@ -413,7 +413,7 @@ class PluginManager
|
|||
*/
|
||||
protected function writeDisabled()
|
||||
{
|
||||
$path = $this->metaPath.'/disabled.json';
|
||||
$path = $this->metaFile;
|
||||
File::put($path, json_encode($this->disabledPlugins));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,14 +4,39 @@ use App;
|
|||
use Config;
|
||||
use Illuminate\Cache\Console\ClearCommand;
|
||||
use Symfony\Component\Console\Output\NullOutput;
|
||||
use Illuminate\Cache\CacheManager;
|
||||
use Illuminate\Filesystem\Filesystem;
|
||||
|
||||
class CacheClear extends ClearCommand
|
||||
{
|
||||
/**
|
||||
* The file system instance.
|
||||
*
|
||||
* @var \Illuminate\Filesystem\Filesystem
|
||||
*/
|
||||
protected $files;
|
||||
|
||||
/**
|
||||
* Create a new cache clear command instance.
|
||||
*
|
||||
* @param \Illuminate\Cache\CacheManager $cache
|
||||
* @param \Illuminate\Filesystem\Filesystem $files
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(CacheManager $cache, Filesystem $files)
|
||||
{
|
||||
parent::__construct($cache);
|
||||
|
||||
$this->files = $files;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*/
|
||||
public function fire()
|
||||
{
|
||||
$storagePath = $this->laravel->storagePath();
|
||||
|
||||
/*
|
||||
* Allow this command to be executed internally
|
||||
*/
|
||||
|
|
@ -22,16 +47,24 @@ class CacheClear extends ClearCommand
|
|||
/*
|
||||
* Combiner
|
||||
*/
|
||||
foreach ($this->files->directories(storage_path().'/combiner') as $directory) {
|
||||
foreach ($this->files->directories($storagePath.'/cms/combiner') as $directory) {
|
||||
$this->files->deleteDirectory($directory);
|
||||
}
|
||||
$this->info('Combiner cache cleared!');
|
||||
|
||||
/*
|
||||
* Combiner
|
||||
*/
|
||||
foreach ($this->files->directories($storagePath.'/cms/cache') as $directory) {
|
||||
$this->files->deleteDirectory($directory);
|
||||
}
|
||||
$this->info('CMS cache cleared!');
|
||||
|
||||
/*
|
||||
* Twig
|
||||
*/
|
||||
if (!Config::get('cms.twigNoCache')) {
|
||||
foreach ($this->files->directories(storage_path().'/twig') as $directory) {
|
||||
foreach ($this->files->directories($storagePath.'/cms/twig') as $directory) {
|
||||
$this->files->deleteDirectory($directory);
|
||||
}
|
||||
$this->info('Twig cache cleared!');
|
||||
|
|
@ -40,7 +73,7 @@ class CacheClear extends ClearCommand
|
|||
/*
|
||||
* Meta
|
||||
*/
|
||||
$this->files->delete($this->laravel['config']['app.manifest'].'/disabled.json');
|
||||
$this->files->delete($storagePath.'/cms/disabled.json');
|
||||
|
||||
parent::fire();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,6 @@
|
|||
config.php
|
||||
routes.php
|
||||
compiled.php
|
||||
services.json
|
||||
events.scanned.php
|
||||
routes.scanned.php
|
||||
Loading…
Reference in New Issue