mirror of
https://github.com/nextcloud/server.git
synced 2026-04-15 22:11:17 -04:00
perf(normalization): Optimize path normalization
Signed-off-by: Carl Schwan <carlschwan@kde.org>
(cherry picked from commit 09a1ca3981)
This commit is contained in:
parent
47524649c7
commit
6bc805ad39
1 changed files with 0 additions and 16 deletions
|
|
@ -7,10 +7,8 @@
|
|||
*/
|
||||
namespace OC\Files;
|
||||
|
||||
use OC\Files\Mount\MountPoint;
|
||||
use OC\Files\Storage\StorageFactory;
|
||||
use OC\User\NoUserException;
|
||||
use OCP\Cache\CappedMemoryCache;
|
||||
use OCP\EventDispatcher\IEventDispatcher;
|
||||
use OCP\Files\Events\Node\FilesystemTornDownEvent;
|
||||
use OCP\Files\Mount\IMountManager;
|
||||
|
|
@ -28,8 +26,6 @@ class Filesystem {
|
|||
|
||||
private static ?View $defaultInstance = null;
|
||||
|
||||
private static ?CappedMemoryCache $normalizedPathCache = null;
|
||||
|
||||
private static ?FilenameValidator $validator = null;
|
||||
|
||||
/**
|
||||
|
|
@ -607,16 +603,6 @@ class Filesystem {
|
|||
return '/';
|
||||
}
|
||||
|
||||
if (is_null(self::$normalizedPathCache)) {
|
||||
self::$normalizedPathCache = new CappedMemoryCache(2048);
|
||||
}
|
||||
|
||||
$cacheKey = json_encode([$path, $stripTrailingSlash, $isAbsolutePath, $keepUnicode]);
|
||||
|
||||
if ($cacheKey && isset(self::$normalizedPathCache[$cacheKey])) {
|
||||
return self::$normalizedPathCache[$cacheKey];
|
||||
}
|
||||
|
||||
//normalize unicode if possible
|
||||
if (!$keepUnicode) {
|
||||
$path = \OC_Util::normalizeUnicode($path);
|
||||
|
|
@ -642,8 +628,6 @@ class Filesystem {
|
|||
$path = rtrim($path, '/');
|
||||
}
|
||||
|
||||
self::$normalizedPathCache[$cacheKey] = $path;
|
||||
|
||||
return $path;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue