[04/06/2024] On rajoute le répertoire tmp (situé avant la racine de Thelia) dans la purge du module SessionPurge
This commit is contained in:
@@ -55,6 +55,27 @@ class EventManager implements EventSubscriberInterface
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// [TheCoreDev le 4/06/2024] On supprime aussi les fichiers présents dans /tmp (avant la racine Thelia)
|
||||||
|
$files = Finder::create()
|
||||||
|
->in(THELIA_ROOT . '../tmp')
|
||||||
|
->files()
|
||||||
|
->ignoreDotFiles(true)
|
||||||
|
->date('<= now - ' . $lifetime . ' seconds');
|
||||||
|
|
||||||
|
foreach ($files as $file) {
|
||||||
|
$path = $file->getRealPath();
|
||||||
|
|
||||||
|
if (false === @unlink($path)) {
|
||||||
|
$event->appendStatus(sprintf("Failed to delete %s file", $path), 'error');
|
||||||
|
} else {
|
||||||
|
if ($verbose) {
|
||||||
|
$event->appendStatus(sprintf("%s successfully deleted", $path));
|
||||||
|
}
|
||||||
|
|
||||||
|
$deleted++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$event->setDeletedCount($deleted);
|
$event->setDeletedCount($deleted);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user