}
}
- $fileMatchesSearch = function( File $file, array $search ) {
+ $fileMatchesSearch = function ( File $file, array $search ) {
// Note: file name comparison done elsewhere (to handle redirects)
$user = ( !empty( $search['private'] ) && $search['private'] instanceof User )
? $search['private']
: null;
+
return (
$file->exists() &&
(
};
$repo = $this;
- $applyMatchingFiles = function( ResultWrapper $res, &$searchSet, &$finalFiles )
+ $applyMatchingFiles = function ( ResultWrapper $res, &$searchSet, &$finalFiles )
use ( $repo, $fileMatchesSearch, $flags )
{
global $wgContLang;
$dbKeysLook[] = $wgContLang->lcfirst( $file->getName() );
}
foreach ( $dbKeysLook as $dbKey ) {
- if ( isset( $searchSet[$dbKey])
+ if ( isset( $searchSet[$dbKey] )
&& $fileMatchesSearch( $file, $searchSet[$dbKey] )
) {
$finalFiles[$dbKey] = ( $flags & FileRepo::NAME_AND_TIME_ONLY )
foreach ( array_keys( $searchSet ) as $dbKey ) {
$imgNames[] = $this->getNameFromTitle( File::normalizeTitle( $dbKey ) );
}
+
if ( count( $imgNames ) ) {
$res = $dbr->select( 'image',
LocalFile::selectFields(), array( 'img_name' => $imgNames ), __METHOD__ );
);
}
}
+
if ( count( $oiConds ) ) {
$res = $dbr->select( 'oldimage',
OldLocalFile::selectFields(), $dbr->makeList( $oiConds, LIST_OR ), __METHOD__ );
if ( !empty( $search['ignoreRedirect'] ) ) {
continue;
}
+
$title = File::normalizeTitle( $dbKey );
$redir = $this->checkRedirect( $title ); // hopefully hits memcached
+
if ( $redir && $redir->getNamespace() == NS_FILE ) {
$file = $this->newFile( $redir );
if ( $file && $fileMatchesSearch( $file, $search ) ) {
$file->redirectedFrom( $title->getDBkey() );
if ( $flags & FileRepo::NAME_AND_TIME_ONLY ) {
$finalFiles[$dbKey] = array(
- 'title' => $file->getTitle()->getDBkey(),
+ 'title' => $file->getTitle()->getDBkey(),
'timestamp' => $file->getTimestamp()
);
} else {
$wgMemc->set( $memcKey, ' PURGED', 12 );
}
}
+
+ /**
+ * Return information about the repository.
+ *
+ * @return array
+ * @since 1.22
+ */
+ function getInfo() {
+ global $wgFavicon;
+
+ return array_merge( parent::getInfo(), array(
+ 'favicon' => wfExpandUrl( $wgFavicon ),
+ ) );
+ }
}