1010use OC \Files \Storage \Wrapper \Wrapper ;
1111use OCA \Files_Trashbin \Events \MoveToTrashEvent ;
1212use OCA \Files_Trashbin \Trash \ITrashManager ;
13+ use OCP \App \IAppManager ;
1314use OCP \Encryption \Exceptions \GenericEncryptionException ;
1415use OCP \EventDispatcher \IEventDispatcher ;
1516use OCP \Files \IRootFolder ;
1617use OCP \Files \Node ;
1718use OCP \Files \Storage \IStorage ;
19+ use OCP \IRequest ;
1820use OCP \IUserManager ;
21+ use OCP \Server ;
1922use Psr \Log \LoggerInterface ;
2023
2124class Storage extends Wrapper {
@@ -159,18 +162,7 @@ private function doDelete($path, $method) {
159162 return call_user_func ([$ this ->storage , $ method ], $ path );
160163 }
161164
162- // check permissions before we continue, this is especially important for
163- // shared files
164- if (!$ this ->isDeletable ($ path )) {
165- return false ;
166- }
167-
168- $ isMovedToTrash = $ this ->trashManager ->moveToTrash ($ this , $ path );
169- if (!$ isMovedToTrash ) {
170- return call_user_func ([$ this ->storage , $ method ], $ path );
171- } else {
172- return true ;
173- }
165+ return call_user_func ([$ this ->storage , $ method ], $ path );
174166 }
175167
176168 /**
@@ -182,16 +174,18 @@ public static function setupStorage() {
182174 $ logger = \OC ::$ server ->get (LoggerInterface::class);
183175 $ eventDispatcher = \OC ::$ server ->get (IEventDispatcher::class);
184176 $ rootFolder = \OC ::$ server ->get (IRootFolder::class);
177+ $ request = \OC ::$ server ->get (IRequest::class);
185178 Filesystem::addStorageWrapper (
186179 'oc_trashbin ' ,
187- function (string $ mountPoint , IStorage $ storage ) use ($ trashManager , $ userManager , $ logger , $ eventDispatcher , $ rootFolder ) {
180+ function (string $ mountPoint , IStorage $ storage ) use ($ trashManager , $ userManager , $ logger , $ eventDispatcher , $ rootFolder, $ request ) {
188181 return new Storage (
189182 ['storage ' => $ storage , 'mountPoint ' => $ mountPoint ],
190183 $ trashManager ,
191184 $ userManager ,
192185 $ logger ,
193186 $ eventDispatcher ,
194187 $ rootFolder ,
188+ $ request ,
195189 );
196190 },
197191 1 );
0 commit comments