if (isset($_POST['docleanup'])) { mysql_query("UPDATE avps SET value_u = " . sqlesc($now) . " WHERE arg = 'lastcleantime'") or sqlerr(__FILE__, __LINE__); require_once "include/cleanup.php"; docleanup(); header('Refresh: 2; url=' . $TBDEV['baseurl'] . '/admin.php?action=docleanup'); $HTMLOUT .= "<br /><h1>Cleanup Done</h1>"; } if (isset($_POST['doslowcleanup'])) { mysql_query("UPDATE avps SET value_u = " . sqlesc($now) . " WHERE arg = 'lastslowcleantime'") or sqlerr(__FILE__, __LINE__); require_once "include/cleanup.php"; doslowcleanup(); header('Refresh: 2; url=' . $TBDEV['baseurl'] . '/admin.php?action=docleanup'); $HTMLOUT .= "<br /><h1>Slow Cleanup Done</h1>"; } if (isset($_POST['doslowcleanup2'])) { mysql_query("UPDATE avps SET value_u = " . sqlesc($now) . " WHERE arg = 'lastslowcleantime2'") or sqlerr(__FILE__, __LINE__); require_once "include/cleanup.php"; doslowcleanup2(); header('Refresh: 2; url=' . $TBDEV['baseurl'] . '/admin.php?action=docleanup'); $HTMLOUT .= "<br /><h1>Slow Cleanup 2 Done</h1>"; } if (isset($_POST['dooptimization'])) { mysql_query("UPDATE avps SET value_u = " . sqlesc($now) . " WHERE arg = 'lastoptimizedbtime'") or sqlerr(__FILE__, __LINE__); require_once "include/cleanup.php"; dooptimizedb(); header('Refresh: 2; url=' . $TBDEV['baseurl'] . '/admin.php?action=docleanup'); $HTMLOUT .= "<br /><h1>Optimization Done</h1>"; } $HTMLOUT .= "Memory usage:" . memory_get_usage() . "<br /><br />"; $HTMLOUT .= end_main_frame(); print stdhead('Doclean Up') . $HTMLOUT . stdfoot();
function autoclean() { global $autoclean_interval, $autoslowclean_interval, $s2autoslowclean_interval, $optimizedb_interval, $backupdb_interval, $autohitrun_interval; $now = gmtime(); /* Better cleanup function with db-optimization dbbackup - //==added hitandrun==// by x0r @ tbdev.net */ $w00p = sql_query("SELECT arg, value_u FROM avps") or sqlerr(__FILE__, __LINE__); while ($row = mysql_fetch_assoc($w00p)) { if ($row['arg'] == "lastcleantime" && $row['value_u'] + $autoclean_interval < $now) { sql_query("UPDATE avps SET value_u = '{$now}' WHERE arg = 'lastcleantime'") or sqlerr(__FILE__, __LINE__); docleanup(); } else { if ($row['arg'] == "lastslowcleantime" && $row['value_u'] + $autoslowclean_interval < $now) { sql_query("UPDATE avps SET value_u = '{$now}' WHERE arg = 'lastslowcleantime'") or sqlerr(__FILE__, __LINE__); doslowcleanup(); } else { if ($row['arg'] == "s2slowcleantime" && $row['value_u'] + $s2autoslowclean_interval < $now) { sql_query("UPDATE avps SET value_u = '{$now}' WHERE arg = 's2slowcleantime'") or sqlerr(__FILE__, __LINE__); dos2slowcleanup(); } else { if ($row['arg'] == "lastoptimizedbtime" && $row['value_u'] + $optimizedb_interval < $now) { sql_query("UPDATE avps SET value_u = '{$now}' WHERE arg = 'lastoptimizedbtime'") or sqlerr(__FILE__, __LINE__); dooptimizedb(); } else { if ($row['arg'] == "lastbackupdbtime" && $row['value_u'] + $backupdb_interval < $now) { sql_query("UPDATE avps SET value_u = '{$now}' WHERE arg = 'lastbackupdbtime'") or sqlerr(__FILE__, __LINE__); dobackupdb(); } else { if ($row['arg'] == "lastautohitruntime" && $row['value_u'] + $autohitrun_interval < $now) { sql_query("UPDATE avps SET value_u = '{$now}' WHERE arg = 'lastautohitruntime'") or sqlerr(__FILE__, __LINE__); doautohitrun(); } } } } } } } mysql_free_result($w00p); return; }
function autoclean() { global $TBDEV; $now = time(); /* Better cleanup function with db-optimization and slow clean by x0r @ tbdev.net */ $w00p = sql_query("SELECT arg, value_u FROM avps") or sqlerr(__FILE__, __LINE__); while ($row = mysql_fetch_assoc($w00p)) { if ($row['arg'] == "lastcleantime" && $row['value_u'] + $TBDEV['autoclean_interval'] < $now) { sql_query("UPDATE avps SET value_u = '{$now}' WHERE arg = 'lastcleantime'") or sqlerr(__FILE__, __LINE__); require_once INCL_DIR . 'cleanup.php'; docleanup(); } else { if ($row['arg'] == "lastslowcleantime" && $row['value_u'] + $TBDEV['autoslowclean_interval'] < $now) { sql_query("UPDATE avps SET value_u = '{$now}' WHERE arg = 'lastslowcleantime'") or sqlerr(__FILE__, __LINE__); require_once INCL_DIR . 'cleanup.php'; doslowcleanup(); } else { if ($row['arg'] == "lastslowcleantime2" && $row['value_u'] + $TBDEV['autoslowclean_interval2'] < $now) { sql_query("UPDATE avps SET value_u = '{$now}' WHERE arg = 'lastslowcleantime2'") or sqlerr(__FILE__, __LINE__); require_once INCL_DIR . 'cleanup.php'; doslowcleanup2(); } else { if ($row['arg'] == "lastoptimizedbtime" && $row['value_u'] + $TBDEV['optimizedb_interval'] < $now) { sql_query("UPDATE avps SET value_u = '{$now}' WHERE arg = 'lastoptimizedbtime'") or sqlerr(__FILE__, __LINE__); require_once INCL_DIR . 'cleanup.php'; dooptimizedb(); } } } } } mysql_free_result($w00p); return; }
function autoclean() { global $INSTALLER09; /* Better cleanup function with db-optimization and slow clean by x0r @ tbdev.net */ $w00p = sql_query("SELECT arg, value_u FROM avps") or sqlerr(__FILE__, __LINE__); while ($row = mysql_fetch_assoc($w00p)) { if ($INSTALLER09['docleanup'] == 1 && $row['arg'] == "lastcleantime" && $row['value_u'] + $INSTALLER09['autoclean_interval'] < TIME_NOW) { sql_query("UPDATE avps SET value_u = " . TIME_NOW . " WHERE arg = 'lastcleantime'") or sqlerr(__FILE__, __LINE__); require_once INCL_DIR . 'cleanup.php'; docleanup(); } else { if ($INSTALLER09['doslowcleanup'] == 1 && $row['arg'] == "lastslowcleantime" && $row['value_u'] + $INSTALLER09['autoslowclean_interval'] < TIME_NOW) { sql_query("UPDATE avps SET value_u = " . TIME_NOW . " WHERE arg = 'lastslowcleantime'") or sqlerr(__FILE__, __LINE__); require_once INCL_DIR . 'cleanup.php'; doslowcleanup(); } else { if ($INSTALLER09['doslowleanup2'] == 1 && $row['arg'] == "lastslowcleantime2" && $row['value_u'] + $INSTALLER09['autoslowclean_interval2'] < TIME_NOW) { sql_query("UPDATE avps SET value_u = " . TIME_NOW . " WHERE arg = 'lastslowcleantime2'") or sqlerr(__FILE__, __LINE__); require_once INCL_DIR . 'cleanup.php'; doslowcleanup2(); } else { if ($INSTALLER09['lotterycleanup'] == 1 && $row['arg'] == "lastlottocleantime" && $row['value_u'] + $INSTALLER09['lotteryclean_interval'] < TIME_NOW) { sql_query("UPDATE avps SET value_u = " . TIME_NOW . " WHERE arg = 'lastlottocleantime'") or sqlerr(__FILE__, __LINE__); require_once INCL_DIR . 'cleanup.php'; dolotterycleanup(); } else { if ($INSTALLER09['optimizedb'] == 1 && $row['arg'] == "lastoptimizedbtime" && $row['value_u'] + $INSTALLER09['optimizedb_interval'] < TIME_NOW) { sql_query("UPDATE avps SET value_u = " . TIME_NOW . " WHERE arg = 'lastoptimizedbtime'") or sqlerr(__FILE__, __LINE__); require_once INCL_DIR . 'cleanup.php'; dooptimizedb(); } else { if ($INSTALLER09['dobackup'] == 1 && $row['arg'] == "lastbackuptime" && $row['value_u'] + $INSTALLER09['autobackup_interval'] < TIME_NOW) { sql_query("UPDATE avps SET value_u = " . TIME_NOW . " WHERE arg = 'lastbackuptime'") or sqlerr(__FILE__, __LINE__); require_once INCL_DIR . 'cleanup.php'; dobackupdb(); } } } } } } } mysql_free_result($w00p); return; }