more caching for theming
Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
parent
43cb51d374
commit
2051943487
|
@ -58,6 +58,9 @@ class IconsCacher {
|
||||||
|
|
||||||
private $iconList = 'icons-list.template';
|
private $iconList = 'icons-list.template';
|
||||||
|
|
||||||
|
private $cachedCss;
|
||||||
|
private $cachedList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param ILogger $logger
|
* @param ILogger $logger
|
||||||
* @param Factory $appDataFactory
|
* @param Factory $appDataFactory
|
||||||
|
@ -137,6 +140,8 @@ class IconsCacher {
|
||||||
$cachedVarsCssFile->putContent($data);
|
$cachedVarsCssFile->putContent($data);
|
||||||
$list = ":root {\n$list\n}";
|
$list = ":root {\n$list\n}";
|
||||||
$cachedFile->putContent($list);
|
$cachedFile->putContent($list);
|
||||||
|
$this->cachedList = null;
|
||||||
|
$this->cachedCss = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return preg_replace($this->iconVarRE, '', $css);
|
return preg_replace($this->iconVarRE, '', $css);
|
||||||
|
@ -204,7 +209,10 @@ class IconsCacher {
|
||||||
*/
|
*/
|
||||||
public function getCachedCSS() {
|
public function getCachedCSS() {
|
||||||
try {
|
try {
|
||||||
return $this->folder->getFile($this->fileName);
|
if (!$this->cachedCss) {
|
||||||
|
$this->cachedCss = $this->folder->getFile($this->fileName);
|
||||||
|
}
|
||||||
|
return $this->cachedCss;
|
||||||
} catch (NotFoundException $e) {
|
} catch (NotFoundException $e) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -216,7 +224,10 @@ class IconsCacher {
|
||||||
*/
|
*/
|
||||||
public function getCachedList() {
|
public function getCachedList() {
|
||||||
try {
|
try {
|
||||||
return $this->folder->getFile($this->iconList);
|
if (!$this->cachedList) {
|
||||||
|
$this->cachedList = $this->folder->getFile($this->iconList);
|
||||||
|
}
|
||||||
|
return $this->cachedList;
|
||||||
} catch (NotFoundException $e) {
|
} catch (NotFoundException $e) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -144,7 +144,7 @@ class IconsCacherTest extends \Test\TestCase {
|
||||||
";
|
";
|
||||||
|
|
||||||
$iconsFile = $this->createMock(ISimpleFile::class);
|
$iconsFile = $this->createMock(ISimpleFile::class);
|
||||||
$this->folder->expects($this->exactly(6))
|
$this->folder->expects($this->exactly(4))
|
||||||
->method('getFile')
|
->method('getFile')
|
||||||
->willReturn($iconsFile);
|
->willReturn($iconsFile);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue