2007-07-21 17:35:37 +00:00
|
|
|
--TEST--
|
2007-07-26 13:38:24 +00:00
|
|
|
Test lstat() and stat() functions: usage variations - effects of touch() on dir
|
2007-07-21 17:35:37 +00:00
|
|
|
--SKIPIF--
|
|
|
|
<?php
|
|
|
|
if (substr(PHP_OS, 0, 3) == 'WIN') {
|
2007-07-26 13:38:24 +00:00
|
|
|
die('skip.. Not valid for Windows');
|
2007-07-21 17:35:37 +00:00
|
|
|
}
|
|
|
|
?>
|
2007-07-26 13:38:24 +00:00
|
|
|
?>
|
2007-07-21 17:35:37 +00:00
|
|
|
--FILE--
|
|
|
|
<?php
|
|
|
|
/* Prototype: array lstat ( string $filename );
|
|
|
|
Description: Gives information about a file or symbolic link
|
|
|
|
|
|
|
|
Prototype: array stat ( string $filename );
|
|
|
|
Description: Gives information about a file
|
|
|
|
*/
|
|
|
|
|
2007-07-26 13:38:24 +00:00
|
|
|
/* test the effects of touch() on stats of dir */
|
2007-07-21 17:35:37 +00:00
|
|
|
|
|
|
|
$file_path = dirname(__FILE__);
|
|
|
|
require "$file_path/file.inc";
|
|
|
|
|
|
|
|
|
2007-07-26 13:38:24 +00:00
|
|
|
/* create temp directory */
|
2007-07-21 17:35:37 +00:00
|
|
|
|
2007-07-26 13:38:24 +00:00
|
|
|
$dir_name = "$file_path/lstat_stat_variation5";
|
|
|
|
mkdir($dir_name); // temp dir
|
2007-07-21 17:35:37 +00:00
|
|
|
|
2007-07-26 13:38:24 +00:00
|
|
|
// touch a directory and check stat, there should be difference in atime
|
|
|
|
echo "*** Testing stat() for directory after using touch() on the directory ***\n";
|
|
|
|
$old_stat = stat($dir_name);
|
|
|
|
// clear the cache
|
2007-07-21 17:35:37 +00:00
|
|
|
clearstatcache();
|
|
|
|
sleep(2);
|
2007-07-26 13:38:24 +00:00
|
|
|
var_dump( touch($dir_name) );
|
|
|
|
$new_stat = stat($dir_name);
|
2007-07-21 17:35:37 +00:00
|
|
|
|
|
|
|
// compare self stats
|
|
|
|
var_dump( compare_self_stat($old_stat) );
|
|
|
|
var_dump( compare_self_stat($new_stat) );
|
|
|
|
|
|
|
|
// compare the stat
|
2007-07-26 13:38:24 +00:00
|
|
|
$affected_members = array(8, 9, 10, 'atime', 'mtime', 'ctime');
|
|
|
|
var_dump( compare_stats($old_stat, $new_stat, $affected_members, "<") );
|
|
|
|
// clear the cache
|
|
|
|
clearstatcache();
|
2007-07-21 17:35:37 +00:00
|
|
|
|
|
|
|
echo "\n--- Done ---";
|
|
|
|
?>
|
|
|
|
|
|
|
|
--CLEAN--
|
|
|
|
<?php
|
|
|
|
$file_path = dirname(__FILE__);
|
|
|
|
rmdir("$file_path/lstat_stat_variation5");
|
|
|
|
?>
|
|
|
|
--EXPECTF--
|
2007-07-26 13:38:24 +00:00
|
|
|
*** Testing stat() for directory after using touch() on the directory ***
|
2007-07-21 17:35:37 +00:00
|
|
|
bool(true)
|
|
|
|
bool(true)
|
|
|
|
bool(true)
|
|
|
|
bool(true)
|
|
|
|
|
|
|
|
--- Done ---
|