-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
add uploads_path param #38587
add uploads_path param #38587
Conversation
daf4334
to
20159b2
Compare
Recommit with correct approach suggested in last comment of #38506 from @icewind1991. Path now it's splitted from |
I don't think we suggested introducing another configuration option. The feature you are looking for is already there. Would you mind explaining why you need to separate uploads and cache? Did you run into problems? |
My only concern is to have a clear segmentation of folder/mountpoint/disk associated. Moreover we can decide to use a different mount point in different path, associated to different disk (and size). But this is an idea/features, and I notice only after my PR and reading code that |
489089d
to
0490ba1
Compare
Does it work? If cache_path === uploads_path the expected /uploads/ subfolder is created in the cache_path block. But if you define a different uploads_path (not inside the cache_path) who is going to create the uploads subfolder for the user? |
/**
* Get the cache mount for a user
*
* @param IUser $user
* @param IStorageFactory $loader
* @return \OCP\Files\Mount\IMountPoint[]
*/
public function getMountsForUser(IUser $user, IStorageFactory $loader) {
$cacheBaseDir = $this->config->getSystemValueString('cache_path', '');
$uploadsBaseDir = $this->config->getSystemValueString('uploads_path', '');
if ($cacheBaseDir === '' && $uploadsBaseDir === '') {
return [];
}
$cacheDir = rtrim($cacheBaseDir, '/') . '/' . $user->getUID();
if (!file_exists($cacheDir)) {
mkdir($cacheDir, 0770, true);
}
if ($uploadsBaseDir === '') {
$uploadsDir = $cacheDir . '/uploads';
} else {
$uploadsDir = rtrim($uploadsBaseDir, '/') . '/' . $user->getUID();
}
if (!file_exists($uploadsDir)) {
mkdir($uploadsDir, 0770, true);
}
return [
new MountPoint('\OC\Files\Storage\Local', '/' . $user->getUID() . '/cache', ['datadir' => $cacheDir], $loader, null, null, self::class),
new MountPoint('\OC\Files\Storage\Local', '/' . $user->getUID() . '/uploads', ['datadir' => $uploadsDir], $loader, null, null, self::class)
];
} I guess this version should cover the old case and new case. |
Thanks @kesselb for highlight it. You are correct, I missing the removal of creation uploads user path in the cache if, and creation of it on upload if. Everything working in my previous commit, because uplaod function check and create uploads folder if not exists. Now should be fixed, if |
bd243b3
to
60ceaca
Compare
@kesselb Any news on this PR? |
Signed-off-by: Lorenzo Tanganelli <lorenzo.tanganelli@hotmail.it>
e89d614
to
605863b
Compare
Hi @tanganellilore, Sorry, I apparently missed your ping last year. #38633 was merged, and therefore we have unit tests now for the component.
Please ping me again if the linter and nodb tests are happy, I will trigger another review then. Note some tests (e.g., cypress) are failing for forks, don't worry. |
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
@susnux @juliushaertl can I get your opinion on this? |
/** | ||
* Override where Nextcloud stores uploaded user files while uploading (chunks). Useful in situations | ||
* where the default `<user_id>/uploads` is on network disk like NFS. | ||
* Defaults to the value of '' if unset. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* Defaults to the value of '' if unset. | |
* Defaults to `cache_path` if set, otherwise '' |
I think this is reasonable, though I currently lack insight on what we actually use the cache folder for. Tend to agree with @kesselb that two separate config values seem to much. Needs a rebase and resolving the conflict. |
Cache folder is used for chunk upload if i remeber well. See issue linkedin to this MR. I think that i can do rebase, but before tell me if this will be merged |
Would be nice yeah! We're about to start the 31 release schedule. Maybe have this merged soon to be safe? I would also like some tests for this |
Why closed? |
Because it was marked as stale. If you still want to get this feature in and actively develop it then please just reopen the PR :) |
Summary
Alternative solution instead usage of symlink proposed here: #38506.
In this solution I'm not use the symlink but directly new virtual mount to configuration passed.
TODO
Checklist