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

use lazy user in UserMountCache #33579

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions lib/private/Files/Config/UserMountCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
*/
namespace OC\Files\Config;

use OC\User\LazyUser;
use OCP\Cache\CappedMemoryCache;
use OCA\Files_Sharing\SharedMount;
use OCP\DB\QueryBuilder\IQueryBuilder;
Expand Down Expand Up @@ -204,10 +205,14 @@ private function removeFromCache(ICachedMountInfo $mount) {
}

private function dbRowToMountInfo(array $row) {
$user = $this->userManager->get($row['user_id']);
if (is_null($user)) {
$userid = $row['user_id'];

// check that the user exits
if ($this->userManager->getDisplayName($userid) === null) {
Copy link
Member

Choose a reason for hiding this comment

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

Not fond of this check, seems hack-ish, no?

Copy link
Member Author

Choose a reason for hiding this comment

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

A bit yes, but it's the easiest way I can think of to do this check without requesting data from the user backend if not needed

Copy link
Member Author

Choose a reason for hiding this comment

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

#33582 add caching to userExists, will adjust this PR once that is merged

return null;
}
$user = new LazyUser($userid, $this->userManager);

$mount_id = $row['mount_id'];
if (!is_null($mount_id)) {
$mount_id = (int)$mount_id;
Expand Down