Jump to content

Error messages in log


matchattaxoutlet

Recommended Posts

Hi,

 

My error logs are full  of hundreds the following type of error, occurring at varying intervals, the only thing differing in each line is the filename ending in .cache.

 

[25-Oct-2013 08:16:44 Europe/London] PHP Warning:  unlink(/home/xxxxx/public_html/cache/89e12.sql.a1cb2ebcda10fd4d50ae9ae7b34addbd.cache) [<a href='http://docs.php.net/manual/en/function.unlink.php'>function.unlink.php</a>]: No such file or directory in /home/xxxxx/public_html/classes/cache/file.class.php on line 70

 

Any ideas on the cause of this?

 

All help gratefully received!

Link to comment
Share on other sites

This is a known issue with Smarty, the template rendering engine.

 

For reasons not well explained on the Smarty site, these entries in the error log is a by-product of how Smarty, by design, does not quash errors itself causes.

 

Each cached template file has a lifetime. If Smarty determines the cached template has expired, Smarty will have PHP unlink() - that is, delete - that file and Smarty will build and cache a fresh rendered template.

 

The problem comes up when the admin, either manually or because of some other admin function, "clears the cache".

 

Here's where things get murky: PHP somehow internally remembers the contents of folders. So when Smarty asks the filesystem for a file in the cache folder, and it's not there, but PHP remembers it being there, one or two warnings are generated: mstat() failed and unlink() failed. Murky! This is the best that I understand it.

 

The Smarty docs say a statement can be put in the application's code that will have Smarty catch and discard these known warnings before they get to PHP's error logging capability.

 

What I have done is this:

In the file /controllers/controller.index.php /controllers/controller.index.inc.php, after the statements that instantiate the Smarty class, add:

$GLOBALS['smarty']->error_reporting = E_ALL & ~E_NOTICE;

$GLOBALS['smarty']->muteExpectedErrors();

 

I haven't conclusively verified that these statements make any difference, but I do not have any mstat or unlink log entries either.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...