Skip to content

Commit

Permalink
Merge pull request #110 from JakubDolba/jd-fix-cache-dir-missing
Browse files Browse the repository at this point in the history
prevent UnexpectedValueException while clearing cache
  • Loading branch information
robbieaverill authored Mar 8, 2019
2 parents 7058480 + 11645e9 commit fbbd059
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions code/DebugBar.php
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,10 @@ public static function initDebugBar()
$debugbar->addCollector(new SilverStripeCollector);

if (self::config()->get('enable_storage')) {
$debugbar->setStorage($fileStorage = new FileStorage(TEMP_FOLDER . '/debugbar'));
if (isset($_GET['flush'])) {
$debugBarTempFolder = TEMP_FOLDER . '/debugbar';
$debugbar->setStorage($fileStorage = new FileStorage($debugBarTempFolder));
if (isset($_GET['flush']) && is_dir($debugBarTempFolder)) {
// FileStorage::clear() is implemented with \DirectoryIterator which throws UnexpectedValueException if dir can not be opened
$fileStorage->clear();
}
}
Expand Down

0 comments on commit fbbd059

Please sign in to comment.