misc("TRUNCATE TABLE `".$glob['dbprefix']."CubeCart_transactions`"); if($truncate == TRUE) { $msg = "
".$lang['admin']['misc_trans_logs_emptied']."
"; } else { $msg = "".$lang['admin']['misc_trans_logs_not_emptied']."
"; } } elseif($_GET['clearCache']==1){ $cache = new cache(); $cache->clearCache(); $msg = "".$lang['admin']['misc_cache_cleared']."
"; } elseif($_GET['removeKey']==1) { $config = fetchDbConfig("config"); $newConfig = $config; unset($newConfig['lk'],$newConfig['lkv']); $msg = writeDbConf($newConfig,"config", $newConfig, TRUE); unset($config); $config = fetchDbConfig("config"); } elseif($_GET['uploadSize']==1) { $dirArray = walkDir(CC_ROOT_DIR .CC_DS."images".CC_DS."uploads", true, 0, 0, false, $int = 0); $size = 0; if(is_array($dirArray)){ foreach($dirArray as $file) { if(file_exists($file)){ $size = filesize($file) + $size; } } } $rebuild['uploadSize'] = $size; $msg = writeDbConf($rebuild,"config", $config, true); } else if ($_GET['catCount'] == 1) { if ($config['cache']) { ## Purge the Cache $cache = new cache(); $cache->clearCache(); $msg = "".$lang['admin']['misc_cache_cleared']."
"; } ## Set the number of products in all categories to 0 $record['noProducts'] = 0; $update = $db->update($glob['dbprefix'].'CubeCart_category', $record, ''); ## Get all productId's from the database $products = $db->select("SELECT productId FROM ".$glob['dbprefix']."CubeCart_inventory WHERE disabled = '0'"); ## Get a list of all existing products from the inventory if ($products) { foreach ($products as $product) { $currentProducts[] = $product['productId']; } ## Delete all records from cats_idx where the productId is NOT in the inventory $delQuery = sprintf("DELETE FROM %sCubeCart_cats_idx WHERE productId NOT IN (%s)", $glob['dbprefix'], implode(',', $currentProducts)); $db->misc($delQuery); ## Count the number of products in the cats_idx table by category $countQuery = sprintf("SELECT COUNT(cat_id) as count, cat_id FROM %1\$sCubeCart_cats_idx WHERE cat_id IN(SELECT DISTINCT cat_id FROM %1\$sCubeCart_cats_idx WHERE 1) GROUP BY cat_id", $glob['dbprefix']); $catCount = $db->select($countQuery); foreach ($catCount as $category) { ## Set the number of products by category $db->categoryNos($category['cat_id'], '+', $category['count']); } $msg .= "".$lang['admin']['misc_cat_count_success']."
"; } else { $msg .= "".$lang['admin']['misc_cat_count_no_prod']."
"; } } else if ($_GET['prodViews'] == 1) { $msg = ""; if ($config['cache']==true) { $cache = new cache(); $cache->clearCache(); $msg = "".$lang['admin']['misc_cache_cleared']."
"; } // set noProducts in all categories to 0 $record['popularity'] = $db->mySQLSafe(0); $update = $db->update($glob['dbprefix']."CubeCart_inventory", $record, $where=""); if($update == TRUE) { $msg .= "".$lang['admin']['misc_prod_views_zero']."
"; } else { $msg .= "".$lang['admin']['misc_prod_views_not_reset']."
"; } } elseif($_GET['clearSearch']==1) { // set noProducts in all categories to 0 $truncate = $db->misc("TRUNCATE TABLE `".$glob['dbprefix']."CubeCart_search`"); if($truncate == TRUE) { $msg = "".$lang['admin']['misc_search_terms_reset']."
"; } else { $msg = "".$lang['admin']['misc_search_terms_not_reset']."
"; } } elseif($_GET['orderCount']==1) { // set noOrders for all products to 0 $record['noOrders'] = $db->mySQLSafe(0); $update = $db->update($glob['dbprefix']."CubeCart_customer", $record, $where=""); // get all customers $customers = $db->select("SELECT * FROM ".$glob['dbprefix']."CubeCart_customer"); if($customers==TRUE){ for ($i=0; $i".$lang['admin']['misc_customers_orders_counted']."
"; } else { $msg = "".$lang['admin']['misc_no_customers_exist']."
"; } } else if ($_GET['thumbs'] == 1) { $path = CC_ROOT_DIR .CC_DS."images".CC_DS."uploads".CC_DS."thumbs"; $dirArray = walkDir($path, false, 0, 0, false, $int = 0); unset($dirArray['max']); if (is_array($dirArray)) { foreach ($dirArray as $file) { $masterFilename = str_replace(CC_ROOT_DIR .CC_DS."images".CC_DS."uploads".CC_DS."thumbs".CC_DS."thumb_","",$file); // delete files that dont contain thumb_ if (!ereg("thumb_",$file)) { unlink($file); } else if (!file_exists(CC_ROOT_DIR .CC_DS."images".CC_DS."uploads".CC_DS. $masterFilename)) { unlink($file); } } $msg = "".$lang['admin']['misc_redundant_thumbs_gone']."
"; } else { $msg = "".$lang['admin']['misc_thumbs_folder_empty']."
"; } } else if ($_GET['clearLogs'] == 1) { $sql = sprintf("TRUNCATE TABLE %sCubeCart_admin_log", $glob['dbprefix']); $db->misc($sql); $msg = ''.$lang['admin']['misc_clear_logs_empty'].'
'; } else if ($_GET['clearSession'] == 1) { $sql = sprintf('TRUNCATE TABLE %sCubeCart_admin_sessions', $glob['dbprefix']); $db->misc($sql); $msg = ''.$lang['admin']['misc_clear_sessions_empty'].'
'; } require $glob['adminFolder'].CC_DS."includes".CC_DS."header.inc.php"; ?>