From 5fb52285913cecf214795e52a46d38e0e52375f6 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Wed, 22 Jan 2020 20:14:28 +0100 Subject: [PATCH] [ticket/16354] Reload page after cache purge & purge time limit PHPBB3-16354 --- phpBB/install/startup.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/phpBB/install/startup.php b/phpBB/install/startup.php index fa63bf1993..94091f1beb 100644 --- a/phpBB/install/startup.php +++ b/phpBB/install/startup.php @@ -133,9 +133,21 @@ function installer_shutdown_function($display_errors) $cache = new \phpbb\cache\driver\file(__DIR__ . '/../cache/installer'); if (strpos($error['file'], realpath($cache->cache_dir)) !== false) { - $cache->purge(); + $file_age = @filemtime($error['file']); - die('The installer has detected an issue with a cached file. Try reloading the page to resolve the issue. If you require further assistance, please visit the phpBB support forums.'); + if ($file_age !== false && ($file_age + 60) < time()) + { + $cache->purge(); + + $symfony_request = new \phpbb\symfony_request(new \phpbb\request\request(new \phpbb\request\type_cast_helper())); + + header('Location: ' . $symfony_request->getRequestUri()); + exit(); + } + else + { + die('The installer has detected an issue with a cached file. Try reloading the page and/or manually clearing the cache to resolve the issue. If you require further assistance, please visit the phpBB support forums.'); + } } else if ($error['type'] & $supported_error_levels) {