Clear cache by visiting a hidden page?

The place to talk about things that are related to CMS Made simple, but don't fit anywhere else.
Post Reply
User avatar
paulbaker
Dev Team Member
Dev Team Member
Posts: 1465
Joined: Sat Apr 18, 2009 10:09 pm
Contact:

Clear cache by visiting a hidden page?

Post by paulbaker »

Is there a way of running the clear cache command (with a UDT?) without going through the admin area?

I mean so that I can visit a page (not in menu) like domain.com/clearcache.php which would include a call to a UDT which would then clear the cache when visited.

(Background: I had a call from a client who had lost their menu, a clear cache sorted it but in future it would be great to be able to just visit a URL rather than logging in to admin area (which I had to do in the car park of a theme park!))

Thanks
To copy System Information to the forum:
https://docs.cmsmadesimple.org/troubles ... nformation

CMS Made Simple Geekmoots attended:
Nottingham, UK 2012 | Ghent, Belgium 2015 | Leicester, UK 2016
User avatar
Rolf
Power Poster
Power Poster
Posts: 7825
Joined: Wed Apr 23, 2008 7:53 am
Contact:

Re: Clear cache by visiting a hidden page?

Post by Rolf »

Do you have the daily clear cache setting enabled in Global Settings? It might be a better solution.

Grtz. Rolf
- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Image
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm

Re: Clear cache by visiting a hidden page?

Post by calguy1000 »

Clearing the cache should NEVER be done via a frontend request. As you never know exactly what files are needed for that request.

If your system requires you to clear the cache periodically because stuff breaks then: There is something going on that you have not dug hard enough to find. It may be as simple as a disk space or quota issue. But clearing cached files without really knowing the problem you are solving is a bad idea.

As @rolf mentioned, there is a setting in the global settings dialog that will ensure that old cached files are regularly deleted. Be sure you have set it up, I usually configure it to delete cached files older than 15 or 30 days. depending upon the site.

No modules that fool en-masse with the cache will be allowed in the forge. This is because such a module would be breaking the forge rules about module A altering module B's (or the core's data). Additionally, the API function to clear the cache is marked as internal, and undocumented. Modules using internal/undocumented functions or manually deleting files from the cache directory will be removed from the forge.

In the past such problems that were <cough>fixed</cough> by clearing the cache were caused by silly system problems:
a: Time sync problems between the php server, file server, and database server.
b: Silly problems like out of disk space/disk quota.
etc.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
User avatar
paulbaker
Dev Team Member
Dev Team Member
Posts: 1465
Joined: Sat Apr 18, 2009 10:09 pm
Contact:

Re: Clear cache by visiting a hidden page?

Post by paulbaker »

Thanks Rolf and Calguy, I see in Global Settings I can "Remove cache files that are older than the specified number of days". That's useful and I can set it for 1 day but doesn't help if the error occurs just after the daily clear out has occurred.
calguy1000 wrote:If your system requires you to clear the cache periodically because stuff breaks then: There is something going on that you have not dug hard enough to find.
Yes, I certainly take your point there!

Thanks
To copy System Information to the forum:
https://docs.cmsmadesimple.org/troubles ... nformation

CMS Made Simple Geekmoots attended:
Nottingham, UK 2012 | Ghent, Belgium 2015 | Leicester, UK 2016
Post Reply

Return to “The Lounge”