Merge "Force phan-taint-check to think LogFormatter stuff is safe for html"
[lhc/web/wiklou.git] / includes / filerepo / FileBackendDBRepoWrapper.php
index 21b7ac2..b445487 100644 (file)
@@ -45,7 +45,7 @@ class FileBackendDBRepoWrapper extends FileBackend {
        protected $repoName;
        /** @var Closure */
        protected $dbHandleFunc;
-       /** @var ProcessCacheLRU */
+       /** @var MapCacheLRU */
        protected $resolvedPathCache;
        /** @var DBConnRef[] */
        protected $dbs;
@@ -59,7 +59,7 @@ class FileBackendDBRepoWrapper extends FileBackend {
                $this->backend = $config['backend'];
                $this->repoName = $config['repoName'];
                $this->dbHandleFunc = $config['dbHandleFactory'];
-               $this->resolvedPathCache = new ProcessCacheLRU( 100 );
+               $this->resolvedPathCache = new MapCacheLRU( 100 );
        }
 
        /**
@@ -92,9 +92,9 @@ class FileBackendDBRepoWrapper extends FileBackend {
         * E.g. mwstore://local-backend/local-public/a/ab/<name>.jpg
         * => mwstore://local-backend/local-original/x/y/z/<sha1>.jpg
         *
-        * @param array $paths
+        * @param string[] $paths
         * @param bool $latest
-        * @return array Translated paths in same order
+        * @return string[] Translated paths in same order
         */
        public function getBackendPaths( array $paths, $latest = true ) {
                $db = $this->getDB( $latest ? DB_MASTER : DB_REPLICA );
@@ -102,8 +102,8 @@ class FileBackendDBRepoWrapper extends FileBackend {
                // @TODO: batching
                $resolved = [];
                foreach ( $paths as $i => $path ) {
-                       if ( !$latest && $this->resolvedPathCache->has( $path, 'target', 10 ) ) {
-                               $resolved[$i] = $this->resolvedPathCache->get( $path, 'target' );
+                       if ( !$latest && $this->resolvedPathCache->hasField( $path, 'target', 10 ) ) {
+                               $resolved[$i] = $this->resolvedPathCache->getField( $path, 'target' );
                                continue;
                        }
 
@@ -127,12 +127,12 @@ class FileBackendDBRepoWrapper extends FileBackend {
                                        continue;
                                }
                                $resolved[$i] = $this->getPathForSHA1( $sha1 );
-                               $this->resolvedPathCache->set( $path, 'target', $resolved[$i] );
+                               $this->resolvedPathCache->setField( $path, 'target', $resolved[$i] );
                        } elseif ( $container === "{$this->repoName}-deleted" ) {
                                $name = basename( $path ); // <hash>.<ext>
                                $sha1 = substr( $name, 0, strpos( $name, '.' ) ); // ignore extension
                                $resolved[$i] = $this->getPathForSHA1( $sha1 );
-                               $this->resolvedPathCache->set( $path, 'target', $resolved[$i] );
+                               $this->resolvedPathCache->setField( $path, 'target', $resolved[$i] );
                        } else {
                                $resolved[$i] = $path;
                        }
@@ -341,8 +341,8 @@ class FileBackendDBRepoWrapper extends FileBackend {
         *
         * This leaves destination paths alone since we don't want those to mutate
         *
-        * @param array $ops
-        * @return array
+        * @param array[] $ops
+        * @return array[]
         */
        protected function mungeOpPaths( array $ops ) {
                // Ops that use 'src' and do not mutate core file data there