mirror of
https://github.com/getgrav/grav.git
synced 2025-11-01 19:05:58 +01:00
@@ -879,19 +879,8 @@ class SafeUpgradeService
|
|||||||
*/
|
*/
|
||||||
private function pruneOldSnapshots(): void
|
private function pruneOldSnapshots(): void
|
||||||
{
|
{
|
||||||
$files = glob($this->manifestStore . DIRECTORY_SEPARATOR . '*.json') ?: [];
|
// Retain all snapshots; administrators can prune manually if desired.
|
||||||
if (count($files) <= 3) {
|
// Legacy behaviour removed to ensure full history remains available.
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
sort($files);
|
|
||||||
$excess = array_slice($files, 0, count($files) - 3);
|
|
||||||
foreach ($excess as $file) {
|
|
||||||
$data = json_decode(file_get_contents($file), true);
|
|
||||||
if (isset($data['backup_path']) && is_dir($data['backup_path'])) {
|
|
||||||
Folder::delete($data['backup_path']);
|
|
||||||
}
|
|
||||||
@unlink($file);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user