matchattaxoutlet Posted October 30, 2013 Share Posted October 30, 2013 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! Quote Link to comment Share on other sites More sharing options...
bsmither Posted October 30, 2013 Share Posted October 30, 2013 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. Quote Link to comment Share on other sites More sharing options...
matchattaxoutlet Posted November 1, 2013 Author Share Posted November 1, 2013 Thanks, i'll give it a try. just one thing can you confirm that the file should actually be /controllers/controller.index.inc.php Quote Link to comment Share on other sites More sharing options...
bsmither Posted November 1, 2013 Share Posted November 1, 2013 Yes. My post above has been edited. Quote Link to comment Share on other sites More sharing options...
Dirty Butter Posted November 1, 2013 Share Posted November 1, 2013 I was going to give this a try, but want clarification, too. When you say "after the statements that instantiate the Smarty class", do you mean after this line in the //Initialize Smarty section? $GLOBALS['smarty']->error_reporting = E_ALL & ~E_NOTICE; Quote Link to comment Share on other sites More sharing options...
bsmither Posted November 1, 2013 Share Posted November 1, 2013 Yes. Well, it seems the error_reporting line is already there. So, it's just the second line to add. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.