]> source.dussan.org Git - nextcloud-server.git/commitdiff
Move localecache to array 23838/head
authorRoeland Jago Douma <roeland@famdouma.nl>
Mon, 2 Nov 2020 14:02:04 +0000 (15:02 +0100)
committerRoeland Jago Douma <roeland@famdouma.nl>
Mon, 2 Nov 2020 14:02:04 +0000 (15:02 +0100)
It seems the DS Set in the polyfill implementation is a lot less
efficient than normal arrays. (A LOT!).
So for now use a stupid normal array.

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
lib/private/L10N/Factory.php

index b807f5cb63f87de32b1d065bc7f1deddeb9d2109..9c9a3cc951e22419ebd4e26fb27aca1ab18f970a 100644 (file)
@@ -37,7 +37,6 @@
 
 namespace OC\L10N;
 
-use Ds\Set;
 use OCP\IConfig;
 use OCP\IRequest;
 use OCP\IUser;
@@ -65,9 +64,9 @@ class Factory implements IFactory {
        protected $availableLanguages = [];
 
        /**
-        * @var Set
+        * @var array
         */
-       protected $localeCache;
+       protected $localeCache = [];
 
        /**
         * @var array
@@ -110,7 +109,6 @@ class Factory implements IFactory {
                $this->request = $request;
                $this->userSession = $userSession;
                $this->serverRoot = $serverRoot;
-               $this->localeCache = new Set();
        }
 
        /**
@@ -398,14 +396,14 @@ class Factory implements IFactory {
                        return true;
                }
 
-               if ($this->localeCache->isEmpty()) {
+               if ($this->localeCache === []) {
                        $locales = $this->findAvailableLocales();
                        foreach ($locales as $l) {
-                               $this->localeCache->add($l['code']);
+                               $this->localeCache[$l['code']] = true;
                        }
                }
 
-               return $this->localeCache->contains($locale);
+               return isset($this->localeCache[$locale]);
        }
 
        /**