X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=includes%2Ffilerepo%2FLocalRepo.php;h=1bf534649f22607b4173cf87e56fd5c3d1c2bd98;hp=ed00793508ce7e9cdeb2c7ecf77be3d954a01050;hb=689c847a32e7fe8a0b3a559a88a627a252c5018e;hpb=1d7a1bf8bddf0908e4f572c82268733f63126a13 diff --git a/includes/filerepo/LocalRepo.php b/includes/filerepo/LocalRepo.php index ed00793508..1bf534649f 100644 --- a/includes/filerepo/LocalRepo.php +++ b/includes/filerepo/LocalRepo.php @@ -34,17 +34,17 @@ use Wikimedia\Rdbms\IDatabase; */ class LocalRepo extends FileRepo { /** @var callable */ - protected $fileFactory = [ 'LocalFile', 'newFromTitle' ]; + protected $fileFactory = [ LocalFile::class, 'newFromTitle' ]; /** @var callable */ - protected $fileFactoryKey = [ 'LocalFile', 'newFromKey' ]; + protected $fileFactoryKey = [ LocalFile::class, 'newFromKey' ]; /** @var callable */ - protected $fileFromRowFactory = [ 'LocalFile', 'newFromRow' ]; + protected $fileFromRowFactory = [ LocalFile::class, 'newFromRow' ]; /** @var callable */ - protected $oldFileFromRowFactory = [ 'OldLocalFile', 'newFromRow' ]; + protected $oldFileFromRowFactory = [ OldLocalFile::class, 'newFromRow' ]; /** @var callable */ - protected $oldFileFactory = [ 'OldLocalFile', 'newFromTitle' ]; + protected $oldFileFactory = [ OldLocalFile::class, 'newFromTitle' ]; /** @var callable */ - protected $oldFileFactoryKey = [ 'OldLocalFile', 'newFromKey' ]; + protected $oldFileFactoryKey = [ OldLocalFile::class, 'newFromKey' ]; function __construct( array $info = null ) { parent::__construct( $info ); @@ -310,8 +310,9 @@ class LocalRepo extends FileRepo { } if ( count( $imgNames ) ) { - $res = $dbr->select( 'image', - LocalFile::selectFields(), [ 'img_name' => $imgNames ], __METHOD__ ); + $fileQuery = LocalFile::getQueryInfo(); + $res = $dbr->select( $fileQuery['tables'], $fileQuery['fields'], [ 'img_name' => $imgNames ], + __METHOD__, [], $fileQuery['joins'] ); $applyMatchingFiles( $res, $searchSet, $finalFiles ); } @@ -330,8 +331,10 @@ class LocalRepo extends FileRepo { } if ( count( $oiConds ) ) { - $res = $dbr->select( 'oldimage', - OldLocalFile::selectFields(), $dbr->makeList( $oiConds, LIST_OR ), __METHOD__ ); + $fileQuery = OldLocalFile::getQueryInfo(); + $res = $dbr->select( $fileQuery['tables'], $fileQuery['fields'], + $dbr->makeList( $oiConds, LIST_OR ), + __METHOD__, [], $fileQuery['joins'] ); $applyMatchingFiles( $res, $searchSet, $finalFiles ); } @@ -372,12 +375,14 @@ class LocalRepo extends FileRepo { */ function findBySha1( $hash ) { $dbr = $this->getReplicaDB(); + $fileQuery = LocalFile::getQueryInfo(); $res = $dbr->select( - 'image', - LocalFile::selectFields(), + $fileQuery['tables'], + $fileQuery['fields'], [ 'img_sha1' => $hash ], __METHOD__, - [ 'ORDER BY' => 'img_name' ] + [ 'ORDER BY' => 'img_name' ], + $fileQuery['joins'] ); $result = []; @@ -404,12 +409,14 @@ class LocalRepo extends FileRepo { } $dbr = $this->getReplicaDB(); + $fileQuery = LocalFile::getQueryInfo(); $res = $dbr->select( - 'image', - LocalFile::selectFields(), + $fileQuery['tables'], + $fileQuery['fields'], [ 'img_sha1' => $hashes ], __METHOD__, - [ 'ORDER BY' => 'img_name' ] + [ 'ORDER BY' => 'img_name' ], + $fileQuery['joins'] ); $result = []; @@ -434,12 +441,14 @@ class LocalRepo extends FileRepo { // Query database $dbr = $this->getReplicaDB(); + $fileQuery = LocalFile::getQueryInfo(); $res = $dbr->select( - 'image', - LocalFile::selectFields(), + $fileQuery['tables'], + $fileQuery['fields'], 'img_name ' . $dbr->buildLike( $prefix, $dbr->anyString() ), __METHOD__, - $selectOptions + $selectOptions, + $fileQuery['joins'] ); // Build file objects