1
0
mirror of https://github.com/cp6/my-idlers.git synced 2024-11-16 15:33:44 +01:00

Added delete saved YABs files when deleting server

Delete saved YABs files when deleting server
This commit is contained in:
cp6 2021-02-01 14:46:37 +11:00
parent e6fa1dc0ea
commit ee8a193c18

View File

@ -568,6 +568,20 @@ class helperFunctions extends elementHelpers
$date = new DateTime($ahead_date);
return $date->diff($today)->format("%a");
}
protected function deleteYabsForId(string $id)
{
if ($handle = opendir("yabs/")) {
while (false !== ($file = readdir($handle))) {
if ('.' === $file) continue;
if (strpos($file, $id) !== false) {
unlink("yabs/$file");
}
}
closedir($handle);
}
}
}
class idlers extends helperFunctions
@ -3452,6 +3466,7 @@ class itemUpdate extends idlers
$del_disk->execute([$item_id]);
$del_speed = $this->dbConnect()->prepare("DELETE FROM `speed_tests` WHERE `server_id` = ?;");
$del_speed->execute([$item_id]);
$this->deleteYabsForId($item_id);//Delete saved YABs
}
}