file : correct the rmdir recursive
file : add the filemtime function git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@3208 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
25
file.php
25
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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user