diff --git a/theme/image.php b/theme/image.php index e00f5592f7f..db469793989 100644 --- a/theme/image.php +++ b/theme/image.php @@ -115,6 +115,9 @@ if ($rev > -1) { $pathinfo = pathinfo($imagefile); $cacheimage = "$candidatelocation/$image.".$pathinfo['extension']; if (!file_exists($cacheimage)) { + // note: cache reset might have purged our cache dir structure, + // make sure we do not use stale file stat cache in the next check_dir_exists() + clearstatcache(); check_dir_exists(dirname($cacheimage)); copy($imagefile, $cacheimage); } diff --git a/theme/javascript.php b/theme/javascript.php index 6e8a79d785b..986c25c20f8 100644 --- a/theme/javascript.php +++ b/theme/javascript.php @@ -77,6 +77,9 @@ require_once('Minify.php'); $theme = theme_config::load($themename); if ($rev > -1) { + // note: cache reset might have purged our cache dir structure, + // make sure we do not use stale file stat cache in the next check_dir_exists() + clearstatcache(); check_dir_exists(dirname($candidate)); $fp = fopen($candidate, 'w'); fwrite($fp, minify($theme->javascript_files($type))); diff --git a/theme/styles.php b/theme/styles.php index 6fcde59e1b6..7f68abacb97 100644 --- a/theme/styles.php +++ b/theme/styles.php @@ -113,6 +113,9 @@ send_cached_css($candidatesheet, $rev); function store_css(theme_config $theme, $csspath, $cssfiles) { $css = $theme->post_process(minify($cssfiles)); + // note: cache reset might have purged our cache dir structure, + // make sure we do not use stale file stat cache in the next check_dir_exists() + clearstatcache(); check_dir_exists(dirname($csspath)); $fp = fopen($csspath, 'w'); fwrite($fp, $css);