mirror of
https://github.com/nextcloud/server.git
synced 2026-03-25 11:54:59 -04:00
Remove user name addition to paths in deleteAll
This commit is contained in:
parent
ec475cbcfa
commit
09ff46eda2
1 changed files with 6 additions and 12 deletions
|
|
@ -138,27 +138,21 @@ abstract class Common implements \OC\Files\Storage\Storage {
|
|||
*/
|
||||
public function deleteAll($directory, $empty = false) {
|
||||
$directory = trim($directory, '/');
|
||||
|
||||
if (!$this->file_exists(\OCP\USER::getUser() . '/' . $directory)
|
||||
|| !$this->is_dir(\OCP\USER::getUser() . '/' . $directory)
|
||||
) {
|
||||
return false;
|
||||
} elseif (!$this->isReadable(\OCP\USER::getUser() . '/' . $directory)) {
|
||||
if (!$this->is_dir($directory) || !$this->isReadable($directory)) {
|
||||
return false;
|
||||
} else {
|
||||
$directoryHandle = $this->opendir(\OCP\USER::getUser() . '/' . $directory);
|
||||
$directoryHandle = $this->opendir($directory);
|
||||
while ($contents = readdir($directoryHandle)) {
|
||||
if ($contents != '.' && $contents != '..') {
|
||||
$path = $directory . "/" . $contents;
|
||||
if (!\OC\Files\Filesystem::isIgnoredDir($contents)) {
|
||||
$path = $directory . '/' . $contents;
|
||||
if ($this->is_dir($path)) {
|
||||
$this->deleteAll($path);
|
||||
} else {
|
||||
$this->unlink(\OCP\USER::getUser() . '/' . $path); // TODO: make unlink use same system path as is_dir
|
||||
$this->unlink($path);
|
||||
}
|
||||
}
|
||||
}
|
||||
//$this->closedir( $directoryHandle ); // TODO: implement closedir in OC_FSV
|
||||
if ($empty == false) {
|
||||
if ($empty === false) {
|
||||
if (!$this->rmdir($directory)) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue