query("TRUNCATE TABLE " . USERPREFIX . "_lostdb"); $db->query("TRUNCATE TABLE " . PREFIX . "_com_logs"); $db->query("TRUNCATE TABLE " . PREFIX . "_poll_log"); } if ($_REQUEST['step'] == 8) { $_REQUEST['step'] = 9; $db->query("TRUNCATE TABLE " . USERPREFIX . "_pm"); $db->query("UPDATE " . USERPREFIX . "_users set pm_all='0', pm_unread='0'"); } if ($_REQUEST['step'] == 6) { $_REQUEST['step'] = 7; $sql = $db->query("SELECT name, user_id, news_num, comm_num FROM " . USERPREFIX . "_users"); while($row = $db->get_row($sql)){ $posts = $db->super_query("SELECT COUNT(*) as count FROM " . PREFIX . "_post WHERE autor = '{$row['name']}'"); $comms = $db->super_query("SELECT COUNT(*) as count FROM " . PREFIX . "_comments WHERE user_id = '{$row['user_id']}'"); if (($posts['count'] != $row['news_num']) OR ($comms['count'] != $row['comm_num'])) $db->query("UPDATE " . USERPREFIX . "_users set news_num={$posts['count']}, comm_num={$comms['count']} where user_id='{$row['user_id']}'"); } $db->free ($sql); } if ($_REQUEST['step'] == 4) { if ((@strtotime($_REQUEST['date']) === -1) OR (trim($_REQUEST['date']) == "")) $_REQUEST['step'] = 3; else { $_REQUEST['step'] = 5; $sql = $db->query("SELECT COUNT(*) as count, post_id FROM " . PREFIX . "_comments WHERE date < '{$_REQUEST['date']}' GROUP BY post_id"); while($row = $db->get_row($sql)){ $db->query("UPDATE " . PREFIX . "_post set comm_num=comm_num-{$row['count']} where id='{$row['post_id']}'"); } $db->query("DELETE FROM " . PREFIX . "_comments WHERE date < '{$_REQUEST['date']}'"); $db->free ($sql); $cache->clear(); } } if ($_REQUEST['step'] == 2) { if ((@strtotime($_REQUEST['date']) === -1) OR (trim($_REQUEST['date']) == "")) $_REQUEST['step'] = 1; else { $_REQUEST['step'] = 3; $sql = $db->query("SELECT id FROM " . PREFIX . "_post WHERE date < '{$_REQUEST['date']}'"); while($row = $db->get_row($sql)){ $db->query("DELETE FROM " . PREFIX . "_comments WHERE post_id='{$row['id']}'"); $db->query("DELETE FROM " . PREFIX . "_files WHERE news_id = '{$row['id']}'"); $db->query("DELETE FROM " . PREFIX . "_poll WHERE news_id = '{$row['id']}'"); $db->query("DELETE FROM " . PREFIX . "_poll_log WHERE news_id = '{$row['id']}'"); $db->query("DELETE FROM " . PREFIX . "_tags WHERE news_id = '{$row['id']}'" ); $getfiles = $db->query("SELECT onserver FROM " . PREFIX . "_files WHERE news_id = '{$row['id']}'"); while($file = $db->get_row($getfiles)){ @unlink(ROOT_DIR."/uploads/files/".$file['onserver']); } $db->free ($getfiles); $image = $db->super_query("SELECT images FROM " . PREFIX . "_images where news_id = '{$row['id']}'"); $listimages = explode("|||", $image['images']); if ($image['images'] != "") foreach ($listimages as $dataimages) { $url_image = explode("/", $dataimages); if (count($url_image) == 2) { $folder_prefix = $url_image[0]."/"; $dataimages = $url_image[1]; } else { $folder_prefix = ""; $dataimages = $url_image[0]; } @unlink(ROOT_DIR."/uploads/posts/".$folder_prefix.$dataimages); @unlink(ROOT_DIR."/uploads/posts/".$folder_prefix."thumbs/".$dataimages); } $db->query("DELETE FROM " . PREFIX . "_images WHERE news_id = '{$row['id']}'"); } $db->query("DELETE FROM " . PREFIX . "_post WHERE date < '{$_REQUEST['date']}'"); $db->free ($sql); $cache->clear(); } } if ($_REQUEST['step'] == 11) { $rs = $db->query("SHOW TABLE STATUS FROM `".DBNAME."`"); while ($r = $db->get_array($rs)) { $db->query("OPTIMIZE TABLE ". $r['Name']); } $db->free ($rs); $db->query("SHOW TABLE STATUS FROM `".DBNAME."`"); $mysql_size = 0; while ($r = $db->get_array()) { if (strpos($r['Name'], PREFIX."_") !== false) $mysql_size += $r['Data_length'] + $r['Index_length'] ; } $lang['clean_finish'] = str_replace ('{db-alt}', ''.mksize($_REQUEST['size']).'', $lang['clean_finish']); $lang['clean_finish'] = str_replace ('{db-new}', ''.mksize($mysql_size).'', $lang['clean_finish']); $lang['clean_finish'] = str_replace ('{db-compare}', ''.mksize($_REQUEST['size'] - $mysql_size).'', $lang['clean_finish']); $buffer = <<
{$lang['clean_finish']}