Products     Magento Extension     PCI-Shopping-Carts     Templates       CRELoaded     WordPress Modules     osCommerce Modules       osCommerce Addons       osCommerce Features       osCommerce Management       Payment Modules     CRELoaded Modules       CRE Loaded Addons       CRE Loaded Features       CRE Loaded Management       Payment Modules       CRELoaded Services
Free Stuff
Customization
Templates
Compare Products
You have no items to compare.
Affiliate Info
Affiliate Program FAQ
Affiliate Log In
Recent Orders
Hot Keywords: Order Notification, Order Search, Coupon, Flash Board, Compare, Floating Message, Tracking, Moneris, RSS, Visitor Filter

  Cache Configurations into file

The following osCommerce contribution is a free Opensource code originated from official osCommerce website and provided for your reference only, you may download the original contribution file(s) and install it on your own; or you may request a Paid Installation Service from Agents Of Power; Agents Of Power does the "AS IS" installation on your website, we do not guarantee it will work properly on your website. Extra Paid service is available for repairing the problem from the original contribution or from your website.
I combined Jasons' work and updates into one complete package for easier installation.
<br><br>
All credit goes to the original author Jason Chuh
<br><br>
zhuqling
<br><br>
This is a great package if you are looking to make your store a little snappier!!

<br><br>
Complete Package

Please make below change:
file:admin/modules.php
find below :

case 'save':
while (list($key, $value) = each($HTTP_POST_VARS['configuration'])) {
if( is_array( $value ) ){
$value = implode( ", ", $value);
$value = ereg_replace (", --none--", "", $value);
}
tep_db_query("update " . TABLE_CONFIGURATION . " set configuration_value = '" . $value . "' where configuration_key = '" . $key . "'");
}

Append this code:
// UPDATE CONFIGURATION CACHES
updateConfiguration();

thank you.
************************
* This Package has not contain any files,only below code is activity.
************************
In application_top.php,every page will load configurations each once,there is every low efficiently.
So,save configuration into a cache file,That is very cool.

************************
* Code
************************
1. File includes/application_top.php
Find:
// set the application parameters
$configuration_query = tep_db_query('select configuration_key as cfgKey, configuration_value as cfgValue from ' . TABLE_CONFIGURATION);
while ($configuration = tep_db_fetch_array($configuration_query)) {
define($configuration['cfgKey'], $configuration['cfgValue']);
}
Replace with below:
// BEGIN REPLACE BY CONFIGURATION CACHES by jason chuh
function writeConfiguration(&$var, $filename='configuration.cache') {
$filename = 'cache/' . $filename;
$success = false;

if ($fp = @fopen($filename, 'w')) {
flock($fp, 2); // LOCK_EX
fputs($fp, serialize($var));
flock($fp, 3); // LOCK_UN
fclose($fp);
$success = true;
}

return $success;
}

function readCofiguration(&$var, $filename='configuration.cache'){
$filename = 'cache/' . $filename;
$success = false;

if ($fp = @fopen($filename, 'r')) {
$szdata = fread($fp, filesize($filename));
fclose($fp);
$var = unserialize($szdata);

$success = true;
}

return $success;
}

if (!readCofiguration($result)) {
$result = array();
$configuration_query = tep_db_query('select configuration_key as cfgKey, configuration_value as cfgValue from ' . TABLE_CONFIGURATION);
while ($configuration = tep_db_fetch_array($configuration_query)) {
$result[] = array('key'=>$configuration['cfgKey'],'value'=> $configuration['cfgValue']);
}
tep_db_free_result($configuration_query);

writeConfiguration($result);
}
foreach ($result as $value) {
define($value['key'],$value['value']);
}
// END REPLACE BY CONFIGURATION CACHES

2. And in file admin/configuration.php
find:
tep_db_query("update " . TABLE_CONFIGURATION . " set configuration_value = '" . tep_db_input($configuration_value) . "', last_modified = now() where configuration_id = '" . (int)$cID . "'");

Replace with below:
// UPDATE CACHE by jason chuh
updateConfiguration();

3.The last change is in file admin/includes/functions/general.php
Append below:

function writeConfiguration(&$var, $filename='configuration.cache') {
$filename = '../cache/' . $filename;
$success = false;

if ($fp = @fopen($filename, 'w')) {
flock($fp, 2); // LOCK_EX
fputs($fp, serialize($var));
flock($fp, 3); // LOCK_UN
fclose($fp);
$success = true;
}

return $success;
}
function updateConfiguration($filename='configuration.cache')
{
$result = array();
$configuration_query = tep_db_query('select configuration_key as cfgKey, configuration_value as cfgValue from ' . TABLE_CONFIGURATION);
while ($configuration = tep_db_fetch_array($configuration_query)) {
$result[] = array('key'=>$configuration['cfgKey'],'value'=> $configuration['cfgValue']);
}
tep_db_free_result($configuration_query);
writeConfiguration($result,$filename);
}

Notice:
Default cache path is set to "catalog/cache",If you want to change it ,find "cache" in above code and replace it.

hopy you enjoy.
   Posted on: 05/17/2009     See contribution details Request Installation with Paid service