Skip to content

Commit

Permalink
Merge pull request #15 from koriym/clear
Browse files Browse the repository at this point in the history
Clear tmp folder flag on each context
  • Loading branch information
koriym authored Jul 12, 2017
2 parents 2b6feb4 + 2d665ee commit f478c30
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/AppMeta.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ private function clearTmpDirectory($dir)
/**
* A flag for clear once because called many times during the unit testing
*/
static $done = false;
static $cleanUpFlg = [];

if ($done || file_exists($dir . '/.do_not_clear')) {
if (in_array($dir, $cleanUpFlg, true) || file_exists($dir . '/.do_not_clear')) {
return;
}
$unlink = function ($path) use (&$unlink) {
Expand All @@ -70,6 +70,6 @@ private function clearTmpDirectory($dir)
}
};
$unlink($dir);
$done = true;
$cleanUpFlg[] = $dir;
}
}

0 comments on commit f478c30

Please sign in to comment.