Skip to content

Commit ff5bd26

Browse files
authored
Merge pull request #111 from phug-php/feature/multi-tester-3
Use multi-tester 2.5 split: 44978d6c0f5d5245cd8b9988002d117ea9ebdd04
1 parent f5d4a61 commit ff5bd26

1 file changed

Lines changed: 19 additions & 2 deletions

File tree

Renderer/Adapter/FileAdapter.php

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -389,18 +389,35 @@ private function isCacheUpToDate(&$path, $input = null)
389389
return file_exists($path);
390390
}
391391

392-
private function getCacheDirectory()
392+
private function readCacheDirectoryFromOptions()
393393
{
394394
$cacheFolder = $this->hasOption('cache_dir')
395395
? $this->getOption('cache_dir')
396396
: null;
397+
397398
if (!$cacheFolder && $cacheFolder !== false) {
398399
$cacheFolder = $this->getRenderer()->hasOption('cache_dir')
399400
? $this->getRenderer()->getOption('cache_dir')
400401
: null;
401402
}
403+
402404
if ($cacheFolder === true) {
403-
$cacheFolder = $this->getOption('tmp_dir');
405+
return $this->getOption('tmp_dir');
406+
}
407+
408+
return $cacheFolder;
409+
}
410+
411+
private function getCacheDirectory()
412+
{
413+
$cacheFolder = $this->readCacheDirectoryFromOptions();
414+
415+
if ($cacheFolder === null) {
416+
throw new RuntimeException(
417+
'You need to set "cache_dir" option to a writable location in order '.
418+
'to use cache feature.',
419+
7
420+
);
404421
}
405422

406423
if (!is_dir($cacheFolder) && !@mkdir($cacheFolder, 0777, true)) {

0 commit comments

Comments
 (0)