mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
API Enable requirements to persist between flushes
This commit is contained in:
parent
06f0f558d4
commit
7041c5945c
@ -130,6 +130,9 @@ the third paramter of the `combine_files` function:
|
|||||||
|
|
||||||
Requirements::combine_files('print.css', $printStylesheets, 'print');
|
Requirements::combine_files('print.css', $printStylesheets, 'print');
|
||||||
|
|
||||||
|
By default, all requirements files are flushed (deleted) when ?flush querystring parameter is set.
|
||||||
|
This can be disabled by setting the `Requirements.disable_flush_combined` config to `true`.
|
||||||
|
|
||||||
## Clearing assets
|
## Clearing assets
|
||||||
|
|
||||||
:::php
|
:::php
|
||||||
|
@ -8,11 +8,25 @@
|
|||||||
*/
|
*/
|
||||||
class Requirements implements Flushable {
|
class Requirements implements Flushable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Flag whether combined files should be deleted on flush.
|
||||||
|
*
|
||||||
|
* By default all combined files are deleted on flush. If combined files are stored in source control,
|
||||||
|
* and thus updated manually, you might want to turn this on to disable this behaviour.
|
||||||
|
*
|
||||||
|
* @config
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
private static $disable_flush_combined = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Triggered early in the request when a flush is requested
|
* Triggered early in the request when a flush is requested
|
||||||
*/
|
*/
|
||||||
public static function flush() {
|
public static function flush() {
|
||||||
self::delete_all_combined_files();
|
$disabled = Config::inst()->get(__CLASS__, 'disable_flush_combined');
|
||||||
|
if(!$disabled) {
|
||||||
|
self::delete_all_combined_files();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user