Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[trashbin] replace hook with storage wrapper #13377

Merged
merged 1 commit into from
Jan 19, 2015

Conversation

schiessle
Copy link
Contributor

This is a minimal approach to replace the delete hook with a storage wrapper. This allows us to perform a move instead of a copy while moving files to the trash bin which will give us a huge performance improvement.

cc @DeepDiver1975 @icewind1991

@DeepDiver1975
Copy link
Member

@schiesbn

local unit test execution helps ;-)

00:02:13.738 PHP Fatal error:  Class 'OCA\Files_Trashbin\OCP\Util' not found in /var/jenkins/workspace/pull-request-analyser-ng-simple@5/label/SLAVE/apps/files_trashbin/lib/trashbin.php on line 927
00:02:13.738 PHP Stack trace:
00:02:13.738 PHP   1. {main}() /usr/local/bin/phpunit:0
00:02:13.738 PHP   2. PHPUnit_TextUI_Command::main() /usr/local/bin/phpunit:612
00:02:13.738 PHP   3. PHPUnit_TextUI_Command->run() phar:///usr/local/bin/phpunit/phpunit/TextUI/Command.php:138
00:02:13.738 PHP   4. PHPUnit_TextUI_Command->handleArguments() phar:///usr/local/bin/phpunit/phpunit/TextUI/Command.php:148
00:02:13.738 PHP   5. PHPUnit_TextUI_Command->handleBootstrap() phar:///usr/local/bin/phpunit/phpunit/TextUI/Command.php:651
00:02:13.738 PHP   6. PHPUnit_Util_Fileloader::checkAndLoad() phar:///usr/local/bin/phpunit/phpunit/TextUI/Command.php:817
00:02:13.738 PHP   7. PHPUnit_Util_Fileloader::load() phar:///usr/local/bin/phpunit/phpunit/Util/Fileloader.php:77
00:02:13.738 PHP   8. include_once() phar:///usr/local/bin/phpunit/phpunit/Util/Fileloader.php:93
00:02:13.738 PHP   9. OC_App::loadApps() /var/jenkins/workspace/pull-request-analyser-ng-simple@5/label/SLAVE/tests/bootstrap.php:15
00:02:13.739 PHP  10. OC_App::loadApp() /var/jenkins/workspace/pull-request-analyser-ng-simple@5/label/SLAVE/lib/private/app.php:77
00:02:13.739 PHP  11. OC_App::requireAppFile() /var/jenkins/workspace/pull-request-analyser-ng-simple@5/label/SLAVE/lib/private/app.php:98
00:02:13.739 PHP  12. require_once() /var/jenkins/workspace/pull-request-analyser-ng-simple@5/label/SLAVE/lib/private/app.php:117
00:02:13.739 PHP  13. OCA\Files_Trashbin\Trashbin::registerHooks() /var/jenkins/workspace/pull-request-analyser-ng-simple@5/label/SLAVE/apps/files_trashbin/appinfo/app.php:5
00:02:13.986 Build step 'Execute shell' marked build as failure

@DeepDiver1975
Copy link
Member

local unit test execution helps ;-)

and using a proper ide 🙊

@DeepDiver1975 DeepDiver1975 added this to the 8.0-current milestone Jan 15, 2015
private $mountPoint;
// remember already deleted files to avoid infinite loop if the trash bin
// move files across storages
private static $deletedFiles = array();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this have to be static? I mean: will there ever be files being deleted in two different storage implementations?

@MorrisJobke
Copy link
Contributor

@schiesbn Can I ask you to label your PRs too? something like "4 - Developing" for WIP PRs or "5 - To review" for ready to review PRs. Then stuff like "app:files_trashbin" to label the component. This helps a lot to master the huge amount of PRs/issues and are just 3 clicks away ;)

@MorrisJobke
Copy link
Contributor

There were 4 errors:
00:38:10.273 
00:38:10.273 1) Test_Files_Sharing_Mount::testMoveGroupShare
00:38:10.275 Invalid argument supplied for foreach()
00:38:10.275 
00:38:10.275 /var/jenkins/workspace/pull-request-analyser-ng-simple@2/label/SLAVE/lib/private/files/cache/scanner.php:226
00:38:10.275 /var/jenkins/workspace/pull-request-analyser-ng-simple@2/label/SLAVE/lib/private/files/cache/scanner.php:248
00:38:10.275 /var/jenkins/workspace/pull-request-analyser-ng-simple@2/label/SLAVE/lib/private/files/cache/scanner.php:216
00:38:10.275 /var/jenkins/workspace/pull-request-analyser-ng-simple@2/label/SLAVE/lib/private/files/view.php:930
00:38:10.275 /var/jenkins/workspace/pull-request-analyser-ng-simple@2/label/SLAVE/lib/private/files/filesystem.php:782
00:38:10.275 /var/jenkins/workspace/pull-request-analyser-ng-simple@2/label/SLAVE/apps/files_trashbin/lib/trashbin.php:39
00:38:10.275 /var/jenkins/workspace/pull-request-analyser-ng-simple@2/label/SLAVE/apps/files_trashbin/lib/trashbin.php:145
00:38:10.275 /var/jenkins/workspace/pull-request-analyser-ng-simple@2/label/SLAVE/apps/files_trashbin/lib/storage.php:48
00:38:10.275 /var/jenkins/workspace/pull-request-analyser-ng-simple@2/label/SLAVE/lib/private/files/view.php:792
00:38:10.275 /var/jenkins/workspace/pull-request-analyser-ng-simple@2/label/SLAVE/lib/private/files/view.php:437
00:38:10.275 /var/jenkins/workspace/pull-request-analyser-ng-simple@2/label/SLAVE/apps/files_sharing/tests/sharedmount.php:45
00:38:10.276 
00:38:10.276 2) Test_Files_Sharing::testUnshareFromSelf
00:38:10.277 OCA\Files_Sharing\Exceptions\BrokenPath: Path does not start with /user/files
00:38:10.277 
00:38:10.277 /var/jenkins/workspace/pull-request-analyser-ng-simple@2/label/SLAVE/apps/files_sharing/lib/sharedmount.php:103
00:38:10.277 /var/jenkins/workspace/pull-request-analyser-ng-simple@2/label/SLAVE/apps/files_sharing/lib/sharedmount.php:121
00:38:10.277 /var/jenkins/workspace/pull-request-analyser-ng-simple@2/label/SLAVE/lib/private/files/view.php:499
00:38:10.277 /var/jenkins/workspace/pull-request-analyser-ng-simple@2/label/SLAVE/apps/files_trashbin/lib/trashbin.php:170
00:38:10.277 /var/jenkins/workspace/pull-request-analyser-ng-simple@2/label/SLAVE/apps/files_trashbin/lib/storage.php:48
00:38:10.277 /var/jenkins/workspace/pull-request-analyser-ng-simple@2/label/SLAVE/lib/private/files/view.php:792
00:38:10.277 /var/jenkins/workspace/pull-request-analyser-ng-simple@2/label/SLAVE/lib/private/files/view.php:437
00:38:10.277 /var/jenkins/workspace/pull-request-analyser-ng-simple@2/label/SLAVE/apps/files_sharing/tests/share.php:53
00:38:10.277 
00:38:10.277 3) Test_Files_Sharing::testShareAndUnshareFromSelf
00:38:10.278 OCA\Files_Sharing\Exceptions\BrokenPath: Path does not start with /user/files
00:38:10.278 
00:38:10.278 /var/jenkins/workspace/pull-request-analyser-ng-simple@2/label/SLAVE/apps/files_sharing/lib/sharedmount.php:103
00:38:10.278 /var/jenkins/workspace/pull-request-analyser-ng-simple@2/label/SLAVE/apps/files_sharing/lib/sharedmount.php:121
00:38:10.278 /var/jenkins/workspace/pull-request-analyser-ng-simple@2/label/SLAVE/lib/private/files/view.php:499
00:38:10.278 /var/jenkins/workspace/pull-request-analyser-ng-simple@2/label/SLAVE/apps/files_trashbin/lib/trashbin.php:170
00:38:10.278 /var/jenkins/workspace/pull-request-analyser-ng-simple@2/label/SLAVE/apps/files_trashbin/lib/storage.php:48
00:38:10.278 /var/jenkins/workspace/pull-request-analyser-ng-simple@2/label/SLAVE/lib/private/files/view.php:792
00:38:10.278 /var/jenkins/workspace/pull-request-analyser-ng-simple@2/label/SLAVE/lib/private/files/view.php:437
00:38:10.278 /var/jenkins/workspace/pull-request-analyser-ng-simple@2/label/SLAVE/apps/files_sharing/tests/share.php:53
00:38:10.278 
00:38:10.278 4) Test_Files_Sharing::testShareWithDifferentShareFolder
00:38:10.280 Exception: Sharing 5 failed, because this item is already shared with test-share-user2
00:38:10.280 
00:38:10.280 /var/jenkins/workspace/pull-request-analyser-ng-simple@2/label/SLAVE/lib/private/share/share.php:597
00:38:10.280 /var/jenkins/workspace/pull-request-analyser-ng-simple@2/label/SLAVE/lib/public/share.php:236
00:38:10.280 /var/jenkins/workspace/pull-request-analyser-ng-simple@2/label/SLAVE/apps/files_sharing/tests/share.php:231

@@ -192,6 +194,8 @@ public static function move2trash($file_path) {
if ($user !== $owner) {
self::copyFilesToOwner($file_path, $owner, $ownerPath, $timestamp);
}

$result = true;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From scrutinizer:

The assignment to $result is dead and can be removed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed

@schiessle schiessle force-pushed the trashbin_storage_wrapper branch 2 times, most recently from beae124 to 379dcd8 Compare January 16, 2015 13:31
@DeepDiver1975 DeepDiver1975 force-pushed the trashbin_storage_wrapper branch from 379dcd8 to 15ae6b4 Compare January 19, 2015 08:16
@scrutinizer-notifier
Copy link

The inspection completed: 5 updated code elements

@ghost
Copy link

ghost commented Jan 19, 2015

Refer to this link for build results (access rights to CI server needed):
https://ci.owncloud.org//job/pull-request-analyser-ng-simple/7234/
👍 Test PASSed. 👍

@DeepDiver1975
Copy link
Member

tested 👍

@DeepDiver1975
Copy link
Member

@icewind1991 @MorrisJobke @PVince81 can you please test this? THX

@RobinMcCorkell
Copy link
Member

Tested with/without external storages, 👍

MorrisJobke added a commit that referenced this pull request Jan 19, 2015
[trashbin] replace hook with storage wrapper
@MorrisJobke MorrisJobke merged commit cd4c7fd into master Jan 19, 2015
@MorrisJobke MorrisJobke deleted the trashbin_storage_wrapper branch January 19, 2015 12:17
@MorrisJobke
Copy link
Contributor

@schiesbn I got a question from @cdamken Is this the PR that fixes owncloud/client#2858 and is it reasonable/possible to backport this to stable7 ? cc @icewind1991

@DeepDiver1975
Copy link
Member

@schiesbn I got a question from @cdamken Is this the PR that fixes owncloud/client#2858 and is it reasonable/possible to backport this to stable7 ? cc @icewind1991

NO - additional fixes had to be applied on top - too risky - upgrade to 8 of disable trashbin

@lock lock bot locked as resolved and limited conversation to collaborators Aug 14, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants