* @ingroup FileRepo
*/
+use MediaWiki\MediaWikiServices;
use Wikimedia\Rdbms\ResultWrapper;
use Wikimedia\Rdbms\Database;
use Wikimedia\Rdbms\IDatabase;
* interleave database locks with file operations, which is potentially a
* remote operation.
*
- * @param array $storageKeys
+ * @param string[] $storageKeys
*
* @return Status
*/
}
$method = __METHOD__;
- $redirDbKey = ObjectCache::getMainWANInstance()->getWithSetCallback(
+ $redirDbKey = MediaWikiServices::getInstance()->getMainWANObjectCache()->getWithSetCallback(
$memcKey,
$expiry,
function ( $oldValue, &$ttl, array &$setOpts ) use ( $method, $title ) {
$applyMatchingFiles = function ( ResultWrapper $res, &$searchSet, &$finalFiles )
use ( $fileMatchesSearch, $flags )
{
- global $wgContLang;
+ $contLang = MediaWikiServices::getInstance()->getContentLanguage();
$info = $this->getInfo();
foreach ( $res as $row ) {
$file = $this->newFileFromRow( $row );
$dbKeysLook = [ strtr( $file->getName(), ' ', '_' ) ];
if ( !empty( $info['initialCapital'] ) ) {
// Search keys for "hi.png" and "Hi.png" should use the "Hi.png file"
- $dbKeysLook[] = $wgContLang->lcfirst( $file->getName() );
+ $dbKeysLook[] = $contLang->lcfirst( $file->getName() );
}
foreach ( $dbKeysLook as $dbKey ) {
if ( isset( $searchSet[$dbKey] )
* SHA-1 content hash.
*
* @param string $hash A sha1 hash to look for
- * @return File[]
+ * @return LocalFile[]
*/
function findBySha1( $hash ) {
$dbr = $this->getReplicaDB();
*
* Overrides generic implementation in FileRepo for performance reason
*
- * @param array $hashes An array of hashes
- * @return array An Array of arrays or iterators of file objects and the hash as key
+ * @param string[] $hashes An array of hashes
+ * @return array[] An Array of arrays or iterators of file objects and the hash as key
*/
function findBySha1s( array $hashes ) {
if ( !count( $hashes ) ) {
*
* @param string $prefix The prefix to search for
* @param int $limit The maximum amount of files to return
- * @return array
+ * @return LocalFile[]
*/
public function findFilesByPrefix( $prefix, $limit ) {
$selectOptions = [ 'ORDER BY' => 'img_name', 'LIMIT' => intval( $limit ) ];
function getSharedCacheKey( /*...*/ ) {
$args = func_get_args();
- return call_user_func_array( 'wfMemcKey', $args );
+ return wfMemcKey( ...$args );
}
/**
if ( $key ) {
$this->getMasterDB()->onTransactionPreCommitOrIdle(
function () use ( $key ) {
- ObjectCache::getMainWANInstance()->delete( $key );
+ MediaWikiServices::getInstance()->getMainWANObjectCache()->delete( $key );
},
__METHOD__
);
wfDebug( __METHOD__ . ": skipped because storage uses sha1 paths\n" );
return Status::newGood();
} else {
- return call_user_func_array( 'parent::' . $function, $args );
+ return parent::$function( ...$args );
}
}
}