Aaron Schulz has uploaded a new change for review.
https://gerrit.wikimedia.org/r/102303
Change subject: Fixed error in LocalRepo::findFiles()
......................................................................
Fixed error in LocalRepo::findFiles()
* This occured if the client wiki did not capitalize, and the
repo did, and a file was searched under the un-capitized name.
bug: 58587
Change-Id: I657c96c6d06af12866c71df194e18feb9ad53bd9
---
M includes/filerepo/LocalRepo.php
1 file changed, 17 insertions(+), 7 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/03/102303/1
diff --git a/includes/filerepo/LocalRepo.php b/includes/filerepo/LocalRepo.php
index 2df28bc..a7ea907 100644
--- a/includes/filerepo/LocalRepo.php
+++ b/includes/filerepo/LocalRepo.php
@@ -275,15 +275,25 @@
$applyMatchingFiles = function( ResultWrapper $res,
&$searchSet, &$finalFiles )
use ( $repo, $fileMatchesSearch, $flags )
{
+ global $wgContLang;
foreach ( $res as $row ) {
$file = $repo->newFileFromRow( $row );
- $dbKey = $file->getTitle()->getDBkey();
- // There must have been a search for this exact
DB Key
- if ( $fileMatchesSearch( $file,
$searchSet[$dbKey] ) ) {
- $finalFiles[$dbKey] = ( $flags &
FileRepo::NAME_AND_TIME_ONLY )
- ? array( 'title' => $dbKey,
'timestamp' => $file->getTimestamp() )
- : $file;
- unset( $searchSet[$dbKey] );
+ $info = $repo->getInfo();
+ // There must have been a search for this DB
key, but this has to handle the
+ // cases were title capitalization is different
on the client and repo wikis.
+ $dbKeysLook = array( str_replace( ' ', '_',
$file->getName() ) );
+ if ( !empty( $info['initialCapital'] ) ) {
+ $dbKeysLook[] = $wgContLang->lcfirst(
$file->getName() );
+ }
+ foreach ( $dbKeysLook as $dbKey ) {
+ if ( isset( $searchSet[$dbKey])
+ && $fileMatchesSearch( $file,
$searchSet[$dbKey] )
+ ) {
+ $finalFiles[$dbKey] = ( $flags
& FileRepo::NAME_AND_TIME_ONLY )
+ ? array( 'title' =>
$dbKey, 'timestamp' => $file->getTimestamp() )
+ : $file;
+ unset( $searchSet[$dbKey] );
+ }
}
}
};
--
To view, visit https://gerrit.wikimedia.org/r/102303
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I657c96c6d06af12866c71df194e18feb9ad53bd9
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits