diff --git a/file.php b/file.php index 99bc48b..c9d7ec9 100644 --- a/file.php +++ b/file.php @@ -209,6 +209,21 @@ class file } + /** Get the file modification time of a file + * @param string $filename Path to the file + * @return the time the file was last modified, or FALSE on failure. The + * time is returned as a Unix timestamp, which is suitable for the date() + * function. + * @throws If parent directory not exists, is not writeable + */ + public function filemtime ($filename) + { + $this->debug (2, "filemtime ($filename)"); + $filename = $this->realpath ($filename); + $this->checkPathRO (dirname ($filename)); + return filemtime ($filename); + } + /** Return the current working directory * @return string the current working directory */ public function getcwd () @@ -499,8 +514,14 @@ class file $files = array_diff (scandir ($tmpdirname), array('.','..')); foreach ($files as $file) { - (is_dir ("$tmpdirname/$file")) ? $this->rmdir("$dirname/$file") : - unlink ("$tmpdirname/$file"); + if (is_dir ("$tmpdirname/$file")) + { + $this->rmdir("$dirname/$file", $recursive); + } + else + { + unlink ("$tmpdirname/$file"); + } } return rmdir ($tmpdirname); }