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

does not work with many files #27

Closed
Kranf99 opened this issue Feb 12, 2023 · 3 comments
Closed

does not work with many files #27

Kranf99 opened this issue Feb 12, 2023 · 3 comments

Comments

@Kranf99
Copy link

Kranf99 commented Feb 12, 2023

This is due to this function :
public function quota(?stdClass $user = null): stdClass
...that takes ages to compute the number of byte used by the current user.
So much time that the WebDav Client "times out" with an error.

@bohwaz
Copy link
Contributor

bohwaz commented Feb 12, 2023

What is the size / number of files in the user directory? I tried up to 500 GB and it worked, but it was on a SSD, maybe on a hard drive it would be too slow.

There is no magical solution here as to know the size used we have to walk through all files to get their size…

@Kranf99
Copy link
Author

Kranf99 commented Feb 13, 2023

I ended up disabling the quota system for the users with a zero quota:

public function quota(?stdClass $user = null): stdClass
{
	$user ??= $this->current();
	$used = $total = $free = 0;
	if ($user) {
		$total = $user->quota;
		if ($total==0) {
			$used=0;
			$free=10000000000;
		} else {
			$used = Storage::getDirectorySize($user->path);
			$free = max(0, $total - $used);
		}
	}

	return (object) compact('free', 'total', 'used');
}

@bohwaz
Copy link
Contributor

bohwaz commented Feb 14, 2023

Thanks, I changed the method to fetch the size of files, maybe it works for you now?

If not, I also implemented an option to use the whole disk as the users quota, just set -1 in user quota.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants