diff --git a/app/cdash/include/dailyupdates.php b/app/cdash/include/dailyupdates.php index 277c77219..ce474f63d 100644 --- a/app/cdash/include/dailyupdates.php +++ b/app/cdash/include/dailyupdates.php @@ -1108,14 +1108,13 @@ function addDailyChanges(int $projectid): void ', [$projectid, $date]); // Clean the backup directories. - $timeframe = config('cdash.backup_timeframe'); + $deletion_time_threshold = time() - (int) config('cdash.backup_timeframe') * 3600; $dirs_to_clean = ['parsed', 'failed', 'inprogress']; foreach ($dirs_to_clean as $dir_to_clean) { $files = Storage::allFiles($dir_to_clean); - foreach ($files as $filename) { - $filepath = Storage::path($filename); - if (file_exists($filepath) && is_file($filepath) && time() - filemtime($filepath) > $timeframe * 3600) { - Storage::delete($filepath); + foreach ($files as $file) { + if (Storage::lastModified($file) < $deletion_time_threshold) { + Storage::delete($file); } } } diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index a32ba3a2a..581e36861 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -14012,11 +14012,6 @@ parameters: count: 3 path: app/cdash/include/dailyupdates.php - - - message: "#^Binary operation \"\\*\" between mixed and 3600 results in an error\\.$#" - count: 1 - path: app/cdash/include/dailyupdates.php - - message: """ #^Call to deprecated function add_last_sql_error\\(\\)\\: @@ -14092,6 +14087,11 @@ parameters: count: 1 path: app/cdash/include/dailyupdates.php + - + message: "#^Cannot cast mixed to int\\.$#" + count: 1 + path: app/cdash/include/dailyupdates.php + - message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#" count: 5 @@ -14312,11 +14312,6 @@ parameters: count: 2 path: app/cdash/include/dailyupdates.php - - - message: "#^Only numeric types are allowed in \\-, int\\|false given on the right side\\.$#" - count: 1 - path: app/cdash/include/dailyupdates.php - - message: "#^Parameter \\#1 \\$datetime of function strtotime expects string, string\\|null given\\.$#" count: 1