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
base: master
Are you sure you want to change the base?
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>
60ceaca
to
e89d614
Compare
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