Reenable trashbin after failed rename

After a failed rename, the post_rename hook is not called.
This quickfix makes sure the trashbin storage logic is reenabled
also after a failed rename.
This commit is contained in:
Vincent Petry 2015-03-18 19:22:15 +01:00
parent c2315aa015
commit a9e6eba018
1 changed files with 16 additions and 0 deletions

View File

@ -61,6 +61,22 @@ class Storage extends Wrapper {
self::$disableTrash = false;
}
/**
* Rename path1 to path2 by calling the wrapped storage.
*
* @param string $path1 first path
* @param string $path2 second path
*/
public function rename($path1, $path2) {
$result = $this->storage->rename($path1, $path2);
if ($result === false) {
// when rename failed, the post_rename hook isn't triggered,
// but we still want to reenable the trash logic
self::$disableTrash = false;
}
return $result;
}
/**
* Deletes the given file by moving it into the trashbin.
*