Post by JAY6390 » Sun Oct 09, 2011 9:20 pm

Many people have complained about the race issue with the cache deleting issue in opencart, which causes all those nasty errors to show on your store or in your error logs. Hopefully this will remove that problem for people

Requirements:
- Must be on a Linux machine
- Must have exec enabled
- Must have vqmod 1.0.8 or above (latest version recommended)

Enjoy!

Image


User avatar
Guru Member

Posts

Joined
Wed May 26, 2010 11:47 pm
Location - United Kingdom

Post by dony_b » Tue Oct 11, 2011 12:03 am

Do you have any instructions for this ?

User avatar
Active Member

Posts

Joined
Wed Aug 18, 2010 9:56 pm
Location - Boston, MA

Post by JAY6390 » Tue Oct 11, 2011 12:04 am

Put it in your vqmod/xml/ folder...thats it :)

Image


User avatar
Guru Member

Posts

Joined
Wed May 26, 2010 11:47 pm
Location - United Kingdom

Post by dony_b » Tue Oct 11, 2011 12:14 am

Oho so its just a simple vqmod xml file. is this for admin only ?

User avatar
Active Member

Posts

Joined
Wed Aug 18, 2010 9:56 pm
Location - Boston, MA

Post by JAY6390 » Tue Oct 11, 2011 12:20 am

No, it changes some code in your system/library/cache.php
Basically it will delete files using linux commands rather than php having to do it, if you're on a linux machine
It's to prevent the errors that arise from the race condition of the cache files

Image


User avatar
Guru Member

Posts

Joined
Wed May 26, 2010 11:47 pm
Location - United Kingdom

Post by dony_b » Tue Oct 11, 2011 12:29 am

Im interested in your PAGE CACHING MOD too and was wondering if you have any sort of demo site or result to see this in action.

User avatar
Active Member

Posts

Joined
Wed Aug 18, 2010 9:56 pm
Location - Boston, MA

Post by JAY6390 » Tue Oct 11, 2011 12:33 am

I will have a demo site up shortly. I'm currently working on making improvements to it to allow for gzip output compression, multi currency and multilingual (although these will all be experimental), so a 1.1 version is to be released shortly

Image


User avatar
Guru Member

Posts

Joined
Wed May 26, 2010 11:47 pm
Location - United Kingdom

Post by dony_b » Tue Oct 11, 2011 12:37 am

With this mod no database tables are called when page loads so therefore pages output is static html. Is that how this works?

User avatar
Active Member

Posts

Joined
Wed Aug 18, 2010 9:56 pm
Location - Boston, MA

Post by JAY6390 » Tue Oct 11, 2011 12:39 am

Pretty much yeah, it bypasses the whole of OpenCart for pages until a user is signed in or has items in their cart

Image


User avatar
Guru Member

Posts

Joined
Wed May 26, 2010 11:47 pm
Location - United Kingdom

Post by dony_b » Tue Oct 11, 2011 12:44 am

Does it matter how big the database is ?
For example sometimes Im reluctant to add information pages or products as I think it will increase the database size and affect load time ?

Are all database tables queries called even if they are not on that specific category or product page ?

User avatar
Active Member

Posts

Joined
Wed Aug 18, 2010 9:56 pm
Location - Boston, MA

Post by JAY6390 » Tue Oct 11, 2011 12:47 am

Only the first time a page is loaded after the cache has been cleared. After that, it will take practically no time at all to get the file and serve it

Image


User avatar
Guru Member

Posts

Joined
Wed May 26, 2010 11:47 pm
Location - United Kingdom

Post by dony_b » Tue Oct 11, 2011 12:50 am

So is it better to have my content pages separate from OC to a differnt CMS rather than overloading the OC database ? Or it doesn't matter

User avatar
Active Member

Posts

Joined
Wed Aug 18, 2010 9:56 pm
Location - Boston, MA

Post by JAY6390 » Tue Oct 11, 2011 12:52 am

If it's in OC, it won't make a difference to be honest. Another CMS might cache the data better though

Image


User avatar
Guru Member

Posts

Joined
Wed May 26, 2010 11:47 pm
Location - United Kingdom

Post by anti91 » Thu Dec 29, 2011 9:03 am

is it clear image Cache ? and is it compatible with 1.5.1.1 ?

Thanks

New member

Posts

Joined
Tue Aug 30, 2011 8:27 am

Post by JAY6390 » Thu Dec 29, 2011 11:03 am

It clears the cache folder (for sql queries, countries etc). Certain cache files get cleared every time you update information in the admin. This does it via the command line rather than using php's inbuilt functions, making it MUCH faster and preventing the ugly error messages sometimes seen due to the race condition of the original cache clearing

Image


User avatar
Guru Member

Posts

Joined
Wed May 26, 2010 11:47 pm
Location - United Kingdom

Post by ecoleman » Mon Jan 16, 2012 7:37 am

Please excuse me if I'm wrong, my PHP knowledge is limited, but are you sure this file is correct?

You say that for this to work it must be a linux system, but your script is returning false if PHP_OS = linux

if(!defined('PHP_OS') || strtolower(PHP_OS) == 'linux') return false;
should this not be
if(!defined('PHP_OS') || strtolower(PHP_OS) != 'linux') return false;

Also this section here doesn't make sense.

$disabled = explode(',', ini_get('disable_functions'));
return in_array('exec');

This would surely return true of exec is found in the disabled array. Surely you want to be returning false if exec is found.
Also should it not be

return in_array('exec', $disabled);

Again, sorry if I am totally wrong here, but I am having major issues with category cache and this has not really solved the problem. I have not tried to re-write it yet as I wanted to make sure it was indeed correct before I messed with it.

Cheers
elliott

Colour Code you orders by Order Status


Active Member

Posts

Joined
Tue Dec 06, 2011 3:34 am

Post by JAY6390 » Tue Jan 17, 2012 12:33 am

Hi Elliot

Yes you are right. I have no idea why they were wrong. I actually tested this on a server working, but must have made some crazy edits afterwards :crazy:

I've fixed the file. Either that, or I was very drunk :D :drunk:

Cheers
Jay

Image


User avatar
Guru Member

Posts

Joined
Wed May 26, 2010 11:47 pm
Location - United Kingdom

Post by ecoleman » Tue Jan 17, 2012 12:36 am

:joker: Yay, I was right !!!!!

Thanks for confirming that. I'll update it now.

Colour Code you orders by Order Status


Active Member

Posts

Joined
Tue Dec 06, 2011 3:34 am

Post by ecoleman » Tue Jan 17, 2012 12:40 am

Now, I'm on a roll

I still think this is wrong though.

if(!defined('PHP_OS') || strtolower(PHP_OS) != 'linux') return false;
$disabled = explode(',', ini_get('disable_functions'));
return in_array('exec', $disabled);
}

If 'exec' is found in the $disabled array then we should be returning false not true which it is currently doing.
The calling argument is

if($this->allow_exec()) {

but if it is in the disabled list then we can not allow_exec

Colour Code you orders by Order Status


Active Member

Posts

Joined
Tue Dec 06, 2011 3:34 am
Who is online

Users browsing this forum: No registered users and 4 guests