Contributions
Faster Page Loads, Less DB queries
This contribution is to help with page loading times, and with DB queries. Every time a page loads osCommerce,
PHP pulls every row from the configuration table in the database. That's over 170 rows every time, every page load.
I decided to be daring, I am sure against osc developers wishes, but I think this is worth mentioning.
PLEASE KNOW WHAT YOU ARE DOING AND HOW TO HANDLE FILE PERMISSIONS AND REMEMBER TO BACKUP FIRST!!!
How it works:
Every time someone edits a configuration from the configuration box in admin and hits "save" or "submit", the script writes a php file in the folder of your choice (preferably outside the www root) with all the configs from the database. Then, when each page loads, it calls all these configs as an include file, already pulled from the database, instead of querying the database each time and performing the function. I noticed improvement in page load times. Here are some page parse times:
before this change:
08/02/2004 01:55:25 - /index.php?cPath=13 (0.198s)
after the change:
08/02/2004 01:56:14 - /index.php?cPath=13 (0.092s)
Expand All / Collapse All
While fooling around i found that the modules.php could insert a row in the configurations table
with an empty configuration_key, resulting in the cache function inserted;
define('', '');
Thus the cached config file got currupted and issuing an error both in catalog and admin.
To handle this and to secure other contribs don't imply this error, please replace following line;
$configuration_query = tep_db_query('select configuration_key as cfgKey, configuration_value as cfgValue from ' . TABLE_CONFIGURATION);
With;
$configuration_query = tep_db_query("select configuration_key as cfgKey, configuration_value as cfgValue from " . TABLE_CONFIGURATION . " where configuration_key != ''");
The file to download is just a dummy textfile, containing this text. No more no less.
Best Regards,
Phliplip ;)
When saving module parameters, or adding/removing a module, cache file was not updated.
- Installation instructions for MS2 version have been modified (section 5, admin/modules.php).
- Installation instructions for MS1 version have not been modified as I don't know if same bug is present.
- Previous minor bug updates integrated in this full version.
for french and others who use accent like:
l'apostrophe:
configuration_cache.php, line 17:
replace:
$config_cache_output .= 'define(' . $configuration['cfgKey'] . ','' . $configuration['cfgValue'] . ''); ' . "n";
with:
$config_cache_output .= 'define(' . $configuration['cfgKey'] . ','' . addslashes($configuration['cfgValue']) . ''); ' . "n";
Minor fixes.
Just replace the adminincludesconfiguration_cache.php file if you already have this contribution installed.
Same as below except the documentation has been corrected in the MS1 install instructions.
Found a fatal flaw in the previous versions and re-wrote the code accordingly and updated the install instructions.
If you have a previous version of this contribution, it is *highly* recommended to uninstall it and use this version.
Updated to store configuration values in db, provide for compressing the cache file, and numerous other changes.
Updated the contribution to update the cache file when the modules (e.g. payment) are modified based upon dreamscape's suggestion.
Support thread is here: <a href="http://forums.oscommerce.com/index.php?showtopic=83315">osCommerce support forums</a>.
The install instructions for MS1 contained a few errors, which have been corrected.
Modified the contribution to contain HTML instructions and updated the code for less overhead and to accommodate for a missing configuration file.
Also changed the name to be a little more descriptive.
By request, instructions for MS1 are now included.
Also made instructions more clear.
This contribution is very simple to install, only changing 3 files.
This contribution is to help with page loading times, and with DB queries. Every time a page loads osCommerce,
PHP pulls every row from the configuration table in the database. That's over 170 rows every time, every page load.
I decided to be daring, I am sure against osc developers wishes, but I think this is worth mentioning.
PLEASE KNOW WHAT YOU ARE DOING AND HOW TO HANDLE FILE PERMISSIONS AND REMEMBER TO BACKUP FIRST!!!
How it works:
Every time someone edits a configuration from the configuration box in admin and hits "save" or "submit", the script writes a php file in the folder of your choice (preferably outside the www root) with all the configs from the database. Then, when each page loads, it calls all these configs as an include file, already pulled from the database, instead of querying the database each time and performing the function. I noticed improvement in page load times. Here are some page parse times:
before this change:
08/02/2004 01:55:25 - /index.php?cPath=13 (0.198s)
after the change:
08/02/2004 01:56:14 - /index.php?cPath=13 (0.092s)
Note: Contributions are used at own risk.