Error in version 2.014

I had this problem with loading the pages in admin section when trying to edit, clone or modify the products.

I received the following error: “Request Timeout



This request takes too long to process, it is timed out by the server. If it should not be timed out, please contact administrator of this web site to increase ‘Connection Timeout’.”



I have the cart on litespeed servers and had not this problem at the installation but when I started to add more products.

However, for the version 2.0.14 this is the modifications done by the cs cart team to solve the problem. Maybe someone can use it:



Replaced the following part of code:

[quote]

private static function _set_cache($name, $data, $tables, $cache_level = NULL)

{

$fname = $name . ‘.’ . $cache_level . ‘.php’;

if (!is_dir(DIR_CACHE)) {

fn_mkdir(DIR_CACHE);

}



$change_cache = false;



if (self::$_cached_keys[$name][‘track’] == true && !empty(self::$_cached_keys[$name . ‘_real_value’]) && self::$_cached_keys[$name . ‘_real_value’] != $data) {

$change_cache = true;

}



if (!empty($data) && (file_exists(DIR_CACHE . $fname) == false || $change_cache == true)) {

fn_file_put_contents(DIR_CACHE . $fname, “<?php\n if ( !defined('AREA') ) { die('Access denied'); }\n \$_cache_data = " . var_export($data, true) . "\n?>”);

[/quote]

with this one:

[quote]

private static function set_cache($name, $data, $tables, $cache_level = NULL)

{

$fname = $name . ‘.’ . $cache_level . ‘.php’;

if (!is_dir(DIR_CACHE)) {

fn_mkdir(DIR_CACHE);

}

if (!strpos($name,'
‘)) {

$direc_cache = DIR_CACHE . $name . ‘/’;

} else {

$direc = substr($name, 0, strpos($name,’_'));

$direc_cache = DIR_CACHE . $direc . ‘/’;

}



if (!is_dir($direc_cache)) {

fn_mkdir($direc_cache);

}



$change_cache = false;



if (self::$_cached_keys[$name][‘track’] == true && !empty(self::$_cached_keys[$name . ‘_real_value’]) && self::$_cached_keys[$name . ‘_real_value’] != $data) {

$change_cache = true;

}



if (!empty($data) && (file_exists($direc_cache . $fname) == false || $change_cache == true)) {

fn_file_put_contents($direc_cache . $fname, "<?php\n if ( !defined('AREA') ) { die('Access denied'); }\n \$_cache_data = " . var_export($data, true) . "\n?>&quo! t;);

[/quote]



and replaced the following part of code:

[quote]

private static function _get_cache($name, $cache_level = NULL)

{

$fname = $name . ‘.’ . $cache_level . ‘.php’;



if (!empty($name) && is_file(DIR_CACHE . $fname) && is_readable(DIR_CACHE . $fname)) {

include(DIR_CACHE . $fname);

if (isset($_cache_data)) {

if (self::$_cached_keys[$name][‘track’] == true) {

self::$_cached_keys[$name . ‘_real_value’] = $_cache_data;

}



self::set($name, $_cache_data);



return true;

} else { // something goes wrong, clean up the cache

fn_rm(DIR_CACHE . $fname);

}

}



return false;

}

[/quote]

with this one:

[quote]

private static function get_cache($name, $cache_level = NULL)

{

$fname = $name . ‘.’ . $cache_level . ‘.php’;

if (!strpos($name,'
‘)) {

$direc_cache = DIR_CACHE . $name . ‘/’;

} else {

$direc = substr($name, 0, strpos($name,’_'));

$direc_cache = DIR_CACHE . $direc . ‘/’;

}

if (!empty($name) && is_file($direc_cache . $fname) && is_readable($direc_cache . $fname)) {

include($direc_cache . $fname);

if (isset($_cache_data)) {

if (self::$_cached_keys[$name][‘track’] == true) {

self::$_cached_keys[$name . ‘_real_value’] = $_cache_data;

}



self::set($name, $_cache_data);



return true;

} else { // something goes wrong, clean up the cache

fn_rm($direc_cache . $fname);

}

}



return false;

}

[/quote]

in the “class.registry.php” file located in the “core” directory, replaced the following part of code:

[quote]

function db_cache_query($query, $value, $args)

{



$cache_name = serialize(array(‘query’ => $query, ‘args’ => $args));



preg_match_all(“/?:(\w+)/”, $query, $m);



Registry::register_cache(‘cquery_’ . md5($cache_name), array_unique($m[1]), CACHE_LEVEL_STATIC);

Registry::set(‘cquery_’ . md5($cache_name), $value);

Registry::register_cache(‘cached_queries’, array(), CACHE_LEVEL_STATIC, true);

[/quote]

with this one:

[quote]

function db_cache_query($query, $value, $args)

{



$cache_name = serialize(array(‘query’ => $query, ‘args’ => $args));



preg_match_all(“/?:(\w+)/”, $query, $m);



Registry::register_cache(‘cquery_’ . md5($cache_name), array_unique($m[1]), CACHE_LEVEL_STATIC);

//Registry::set(‘cquery_’ . md5($cache_name), $value);

Registry::register_cache(‘cached_queries’, array(), CACHE_LEVEL_STATIC, true);

[/quote]

in the “fn.database.php” file located in the “core” directory and replaced the following part of code:

[quote]

Registry::set($key, array($filters, $view_all));

} else {

list($filters, $view_all) = Registry::get($key);

}

[/quote]

with this one:

[quote]

//Registry::set($key, array($filters, $view_all));

} else {

list($filters, $view_all) = Registry::get($key);

}

[/quote]

in the “fn.catalog.php” file located in the “core” directory.



After that clean up the store cache.

In order to do it, you need to log in to your store administration panel and add the “?cc” or “&cc” text to the end of a path on any store page in the browser.



For version 2.1.0 I did not have the modifications, it seems that this functionality was adapted in new versions.

The problem has occurred according to them because there were a lot of files in one directory. That is why it takes a very long time to search a necessary file during cache refresh.

Would make it a lot easier for someone to understand what changes you actually made if:

  1. you used 'code' tags rather than 'quote' tags. This will preserve indentation and not interpret characters as smiley faces.
  2. you clearly commented what was changed and why.



    I have clients running this version but have not seen the problems you describe. Did you review the error_log and mysql log files? If so, what did they reveal?



    I guess it's not clear what you thought the problem was and what your solution was either.