mirror of
https://github.com/YGGverse/YGGo.git
synced 2025-01-24 21:44:59 +00:00
clean up banned pages extra data
This commit is contained in:
parent
a657d31e1d
commit
dc2d971ba0
@ -217,6 +217,40 @@ try {
|
|||||||
// Reset banned pages
|
// Reset banned pages
|
||||||
$hostPagesBansRemoved += $db->resetBannedHostPages(time() - CLEAN_PAGE_BAN_SECONDS_OFFSET);
|
$hostPagesBansRemoved += $db->resetBannedHostPages(time() - CLEAN_PAGE_BAN_SECONDS_OFFSET);
|
||||||
|
|
||||||
|
// Clean up banned pages extra data
|
||||||
|
foreach ($db->getHostPagesBanned() as $hostPageBanned) {
|
||||||
|
|
||||||
|
// Delete host page descriptions
|
||||||
|
$hostPagesDescriptionsDeleted += $db->deleteHostPageDescriptions($hostPageBanned->hostPageId);
|
||||||
|
|
||||||
|
// Delete host page refs data
|
||||||
|
$hostPagesToHostPageDeleted += $db->deleteHostPageToHostPage($hostPageBanned->hostPageId);
|
||||||
|
|
||||||
|
// Delete host page snaps
|
||||||
|
$snapFilePath = chunk_split($hostPageBanned->hostPageId, 1, '/');
|
||||||
|
|
||||||
|
foreach ($db->getHostPageSnaps($hostPageBanned->hostPageId) as $hostPageSnap) {
|
||||||
|
|
||||||
|
if ($hostPageSnap->storageLocal) {
|
||||||
|
|
||||||
|
unlink('../storage/snap/hp/' . $snapFilePath . $hostPageSnap->timeAdded . '.zip');
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($hostPageSnap->storageMega) {
|
||||||
|
|
||||||
|
$ftp = new Ftp();
|
||||||
|
|
||||||
|
if ($ftp->connect(MEGA_FTP_HOST, MEGA_FTP_PORT, null, null, MEGA_FTP_DIRECTORY)) {
|
||||||
|
$ftp->delete('hp/' . $snapFilePath . $hostPageSnap->timeAdded . '.zip');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$db->deleteHostPageSnapDownloads($hostPageSnap->hostPageSnapId);
|
||||||
|
|
||||||
|
$hostPagesSnapDeleted += $db->deleteHostPageSnap($hostPageSnap->hostPageSnapId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Delete page description history
|
// Delete page description history
|
||||||
$hostPagesDescriptionsDeleted += $db->deleteHostPageDescriptionsByTimeAdded(time() - CLEAN_PAGE_DESCRIPTION_OFFSET);
|
$hostPagesDescriptionsDeleted += $db->deleteHostPageDescriptionsByTimeAdded(time() - CLEAN_PAGE_DESCRIPTION_OFFSET);
|
||||||
|
|
||||||
|
@ -502,6 +502,13 @@ class MySQL {
|
|||||||
return $query->fetchAll();
|
return $query->fetchAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getHostPagesBanned() {
|
||||||
|
|
||||||
|
$query = $this->_db->query('SELECT * FROM `hostPage` WHERE `timeBanned` IS NOT NULL');
|
||||||
|
|
||||||
|
return $query->fetchAll();
|
||||||
|
}
|
||||||
|
|
||||||
public function resetBannedHostPages(int $timeOffset) {
|
public function resetBannedHostPages(int $timeOffset) {
|
||||||
|
|
||||||
$query = $this->_db->prepare('UPDATE `hostPage` SET `timeBanned` = NULL WHERE `timeBanned` IS NOT NULL AND `timeBanned` < ' . (int) $timeOffset);
|
$query = $this->_db->prepare('UPDATE `hostPage` SET `timeBanned` = NULL WHERE `timeBanned` IS NOT NULL AND `timeBanned` < ' . (int) $timeOffset);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user