aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/l10n/fi.js5
-rw-r--r--lib/l10n/fi.json5
-rw-r--r--lib/l10n/fr.js1
-rw-r--r--lib/l10n/fr.json1
-rw-r--r--lib/private/Files/Cache/Scanner.php13
-rw-r--r--lib/private/Files/Cache/SearchBuilder.php2
-rw-r--r--lib/private/Files/Cache/Wrapper/CacheJail.php12
-rw-r--r--lib/private/Files/Config/UserMountCache.php7
-rw-r--r--lib/private/Files/ObjectStore/NoopScanner.php2
-rw-r--r--lib/private/Files/View.php7
-rw-r--r--lib/private/Server.php5
-rw-r--r--lib/private/User/DisplayNameCache.php4
-rw-r--r--lib/private/User/LazyUser.php6
-rw-r--r--lib/private/User/Manager.php11
-rw-r--r--lib/public/IUserManager.php9
15 files changed, 67 insertions, 23 deletions
diff --git a/lib/l10n/fi.js b/lib/l10n/fi.js
index 62ac7751f43..13ebcfcffeb 100644
--- a/lib/l10n/fi.js
+++ b/lib/l10n/fi.js
@@ -116,7 +116,11 @@ OC.L10N.register(
"Set an admin password." : "Aseta ylläpitäjän salasana.",
"Sharing backend %s not found" : "Jakamisen taustaosaa %s ei löytynyt",
"Sharing backend for %s not found" : "Jakamisen taustaosaa kohteelle %s ei löytynyt",
+ "%1$s shared »%2$s« with you and wants to add:" : "%1$s jakoi kohteen »%2$s« kanssasi ja haluaa lisätä:",
+ "%1$s shared »%2$s« with you and wants to add" : "%1$s jakoi kohteen »%2$s« kanssasi ja haluaa lisätä",
+ "»%s« added a note to a file shared with you" : "»%s« lisäsi huomion jakamaasi tiedostoon",
"Open »%s«" : "Avaa »%s«",
+ "%1$s via %2$s" : "%1$s palvelun %2$s kautta",
"You are not allowed to share %s" : "Oikeutesi eivät riitä kohteen %s jakamiseen.",
"Cannot increase permissions of %s" : "Kohteen %s käyttöoikeuksien lisääminen ei onnistu",
"Files cannot be shared with delete permissions" : "Tiedostoja ei voi jakaa poistamisoikeuksilla",
@@ -189,6 +193,7 @@ OC.L10N.register(
"App \"%1$s\" cannot be installed because the following dependencies are not fulfilled: %2$s" : "Sovellusta \"%1$s\" ei voi asentaa, koska seuraavat riippuvuudet eivät täyty: %2$s",
"a safe home for all your data" : "turvallinen koti kaikille tiedostoillesi",
"File is currently busy, please try again later" : "Tiedosto on parhaillaan käytössä, yritä myöhemmin uudelleen",
+ "Cannot download file" : "Tiedostoa ei voi ladata",
"Application is not enabled" : "Sovellusta ei ole otettu käyttöön",
"Authentication error" : "Tunnistautumisvirhe",
"Token expired. Please reload page." : "Valtuutus vanheni. Lataa sivu uudelleen.",
diff --git a/lib/l10n/fi.json b/lib/l10n/fi.json
index 975213c6cdc..2aa4fdcd0d5 100644
--- a/lib/l10n/fi.json
+++ b/lib/l10n/fi.json
@@ -114,7 +114,11 @@
"Set an admin password." : "Aseta ylläpitäjän salasana.",
"Sharing backend %s not found" : "Jakamisen taustaosaa %s ei löytynyt",
"Sharing backend for %s not found" : "Jakamisen taustaosaa kohteelle %s ei löytynyt",
+ "%1$s shared »%2$s« with you and wants to add:" : "%1$s jakoi kohteen »%2$s« kanssasi ja haluaa lisätä:",
+ "%1$s shared »%2$s« with you and wants to add" : "%1$s jakoi kohteen »%2$s« kanssasi ja haluaa lisätä",
+ "»%s« added a note to a file shared with you" : "»%s« lisäsi huomion jakamaasi tiedostoon",
"Open »%s«" : "Avaa »%s«",
+ "%1$s via %2$s" : "%1$s palvelun %2$s kautta",
"You are not allowed to share %s" : "Oikeutesi eivät riitä kohteen %s jakamiseen.",
"Cannot increase permissions of %s" : "Kohteen %s käyttöoikeuksien lisääminen ei onnistu",
"Files cannot be shared with delete permissions" : "Tiedostoja ei voi jakaa poistamisoikeuksilla",
@@ -187,6 +191,7 @@
"App \"%1$s\" cannot be installed because the following dependencies are not fulfilled: %2$s" : "Sovellusta \"%1$s\" ei voi asentaa, koska seuraavat riippuvuudet eivät täyty: %2$s",
"a safe home for all your data" : "turvallinen koti kaikille tiedostoillesi",
"File is currently busy, please try again later" : "Tiedosto on parhaillaan käytössä, yritä myöhemmin uudelleen",
+ "Cannot download file" : "Tiedostoa ei voi ladata",
"Application is not enabled" : "Sovellusta ei ole otettu käyttöön",
"Authentication error" : "Tunnistautumisvirhe",
"Token expired. Please reload page." : "Valtuutus vanheni. Lataa sivu uudelleen.",
diff --git a/lib/l10n/fr.js b/lib/l10n/fr.js
index 86f56e69a85..fce71090c61 100644
--- a/lib/l10n/fr.js
+++ b/lib/l10n/fr.js
@@ -207,6 +207,7 @@ OC.L10N.register(
"App \"%1$s\" cannot be installed because the following dependencies are not fulfilled: %2$s" : "L'application \"%1$s\" ne peut pas être installée à cause des dépendances suivantes non satisfaites : %2$s",
"a safe home for all your data" : "un lieu sûr pour toutes vos données",
"File is currently busy, please try again later" : "Le fichier est actuellement utilisé, veuillez réessayer plus tard",
+ "Cannot download file" : "Impossible de télécharger le fichier",
"Application is not enabled" : "L'application n'est pas activée",
"Authentication error" : "Erreur d'authentification",
"Token expired. Please reload page." : "La session a expiré. Veuillez recharger la page.",
diff --git a/lib/l10n/fr.json b/lib/l10n/fr.json
index f3b85ba4ac2..f9ff67188b0 100644
--- a/lib/l10n/fr.json
+++ b/lib/l10n/fr.json
@@ -205,6 +205,7 @@
"App \"%1$s\" cannot be installed because the following dependencies are not fulfilled: %2$s" : "L'application \"%1$s\" ne peut pas être installée à cause des dépendances suivantes non satisfaites : %2$s",
"a safe home for all your data" : "un lieu sûr pour toutes vos données",
"File is currently busy, please try again later" : "Le fichier est actuellement utilisé, veuillez réessayer plus tard",
+ "Cannot download file" : "Impossible de télécharger le fichier",
"Application is not enabled" : "L'application n'est pas activée",
"Authentication error" : "Erreur d'authentification",
"Token expired. Please reload page." : "La session a expiré. Veuillez recharger la page.",
diff --git a/lib/private/Files/Cache/Scanner.php b/lib/private/Files/Cache/Scanner.php
index fb32b64c012..4799c3bff7d 100644
--- a/lib/private/Files/Cache/Scanner.php
+++ b/lib/private/Files/Cache/Scanner.php
@@ -339,7 +339,7 @@ class Scanner extends BasicEmitter implements IScanner {
try {
$data = $this->scanFile($path, $reuse, -1, null, $lock);
if ($data and $data['mimetype'] === 'httpd/unix-directory') {
- $size = $this->scanChildren($path, $recursive, $reuse, $data['fileid'], $lock);
+ $size = $this->scanChildren($path, $recursive, $reuse, $data['fileid'], $lock, $data);
$data['size'] = $size;
}
} finally {
@@ -376,9 +376,10 @@ class Scanner extends BasicEmitter implements IScanner {
* @param int $reuse
* @param int $folderId id for the folder to be scanned
* @param bool $lock set to false to disable getting an additional read lock during scanning
+ * @param array $data the data of the folder before (re)scanning the children
* @return int the size of the scanned folder or -1 if the size is unknown at this stage
*/
- protected function scanChildren($path, $recursive = self::SCAN_RECURSIVE, $reuse = -1, $folderId = null, $lock = true) {
+ protected function scanChildren($path, $recursive = self::SCAN_RECURSIVE, $reuse = -1, $folderId = null, $lock = true, array $data = []) {
if ($reuse === -1) {
$reuse = ($recursive === self::SCAN_SHALLOW) ? self::REUSE_ETAG | self::REUSE_SIZE : self::REUSE_ETAG;
}
@@ -397,7 +398,8 @@ class Scanner extends BasicEmitter implements IScanner {
$size += $childSize;
}
}
- if ($this->cacheActive) {
+ $oldSize = $data['size'] ?? null;
+ if ($this->cacheActive && $oldSize !== $size) {
$this->cache->update($folderId, ['size' => $size]);
}
$this->emit('\OC\Files\Cache\Scanner', 'postScanFolder', [$path, $this->storageId]);
@@ -409,6 +411,11 @@ class Scanner extends BasicEmitter implements IScanner {
$existingChildren = $this->getExistingChildren($folderId);
$newChildren = iterator_to_array($this->storage->getDirectoryContent($path));
+ if (count($existingChildren) === 0 && count($newChildren) === 0) {
+ // no need to do a transaction
+ return [];
+ }
+
if ($this->useTransactions) {
\OC::$server->getDatabaseConnection()->beginTransaction();
}
diff --git a/lib/private/Files/Cache/SearchBuilder.php b/lib/private/Files/Cache/SearchBuilder.php
index b5f548dd563..1a8c3637063 100644
--- a/lib/private/Files/Cache/SearchBuilder.php
+++ b/lib/private/Files/Cache/SearchBuilder.php
@@ -54,7 +54,7 @@ class SearchBuilder {
ISearchComparison::COMPARE_GREATER_THAN => 'lte',
ISearchComparison::COMPARE_GREATER_THAN_EQUAL => 'lt',
ISearchComparison::COMPARE_LESS_THAN => 'gte',
- ISearchComparison::COMPARE_LESS_THAN_EQUAL => 'lt',
+ ISearchComparison::COMPARE_LESS_THAN_EQUAL => 'gt',
];
public const TAG_FAVORITE = '_$!<Favorite>!$_';
diff --git a/lib/private/Files/Cache/Wrapper/CacheJail.php b/lib/private/Files/Cache/Wrapper/CacheJail.php
index 4053042edd9..834c9fd3d72 100644
--- a/lib/private/Files/Cache/Wrapper/CacheJail.php
+++ b/lib/private/Files/Cache/Wrapper/CacheJail.php
@@ -324,11 +324,13 @@ class CacheJail extends CacheWrapper {
}
public function getCacheEntryFromSearchResult(ICacheEntry $rawEntry): ?ICacheEntry {
- $rawEntry = $this->getCache()->getCacheEntryFromSearchResult($rawEntry);
- if ($rawEntry) {
- $jailedPath = $this->getJailedPath($rawEntry->getPath());
- if ($jailedPath !== null) {
- return $this->formatCacheEntry(clone $rawEntry) ?: null;
+ if ($this->getGetUnjailedRoot() === '' || strpos($rawEntry->getPath(), $this->getGetUnjailedRoot()) === 0) {
+ $rawEntry = $this->getCache()->getCacheEntryFromSearchResult($rawEntry);
+ if ($rawEntry) {
+ $jailedPath = $this->getJailedPath($rawEntry->getPath());
+ if ($jailedPath !== null) {
+ return $this->formatCacheEntry(clone $rawEntry) ?: null;
+ }
}
}
diff --git a/lib/private/Files/Config/UserMountCache.php b/lib/private/Files/Config/UserMountCache.php
index 685057a7860..3540b563742 100644
--- a/lib/private/Files/Config/UserMountCache.php
+++ b/lib/private/Files/Config/UserMountCache.php
@@ -90,7 +90,12 @@ class UserMountCache implements IUserMountCache {
$cachedMounts = $this->getMountsForUser($user);
if (is_array($mountProviderClasses)) {
- $cachedMounts = array_filter($cachedMounts, function (ICachedMountInfo $mountInfo) use ($mountProviderClasses) {
+ $cachedMounts = array_filter($cachedMounts, function (ICachedMountInfo $mountInfo) use ($mountProviderClasses, $newMounts) {
+ // for existing mounts that didn't have a mount provider set
+ // we still want the ones that map to new mounts
+ if ($mountInfo->getMountProvider() === '' && isset($newMounts[$mountInfo->getRootId()])) {
+ return true;
+ }
return in_array($mountInfo->getMountProvider(), $mountProviderClasses);
});
}
diff --git a/lib/private/Files/ObjectStore/NoopScanner.php b/lib/private/Files/ObjectStore/NoopScanner.php
index 3b8cbdb18bb..bdfc93758d4 100644
--- a/lib/private/Files/ObjectStore/NoopScanner.php
+++ b/lib/private/Files/ObjectStore/NoopScanner.php
@@ -68,7 +68,7 @@ class NoopScanner extends Scanner {
* @param array $folderData existing cache data for the folder to be scanned
* @return int the size of the scanned folder or -1 if the size is unknown at this stage
*/
- protected function scanChildren($path, $recursive = self::SCAN_RECURSIVE, $reuse = -1, $folderId = null, $lock = true) {
+ protected function scanChildren($path, $recursive = self::SCAN_RECURSIVE, $reuse = -1, $folderId = null, $lock = true, array $data = []) {
return 0;
}
diff --git a/lib/private/Files/View.php b/lib/private/Files/View.php
index d12869fbdaa..e5394e72ffe 100644
--- a/lib/private/Files/View.php
+++ b/lib/private/Files/View.php
@@ -49,9 +49,7 @@ namespace OC\Files;
use Icewind\Streams\CallbackWrapper;
use OC\Files\Mount\MoveableMount;
use OC\Files\Storage\Storage;
-use OC\User\DisplayNameCache;
use OC\User\LazyUser;
-use OC\User\User;
use OCA\Files_Sharing\SharedMount;
use OCP\Constants;
use OCP\Files\Cache\ICacheEntry;
@@ -103,8 +101,6 @@ class View {
private LoggerInterface $logger;
- private DisplayNameCache $displayNameCache;
-
/**
* @param string $root
* @throws \Exception If $root contains an invalid path
@@ -121,7 +117,6 @@ class View {
$this->lockingProvider = \OC::$server->getLockingProvider();
$this->lockingEnabled = !($this->lockingProvider instanceof \OC\Lock\NoopLockingProvider);
$this->userManager = \OC::$server->getUserManager();
- $this->displayNameCache = \OC::$server->get(DisplayNameCache::class);
$this->logger = \OC::$server->get(LoggerInterface::class);
}
@@ -1319,7 +1314,7 @@ class View {
* @return IUser
*/
private function getUserObjectForOwner(string $ownerId) {
- return new LazyUser($ownerId, $this->displayNameCache, $this->userManager);
+ return new LazyUser($ownerId, $this->userManager);
}
/**
diff --git a/lib/private/Server.php b/lib/private/Server.php
index b473f4e75c0..7223c3b8ae3 100644
--- a/lib/private/Server.php
+++ b/lib/private/Server.php
@@ -151,6 +151,7 @@ use OC\SystemTag\ManagerFactory as SystemTagManagerFactory;
use OC\Tagging\TagMapper;
use OC\Talk\Broker;
use OC\Template\JSCombiner;
+use OC\User\DisplayNameCache;
use OC\User\Listeners\UserChangedListener;
use OC\User\Listeners\UserDeletedListener;
use OCA\Theming\ImageManager;
@@ -474,6 +475,10 @@ class Server extends ServerContainer implements IServerContainer {
$this->registerDeprecatedAlias('UserManager', \OC\User\Manager::class);
$this->registerAlias(\OCP\IUserManager::class, \OC\User\Manager::class);
+ $this->registerService(DisplayNameCache::class, function (ContainerInterface $c) {
+ return $c->get(\OC\User\Manager::class)->getDisplayNameCache();
+ });
+
$this->registerService(\OCP\IGroupManager::class, function (ContainerInterface $c) {
$groupManager = new \OC\Group\Manager(
$this->get(IUserManager::class),
diff --git a/lib/private/User/DisplayNameCache.php b/lib/private/User/DisplayNameCache.php
index 22a79863e49..5d1cc8940d7 100644
--- a/lib/private/User/DisplayNameCache.php
+++ b/lib/private/User/DisplayNameCache.php
@@ -47,7 +47,7 @@ class DisplayNameCache implements IEventListener {
$this->userManager = $userManager;
}
- public function getDisplayName(string $userId) {
+ public function getDisplayName(string $userId): ?string {
if (isset($this->cache[$userId])) {
return $this->cache[$userId];
}
@@ -61,7 +61,7 @@ class DisplayNameCache implements IEventListener {
if ($user) {
$displayName = $user->getDisplayName();
} else {
- $displayName = $userId;
+ $displayName = null;
}
$this->cache[$userId] = $displayName;
$this->memCache->set($userId, $displayName, 60 * 10); // 10 minutes
diff --git a/lib/private/User/LazyUser.php b/lib/private/User/LazyUser.php
index 8e93d6481ab..096578b8f37 100644
--- a/lib/private/User/LazyUser.php
+++ b/lib/private/User/LazyUser.php
@@ -29,12 +29,10 @@ use OCP\UserInterface;
class LazyUser implements IUser {
private ?IUser $user = null;
- private DisplayNameCache $displayNameCache;
private string $uid;
private IUserManager $userManager;
- public function __construct(string $uid, DisplayNameCache $displayNameCache, IUserManager $userManager) {
- $this->displayNameCache = $displayNameCache;
+ public function __construct(string $uid, IUserManager $userManager) {
$this->uid = $uid;
$this->userManager = $userManager;
}
@@ -53,7 +51,7 @@ class LazyUser implements IUser {
}
public function getDisplayName() {
- return $this->displayNameCache->getDisplayName($this->uid);
+ return $this->userManager->getDisplayName($this->uid) ?? $this->uid;
}
public function setDisplayName($displayName) {
diff --git a/lib/private/User/Manager.php b/lib/private/User/Manager.php
index a6f56585325..be5151313c4 100644
--- a/lib/private/User/Manager.php
+++ b/lib/private/User/Manager.php
@@ -95,6 +95,8 @@ class Manager extends PublicEmitter implements IUserManager {
/** @var IEventDispatcher */
private $eventDispatcher;
+ private DisplayNameCache $displayNameCache;
+
public function __construct(IConfig $config,
EventDispatcherInterface $oldDispatcher,
ICacheFactory $cacheFactory,
@@ -108,6 +110,7 @@ class Manager extends PublicEmitter implements IUserManager {
unset($cachedUsers[$user->getUID()]);
});
$this->eventDispatcher = $eventDispatcher;
+ $this->displayNameCache = new DisplayNameCache($cacheFactory, $this);
}
/**
@@ -185,6 +188,10 @@ class Manager extends PublicEmitter implements IUserManager {
return null;
}
+ public function getDisplayName(string $uid): ?string {
+ return $this->displayNameCache->getDisplayName($uid);
+ }
+
/**
* get or construct the user object
*
@@ -742,4 +749,8 @@ class Manager extends PublicEmitter implements IUserManager {
return !file_exists(rtrim($dataDirectory, '/') . '/' . $uid);
}
+
+ public function getDisplayNameCache(): DisplayNameCache {
+ return $this->displayNameCache;
+ }
}
diff --git a/lib/public/IUserManager.php b/lib/public/IUserManager.php
index 77e2fc21a22..af0d5f08809 100644
--- a/lib/public/IUserManager.php
+++ b/lib/public/IUserManager.php
@@ -85,6 +85,15 @@ interface IUserManager {
public function get($uid);
/**
+ * Get the display name of a user
+ *
+ * @param string $uid
+ * @return string|null
+ * @since 25.0.0
+ */
+ public function getDisplayName(string $uid): ?string;
+
+ /**
* check if a user exists
*
* @param string $uid