".$lang['setup']['global_file_updated']."
"; } else { echo "".$lang['setup']['global_unwritable_1']."
"; $globCont=""; echo "includes".CC_DS."global.inc.php
".$lang['setup']['try_again_to_complete']."
"; $nextStep = 3; $buttonText = $lang['setup']['upgrade_try_again']; } } ## Edit config database rows to be $config = fetchDbConfig("config"); ## Fix for langs in v4 that don't exist $config['defaultLang'] = $_GET['l']; ## see if any of our required config values exist... if not the config must be 3.0 and we need to update them if( !array_key_exists('siteCountry', $config) || !array_key_exists('defaultCurrency', $config) || !array_key_exists('storeAddress', $config)) { $resultOldConfig = $db->select("SELECT * FROM ".$glob['dbprefix']."CubeCart_config"); if($resultOldConfig==TRUE){ for($i=0;$i".$lang['setup']['config_files_updated']."
"; ## unset base64 config and get nice clean one bye bye skank unset($config); $config = fetchDbConfig("config"); ## Change the skin back to KitaBlue $newConf['skinDir'] = "KitaBlue"; ## Added in 4.0.0 $newConf['cat_tree'] = '1'; $newConf['hide_prices'] = '0'; $newConf['pop_products_source'] = '0'; $newConf['cache'] = '1'; $newConf['show_empty_cat'] = 1; $newConf['disable_alert_email']=0; $newConf['latestNewsRRS'] = 'http://forums.cubecart.com/index.php?act=rssout&id=1'; $newConf['richTextEditor'] = true; $newConf['rteHeight'] = '350'; $newConf['rteHeightUnit'] = ''; $newConf['add_to_basket_act'] = '0'; $newConf['stock_warn_type'] = '0'; $newConf['stock_warn_level'] = '5'; $newConf['changeskin'] = '0'; $newConf['priceTaxDelInv'] = '0'; $newConf['currecyAuto'] = '0'; $newConf['proxy'] = '0'; $newConf['proxyHost'] = ''; $newConf['proxyPort'] = ''; $newConf['sef'] = '0'; $newConf['seftags'] = '0'; $newConf['sefprodnamefirst'] = '0'; $newConf['stock_change_time'] = '0'; $newConf['stock_replace_time'][1] = '1'; $newConf['stock_replace_time'][2] = '1'; $newConf['stock_replace_time'][3] = '1'; $newConf['stock_replace_time'][5] = '1'; $newConf['stock_replace_time'][6] = '1'; $config['orderExpire'] = '1209600'; ################################ ## Start Upload Folder SIze ################################ $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; } } echo "Image upload folder size calculated.
"; } $newConf['uploadSize'] = $size; ################################ ## End Upload Folder SIze ################################ writeDbConf($newConf, 'config', $config, false); ################################ ## Start Count products in Categories ################################ ## Lets override the default execution time with error supression for safe mode @set_time_limit(0); $success = false; 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, ''); unset($record); ## Count primary categories of products # $prodquery = sprintf("SELECT COUNT(productId) as count, cat_id FROM %sCubeCart_inventory WHERE disabled = '0' GROUP BY cat_id", $glob['dbprefix']); # $products = $db->select($prodquery); # if ($products) { # foreach ($products as $product) { # $db->categoryNos($product['cat_id'], '+', $product['count']); # } # $success = true; # } ## Delete records from cats_idx if the productId isn't in the inventory $idxquery = sprintf("DELETE FROM %1\$sCubeCart_cats_idx WHERE productId NOT IN (SELECT DISTINCT productId FROM %1\$sCubeCart_inventory WHERE disabled = '0')", $glob['dbprefix']); $db->misc($idxquery); ## 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); if ($catCount) { foreach ($catCount as $category) { ## Set the number of products in each category $db->categoryNos($category['cat_id'], '+', $category['count']); } $success = true; } if ($success) { echo "Number of products by category counted.
"; } ## ---------------------------------------- /* ## set noProducts in all categories to 0 $record['noProducts'] = $db->mySQLSafe(0); $update = $db->update($glob['dbprefix']."CubeCart_category", $record, $where=""); unset($record); ## empty cats_idx $empty = $db->truncate($glob['dbprefix']."CubeCart_cats_idx"); ## get all products $products = $db->select("SELECT * FROM ".$glob['dbprefix']."CubeCart_inventory"); ## for each product add 1 to suitable category count and add cat_idx if($products==TRUE){ for ($i=0; $iNumber of products per category counted.
"; }*/ ################################ ## End Count products in Categories ################################ ################################ ## Start Count Orders ################################ $record['noOrders'] = $db->mySQLSafe(0); $update = $db->update($glob['dbprefix']."CubeCart_customer", $record, $where=""); unset($record); // get all customers $customers = $db->select("SELECT * FROM ".$glob['dbprefix']."CubeCart_customer"); if($customers==TRUE){ for ($i=0; $iOrders recounted per customer.
"; } ################################ ## End Count Orders ################################ ## Insert hidden category $db->misc("INSERT INTO `".$glob['dbprefix']."CubeCart_category` (`cat_name`, `cat_desc`, `cat_id`, `cat_father_id`, `cat_image`, `per_ship`, `item_ship`, `item_int_ship`, `per_int_ship`, `noProducts`, `hide`, `cat_metatitle`, `cat_metadesc`, `cat_metakeywords`, `priority`) VALUES ('Imported Products', '##HIDDEN##', '', 0, '', 0.00, 0.00, 0.00, 0.00, 0, 1, '', '', '', NULL);"); } ?>