mirror of
https://github.com/processwire/processwire.git
synced 2025-08-25 15:51:37 +02:00
Updates per processwire/processwire-issues#704 with WireTempDir log entries
This commit is contained in:
@@ -104,7 +104,7 @@ class WireFileTools extends Wire {
|
|||||||
$files = @scandir($path);
|
$files = @scandir($path);
|
||||||
if(is_array($files)) foreach($files as $file) {
|
if(is_array($files)) foreach($files as $file) {
|
||||||
if($file == '.' || $file == '..' || strpos($file, '..') !== false) continue;
|
if($file == '.' || $file == '..' || strpos($file, '..') !== false) continue;
|
||||||
$pathname = "$path/$file";
|
$pathname = rtrim($path, '/') . '/' . $file;
|
||||||
if(is_dir($pathname)) {
|
if(is_dir($pathname)) {
|
||||||
$this->rmdir($pathname, $recursive, $options);
|
$this->rmdir($pathname, $recursive, $options);
|
||||||
} else {
|
} else {
|
||||||
|
@@ -276,7 +276,7 @@ class WireTempDir extends Wire {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!$numSubdirs) {
|
if(!$numSubdirs && $path != $this->classRoot && $this->isTempDir($path)) {
|
||||||
// if no subdirectories, we can remove the root
|
// if no subdirectories, we can remove the root
|
||||||
if($this->rmdir($path, true)) {
|
if($this->rmdir($path, true)) {
|
||||||
$success = true;
|
$success = true;
|
||||||
@@ -381,10 +381,13 @@ class WireTempDir extends Wire {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
protected function isTempDir($dir) {
|
protected function isTempDir($dir) {
|
||||||
|
$files = $this->wire('files');
|
||||||
if(!strlen($dir) || !is_dir($dir)) {
|
if(!strlen($dir) || !is_dir($dir)) {
|
||||||
// if given a non-directory return false
|
// if given a non-directory return false
|
||||||
return false;
|
return false;
|
||||||
} else if($this->classRoot && $this->wire('files')->fileInPath($dir, $this->classRoot)) {
|
}
|
||||||
|
if($this->classRoot && $files->fileInPath($dir, $this->classRoot)) {
|
||||||
|
// dir is within classRoot path
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
Reference in New Issue
Block a user