1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-13 02:04:35 +02:00

Add new $files->unlink() and $files->rename() methods to files API var, plus enhance many file methods with additional security for path verification, and update PW's various usages of unlink/rename to use the new versions provided by the files API var.

This commit is contained in:
Ryan Cramer
2018-10-31 09:30:15 -04:00
parent 0f9eb0aaf5
commit 54537e77fa
23 changed files with 359 additions and 91 deletions

View File

@@ -369,8 +369,8 @@ class WireTempDir extends Wire {
$dir = $this->wire('files')->unixDirName($dir);
if(!strlen($dir) || !is_dir($dir)) return true;
if(!$this->isTempDir($dir)) return false;
if(is_file($dir . self::hiddenFileName)) unlink($dir . self::hiddenFileName);
return $this->wire('files')->rmdir($dir, $recursive);
if(is_file($dir . self::hiddenFileName)) $this->wire('files')->unlink($dir . self::hiddenFileName, true);
return $this->wire('files')->rmdir($dir, $recursive, true);
}
/**