Skip to content

Commit

Permalink
Test the filemtime php function. On special filesystem this function …
Browse files Browse the repository at this point in the history
…do not work as expected (ex: NFS, VZFS)

git-svn-id: https://phpfreechat.svn.sourceforge.net/svnroot/phpfreechat/trunk@1200 2772adf2-ac07-0410-9d30-e29d8120292e
  • Loading branch information
kerphi committed Oct 28, 2007
1 parent e6a86ef commit 15d7e56
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions testcase/filemtime.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

$filename = dirname(__FILE__).'/'.basename(__FILE__).'.data';
$timetowait = 3;
if (!is_writable(dirname($filename))) die($filename.' is not writable');
file_put_contents($filename,'some-data1-'.time());
clearstatcache();
$time1 = filemtime($filename);
sleep($timetowait);
file_put_contents($filename,'some-data2-'.time());
clearstatcache();
$time2 = filemtime($filename);
unlink($filename);
echo ($time2-$time1 == $timetowait) ? "filemtime test passed successfully\n" : "filemtime test failed\n";

?>

0 comments on commit 15d7e56

Please sign in to comment.