Bugs in Ultimate SEO 2.212
I was profiling my website and found two bugs causing category names and manufacturer names to not cache in memory. This would cause additional database queries to the categories_description, categories, and manufacturers tables. It would not be noticeable to the user except for slower performance. The file and problem is listed below.
Version 2.212 in file: includes/classes/seo.url.php
1. ---- line 1021 --- function generate_manufacturers_cache()
PHP Code:
$define = 'define(\'MANUFACTURER_NAME_' . $manufacturer->fields['id'] . '\', \'' . $this->filter($manufacturer->fields['name']) . '\');';
SHOULD BE:
PHP Code:
$define = 'define(\'MANUFACTURER_NAME_' . $manufacturers->fields['id'] . '\', \'' . $this->filter($manufacturers->fields['name']) . '\');';
2. ---- line 1059 ---- function generate_categories_cache()
PHP Code:
$cPath = $this->get_full_cPath($category->fields['categories_id'], $single_cID);
SHOULD BE:
PHP Code:
$cPath = $this->get_full_cPath($category->fields['id'], $single_cID);
3. If anyone makes these changes, you need to flush the SEO_CACHE table from a MySQL shell:
Code:
DELETE FROM seo_cache;
It will regenerate on the next page load.
-------------------------------------------------
After making a cursory look at the other downloadable ZIP flies it appears versions 2.x have the manufacturers bug and versions between 2.212 and 2.210 have the categories bug; however, on different line numbers. I did not look at other versions.
FYI: I'm running versions: Ultimate SEO 2.212 and Zen-cart 1.5.1
-------------------------------------------------
OPTIONAL: If you want to verify if this bug is occurring, you can insert the following code at the bottom of your index page.
Please do not run on a publicly accessible live site.
Categories and manufacturers caches must be turned on:
Admin -> Configuration -> UltimateSEO: Enable categories cache? and Enable manufacturers cache?
PHP Code:
<?php
echo "<pre>CONSTANTS\n";
$def = get_defined_constants();
while(list($key,$val) = each($def)) {
if(is_string($val)) {
if (strpos($key, 'CATEGORY_NAME_') === 0 || strpos($key, 'MANUFACTURER_NAME_') === 0) {
echo "define ", $key, '=', $val, "\n";
}
}
}
echo "\n</pre>\n";
?>
Before fixing you should see only two malformed records like below:
Code:
CONSTANTS
define CATEGORY_NAME_=category-name-here
define MANUFACTURER_NAME_=
After fixing and wiping 'seo_cache' table you should see a lot of records similar to below:
Code:
CONSTANTS
define CATEGORY_NAME_101=category-name-here
define CATEGORY_NAME_102=category-name-here
define CATEGORY_NAME_103=category-name-here
define CATEGORY_NAME_104=category-name-here
define MANUFACTURER_NAME_102=manufacturer-name-here
define MANUFACTURER_NAME_103=manufacturer-name-here
define MANUFACTURER_NAME_104=manufacturer-name-here
define MANUFACTURER_NAME_105=manufacturer-name-here
...
Bookmarks