mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-02 22:28:37 +02:00
Merge pull request #7318 from open-sausages/pulls/4.0/no-requirements-to-combine
Fix add combinedFiles to clear logic - ss4
This commit is contained in:
commit
34aede5197
@ -704,25 +704,24 @@ class Requirements_Backend
|
|||||||
*/
|
*/
|
||||||
public function clear($fileOrID = null)
|
public function clear($fileOrID = null)
|
||||||
{
|
{
|
||||||
|
$types = [
|
||||||
|
'javascript',
|
||||||
|
'css',
|
||||||
|
'customScript',
|
||||||
|
'customCSS',
|
||||||
|
'customHeadTags',
|
||||||
|
'combinedFiles',
|
||||||
|
];
|
||||||
|
foreach ($types as $type) {
|
||||||
if ($fileOrID) {
|
if ($fileOrID) {
|
||||||
foreach (array('javascript', 'css', 'customScript', 'customCSS', 'customHeadTags') as $type) {
|
|
||||||
if (isset($this->{$type}[$fileOrID])) {
|
if (isset($this->{$type}[$fileOrID])) {
|
||||||
$this->disabled[$type][$fileOrID] = $this->{$type}[$fileOrID];
|
$this->disabled[$type][$fileOrID] = $this->{$type}[$fileOrID];
|
||||||
unset($this->{$type}[$fileOrID]);
|
unset($this->{$type}[$fileOrID]);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
$this->disabled['javascript'] = $this->javascript;
|
$this->disabled[$type] = $this->{$type};
|
||||||
$this->disabled['css'] = $this->css;
|
$this->{$type} = [];
|
||||||
$this->disabled['customScript'] = $this->customScript;
|
}
|
||||||
$this->disabled['customCSS'] = $this->customCSS;
|
|
||||||
$this->disabled['customHeadTags'] = $this->customHeadTags;
|
|
||||||
|
|
||||||
$this->javascript = array();
|
|
||||||
$this->css = array();
|
|
||||||
$this->customScript = array();
|
|
||||||
$this->customCSS = array();
|
|
||||||
$this->customHeadTags = array();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -731,11 +730,17 @@ class Requirements_Backend
|
|||||||
*/
|
*/
|
||||||
public function restore()
|
public function restore()
|
||||||
{
|
{
|
||||||
$this->javascript = $this->disabled['javascript'];
|
$types = [
|
||||||
$this->css = $this->disabled['css'];
|
'javascript',
|
||||||
$this->customScript = $this->disabled['customScript'];
|
'css',
|
||||||
$this->customCSS = $this->disabled['customCSS'];
|
'customScript',
|
||||||
$this->customHeadTags = $this->disabled['customHeadTags'];
|
'customCSS',
|
||||||
|
'customHeadTags',
|
||||||
|
'combinedFiles',
|
||||||
|
];
|
||||||
|
foreach ($types as $type) {
|
||||||
|
$this->{$type} = $this->disabled[$type];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user