mirror of
https://github.com/nextcloud/server.git
synced 2026-04-23 23:27:46 -04:00
Merge pull request #57570 from nextcloud/carl/perf/normalized-path
perf(normalization): Optimize path normalization
This commit is contained in:
commit
ebf9cbf4a1
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