parent::__construct($parameters);
}
- /**
- * Deletes the given file by moving it into the trashbin.
- *
- * @param string $path path of file or folder to delete
- *
- * @return bool true if the operation succeeded, false otherwise
- */
- public function unlink($path) {
+ public function unlink($path): bool {
if ($this->trashEnabled) {
try {
return $this->doDelete($path, 'unlink');
}
}
- /**
- * Deletes the given folder by moving it into the trashbin.
- *
- * @param string $path path of folder to delete
- *
- * @return bool true if the operation succeeded, false otherwise
- */
- public function rmdir($path) {
+ public function rmdir($path): bool {
if ($this->trashEnabled) {
return $this->doDelete($path, 'rmdir');
} else {
* @param $path
* @return bool
*/
- protected function shouldMoveToTrash($path) {
+ protected function shouldMoveToTrash($path): bool {
$normalized = Filesystem::normalizePath($this->mountPoint . '/' . $path);
$parts = explode('/', $normalized);
if (count($parts) < 4 || strpos($normalized, '/appdata_') === 0) {
* @param Node $node
* @return MoveToTrashEvent
*/
- protected function createMoveToTrashEvent(Node $node) {
+ protected function createMoveToTrashEvent(Node $node): MoveToTrashEvent {
return new MoveToTrashEvent($node);
}
*
* @return bool true if the operation succeeded, false otherwise
*/
- private function doDelete($path, $method) {
+ private function doDelete($path, $method): bool {
if (
!\OC::$server->getAppManager()->isEnabledForUser('files_trashbin')
|| (pathinfo($path, PATHINFO_EXTENSION) === 'part')
/**
* Setup the storage wrapper callback
*/
- public static function setupStorage() {
+ public static function setupStorage(): void {
$trashManager = \OC::$server->get(ITrashManager::class);
$userManager = \OC::$server->get(IUserManager::class);
$logger = \OC::$server->get(LoggerInterface::class);
return $this->mountPoint;
}
- public function moveFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath) {
+ public function moveFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath): bool {
$sourceIsTrashbin = $sourceStorage->instanceOfStorage(Storage::class);
try {
// the fallback for moving between storage involves a copy+delete
}
}
- protected function disableTrash() {
+ protected function disableTrash(): void {
$this->trashEnabled = false;
}
- protected function enableTrash() {
+ protected function enableTrash(): void {
$this->trashEnabled = true;
}
}
use Test\Traits\MountProviderTrait;
class TemporaryNoCross extends Temporary {
- public function copyFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath, $preserveMtime = null) {
+ public function copyFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath, $preserveMtime = null): bool {
return Common::copyFromStorage($sourceStorage, $sourceInternalPath, $targetInternalPath, $preserveMtime);
}
- public function moveFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath) {
+ public function moveFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath): bool {
return Common::moveFromStorage($sourceStorage, $sourceInternalPath, $targetInternalPath);
}
}