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:
Damian Mooyman 2017-08-29 14:54:50 +12:00 committed by GitHub
commit 34aede5197

View File

@ -704,25 +704,24 @@ class Requirements_Backend
*/ */
public function clear($fileOrID = null) public function clear($fileOrID = null)
{ {
if ($fileOrID) { $types = [
foreach (array('javascript', 'css', 'customScript', 'customCSS', 'customHeadTags') as $type) { 'javascript',
'css',
'customScript',
'customCSS',
'customHeadTags',
'combinedFiles',
];
foreach ($types as $type) {
if ($fileOrID) {
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 {
$this->disabled[$type] = $this->{$type};
$this->{$type} = [];
} }
} else {
$this->disabled['javascript'] = $this->javascript;
$this->disabled['css'] = $this->css;
$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];
}
} }
/** /**