<?php
include_once $PATH_TO_CODE."/script/tick/allincludefortick.php";
class RemoveOldObjectTick extends Tick {
public function getName() {
return "Technical";
}
public function run() {
global $gloObjectManager;
$res = executer("
SELECT o.objectId, o.blockId, o.zoneId, o.isBackground
FROM objectTTL t JOIN object o ON o.objectId = t.objectId
WHERE ttl <= 0");
while($row = mysql_fetch_array($res))
{
$locObjectId = $row[0];
$locBlockId = $row[1];
$locZoneId = $row[2];
$locIsBackground = $row[3];
RealObject::staticDeleteObject($locObjectId, $locBlockId, $locZoneId, $locIsBackground);
}
executer("UPDATE objectTTL SET ttl = GREATEST(0, ttl - ".Constante::$DELETED_REFRESH_TIME.")");
executer("DELETE FROM objectDeleted WHERE timestamp < ".(time() - Constante::$SYNC_OUT_TIME));
$res = executer("SELECT o.objectId, o.objectInfoId FROM objectInfoTTL t JOIN objectInfo o ON o.objectInfoId = t.objectInfoId WHERE t.ttl <= 0");
while($row = mysql_fetch_array($res))
{
$locObject = $gloObjectManager->getRealObject($row[0]);
$locObject->hasBeenModified();
executer("DELETE FROM objectInfoTTL WHERE objectInfoId = ".$row[1]);
executer("DELETE FROM objectInfo WHERE objectInfoId = ".$row[1]);
}
executer("UPDATE objectInfoTTL SET ttl = GREATEST(0, ttl - ".Constante::$DELETED_REFRESH_TIME.")");
}
}
?>