Plesk web stat not updating

It even does recursive directories if you set the $do Recursive param to true.

Based on a file/directory list function I saw somewhere on this site. is_dir($dir Name."/".$entry)) { $current Modified = filemtime($dir Name."/".$entry); } else if ($do Recursive && is_dir($dir Name."/".$entry)) { $current Modified = most Recent Modified File Time($dir Name."/".$entry,true); } if ($current Modified There's a deeply-seated problem with filemtime() under Windows due to the fact that it calls Windows' stat() function, which implements DST (according to this bug: The detection of DST on the time of the file is confused by whether the CURRENT time of the current system is currently under DST.

;)function most Recent Modified File Time($dir Name,$do Recursive) { $d = dir($dir Name); $last Modified = 0; while($entry = $d-read()) { if ($entry ! This is a fix for the mother of all annoying bugs: If PHP's integer type is only 32 bits on your system, filemtime() will fail on files over 2GB with the warning "stat failed".

As a workaround, you can call the system's stat command to get the modification time of a file: On Free BSD:$mtime = exec ('stat -f %m '.

escapeshellarg ($path)); On Linux:$mtime = exec ('stat -c %Y '.

escapeshellarg ($path)); Thanks to "mpb dot mail at gmail dot com" for his/her similar comment on stat().

This is a very handy function for dealing with browser caching.

For example, say you have a stylesheet and you want to make sure everyone has the most recent version.

You could rename it every time you edit it, but that would be a pain in the ass.

Instead, you can do this: Take note on the last dot which is needed to see the directory as a file and to actually get a last modification date of it.

This comes in handy when you want just one 'last updated' message on the frontpage of your website and still taking all files of your website into account.

Regards, Frank Keijzers While testing on Windows, I noticed that the precision of filemtime is just 1 second.

Tags: , ,