added some logs

This commit is contained in:
Diego Najar 2019-05-27 19:07:53 +02:00
parent 95448a76c3
commit baa835cb8c
1 changed files with 6 additions and 1 deletions

View File

@ -57,16 +57,19 @@ class Filesystem {
public static function rmdir($pathname) public static function rmdir($pathname)
{ {
Log::set('rmdir = '.$pathname, LOG_TYPE_INFO);
return rmdir($pathname); return rmdir($pathname);
} }
public static function mv($oldname, $newname) public static function mv($oldname, $newname)
{ {
Log::set('mv '.$oldname.' '.$newname, LOG_TYPE_INFO);
return rename($oldname, $newname); return rename($oldname, $newname);
} }
public static function rmfile($filename) public static function rmfile($filename)
{ {
Log::set('rmfile = '.$filename, LOG_TYPE_INFO);
return unlink($filename); return unlink($filename);
} }
@ -123,6 +126,8 @@ class Filesystem {
// The directory is delete // The directory is delete
public static function deleteRecursive($source, $deleteDirectory=true) public static function deleteRecursive($source, $deleteDirectory=true)
{ {
Log::set('deleteRecursive = '.$source, LOG_TYPE_INFO);
if (!self::directoryExists($source)) { if (!self::directoryExists($source)) {
return false; return false;
} }
@ -130,7 +135,7 @@ class Filesystem {
foreach (new RecursiveIteratorIterator( foreach (new RecursiveIteratorIterator(
new RecursiveDirectoryIterator($source, FilesystemIterator::SKIP_DOTS), new RecursiveDirectoryIterator($source, FilesystemIterator::SKIP_DOTS),
RecursiveIteratorIterator::CHILD_FIRST) as $item) { RecursiveIteratorIterator::CHILD_FIRST) as $item) {
if ($item->isFile()) { if ($item->isFile() || $item->isLink()) {
unlink($item); unlink($item);
} else { } else {
rmdir($item); rmdir($item);