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

Missing OCP replacement for \OC_Util::setupFS() #17196

Closed
oparoz opened this issue Jun 26, 2015 · 7 comments
Closed

Missing OCP replacement for \OC_Util::setupFS() #17196

oparoz opened this issue Jun 26, 2015 · 7 comments

Comments

@oparoz
Copy link
Contributor

oparoz commented Jun 26, 2015

According to the way the path to the files a token gives access to in files_sharing, we need to use this method before requesting access to a node
https://github.com/owncloud/core/blob/446f628136532fe556757c3fe39655c6304e3cb9/apps/files_sharing/lib/controllers/sharecontroller.php

OC_Util::tearDownFS();
OC_Util::setupFS($userId);
Filesystem::getPath($nodeId)

Filesystem::getPath($nodeId) can be replaced with $this->userFolder->getById($nodeId)
but can both the preceding methods be replaced by $this->userFolder = $server->getUserFolder($userId) ?

I have no idea where it should sit (OCP or AppFramework), but it's either missing or not required and new OCP methods or new documentation needs to be provided

@PVince81
Copy link
Contributor

Thanks @oparoz

I believe that @icewind1991 started some refactoring that would make it public somehow.

Ideally the FS stuff should not be static. It should be possible to use the FS from multiple users in parallel by using instances of Filesystem or the Node API.

There is some preliminary work from @icewind1991 here #11091

@oparoz
Copy link
Contributor Author

oparoz commented Jul 2, 2015

Looking at what's in getUserFolder, it seems that setupFS might be redundant.
\OC\Files\Filesystem::initMountPoints($userId); - > self::mount($homeStorage['class'], $homeStorage['arguments'], $user); -> \OC_Util::setupFS();

So maybe this is a technical debt.

@PVince81
Copy link
Contributor

Moving to 9.0.

We definitely need some better API for apps to provide public mode

@PVince81 PVince81 modified the milestones: 9.0-next, 8.2-current Sep 22, 2015
@oparoz
Copy link
Contributor Author

oparoz commented Sep 30, 2015

I can just confirm that $server->getUserFolder($userId) cannot replace \OC_Util::setupFS($user);.

The view is not setup properly.

Env

Steps to reproduce

  1. Add this corrupt file to a folder named corrupt: https://github.com/owncloud/gallery/blob/master/tests/_data/testimage-corrupt.jpg
  2. Use the following occ gallery command: # sudo -uwww-data ./occ gallery:create-thumbnails --path=/admin/files/corrupt

Expected result

There was a problem generating a preview for /admin/files/corrupt/testimage-corrupt.jpg

Actual result

PHP Fatal error: Call to a member function file_get_contents() on a non-object in /var/www/owncloud/lib/private/files/filesystem.php on line 703

Notes

If I replace $server->getUserFolder($userId) with the private method \OC_Util::setupFS($user);, then I don't get the fatal error any more.

@oparoz
Copy link
Contributor Author

oparoz commented Sep 30, 2015

Maybe this will help: #19416

@PVince81 PVince81 modified the milestones: 9.1-next, 9.0-current Feb 12, 2016
@PVince81 PVince81 modified the milestones: 9.1-current, 9.2-next Jun 15, 2016
@PVince81
Copy link
Contributor

PVince81 commented Dec 8, 2016

Filesystem stuff should be transparent for apps, apps should not need to care about setting up FS and tearing down. So we need to fix those APIs and/or complete them.

From what I see, initMountPoints is called already in getUserFolder(): https://github.com/owncloud/core/blob/v9.1.2/lib/private/Files/Node/Root.php#L346

@PVince81 PVince81 closed this as completed Dec 8, 2016
@lock
Copy link

lock bot commented Aug 3, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

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

No branches or pull requests

2 participants