mirror of
https://github.com/getgrav/grav.git
synced 2026-07-05 09:18:43 +02:00
option to configure image cache clearing #1481
This commit is contained in:
@@ -2,7 +2,8 @@
|
||||
## 07/xx/2017
|
||||
|
||||
1. [](#new)
|
||||
* Added a new `cache-control` system and page level property [#1591](https://github.com/getgrav/grav/issues/1591)
|
||||
* Added a new `cache_control` system and page level property [#1591](https://github.com/getgrav/grav/issues/1591)
|
||||
* Added a new `clear_images_by_default` system property to stop cache clear events from removing processed images [#1481](https://github.com/getgrav/grav/pull/1481)
|
||||
|
||||
# v1.3.1
|
||||
## 07/19/2017
|
||||
|
||||
@@ -514,6 +514,17 @@ form:
|
||||
help: PLUGIN_ADMIN.CACHE_PREFIX_HELP
|
||||
placeholder: PLUGIN_ADMIN.CACHE_PREFIX_PLACEHOLDER
|
||||
|
||||
cache.clear_images_by_default:
|
||||
type: toggle
|
||||
label: PLUGIN_ADMIN.CLEAR_IMAGES_BY_DEFAULT
|
||||
help: PLUGIN_ADMIN.CLEAR_IMAGES_BY_DEFAULT_HELP
|
||||
highlight: 1
|
||||
options:
|
||||
1: PLUGIN_ADMIN.YES
|
||||
0: PLUGIN_ADMIN.NO
|
||||
validate:
|
||||
type: bool
|
||||
|
||||
cache.cli_compatibility:
|
||||
type: toggle
|
||||
label: PLUGIN_ADMIN.CLI_COMPATIBILITY
|
||||
|
||||
@@ -74,6 +74,7 @@ cache:
|
||||
method: file # Method to check for updates in pages: file|folder|hash|none
|
||||
driver: auto # One of: auto|file|apc|xcache|memcache|wincache
|
||||
prefix: 'g' # Cache prefix string (prevents cache conflicts)
|
||||
clear_images_by_default: true # By default grav will include processed images in cache clear, this can be disabled
|
||||
cli_compatibility: false # Ensures only non-volatile drivers are used (file, redis, memcache, etc.)
|
||||
lifetime: 604800 # Lifetime of cached data in seconds (0 = infinite)
|
||||
gzip: false # GZip compress the page output
|
||||
|
||||
@@ -63,6 +63,14 @@ class Cache extends Getters
|
||||
'asset://',
|
||||
];
|
||||
|
||||
protected static $standard_remove_no_images = [
|
||||
'cache://twig/',
|
||||
'cache://doctrine/',
|
||||
'cache://compiled/',
|
||||
'cache://validated-',
|
||||
'asset://',
|
||||
];
|
||||
|
||||
protected static $all_remove = [
|
||||
'cache://',
|
||||
'cache://images',
|
||||
@@ -360,7 +368,12 @@ class Cache extends Getters
|
||||
$remove_paths = self::$tmp_remove;
|
||||
break;
|
||||
default:
|
||||
$remove_paths = self::$standard_remove;
|
||||
if (Grav::instance()['config']->get('system.cache.clear_images_by_default')) {
|
||||
$remove_paths = self::$standard_remove;
|
||||
} else {
|
||||
$remove_paths = self::$standard_remove_no_images;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Clearing cache event to add paths to clear
|
||||
|
||||
Reference in New Issue
Block a user