class CCastleAgent { function DeleteOld($nDays) { CModule::IncludeModuleEx('sale'); global $DB; $nDays = IntVal($nDays); $strSql = "SELECT ID ". "FROM b_sale_fuser ". "WHERE TO_DAYS(DATE_UPDATE)<(TO_DAYS(NOW())-".$nDays.") LIMIT 5000"; $db_res = $DB->Query($strSql, false, "File: ".__FILE__."<br>Line: ".__LINE__); while ($ar_res = $db_res->Fetch()) { CSaleBasket::DeleteAll($ar_res["ID"], false); CSaleUser::Delete($ar_res["ID"]); } return true; } function DeleteOldAgent($nDays) { if (!isset($GLOBALS["USER"]) || !is_object($GLOBALS["USER"])) { $bTmpUser = True; $GLOBALS["USER"] = new CUser; } CCastleAgent::DeleteOld($nDays); global $pPERIOD; $pPERIOD = 8*60*60; if ($bTmpUser) { unset($GLOBALS["USER"]); } return "CCastleAgent::DeleteOldAgent(".$nDays.");"; } }
Опубликовано: 24 июля 2013
|
|