* thumbScriptUrl The URL for thumb.php (optional, not recommended)
* transformVia404 Whether to skip media file transformation on parse and rely on a 404
* handler instead.
+ * initialCapital Equivalent to $wgCapitalLinks, determines whether filenames implicitly
+ * start with a capital letter. The current implementation may give incorrect
+ * description page links when the local $wgCapitalLinks and initialCapital
+ * are mismatched.
*
* These settings describe a foreign MediaWiki installation. They are optional, and will be ignored
* for local repositories:
var $mTextform; # Text form (spaces not underscores) of the main part
var $mUrlform; # URL-encoded form of the main part
var $mDbkeyform; # Main part with underscores
+ var $mUserCaseDBKey; # DB key with the initial letter in the case specified by the user
var $mNamespace; # Namespace index, i.e. one of the NS_xxxx constants
var $mInterwiki; # Interwiki prefix (or null string)
var $mFragment; # Title fragment (i.e. the bit after the #)
}
return $wgContLang->getNsText( $this->mNamespace );
}
+ /**
+ * Get the DB key with the initial letter case as specified by the user
+ */
+ function getUserCaseDBKey() {
+ return $this->mUserCaseDBKey;
+ }
/**
* Get the namespace text of the subject (rather than talk) page
* @return string
* Don't force it for interwikis, since the other
* site might be case-sensitive.
*/
+ $this->mUserCaseDBKey = $dbkey;
if( $wgCapitalLinks && $this->mInterwiki == '') {
$dbkey = $wgContLang->ucfirst( $dbkey );
}
const DELETE_SOURCE = 1;
var $directory, $url, $hashLevels, $thumbScriptUrl, $transformVia404;
- var $descBaseUrl, $scriptDirUrl, $articleUrl, $fetchDescription;
+ var $descBaseUrl, $scriptDirUrl, $articleUrl, $fetchDescription, $initialCapital;
var $fileFactory = array( 'UnregisteredLocalFile', 'newFromTitle' );
var $oldFileFactory = false;
$this->transformVia404 = !empty( $info['transformVia404'] );
// Optional settings
+ $this->initialCapital = true; // by default
foreach ( array( 'descBaseUrl', 'scriptDirUrl', 'articleUrl', 'fetchDescription',
- 'thumbScriptUrl' ) as $var )
+ 'thumbScriptUrl', 'initialCapital' ) as $var )
{
if ( isset( $info[$var] ) ) {
$this->$var = $info[$var];
/**
* Get a relative path including trailing slash, e.g. f/fa/
- * If the repo is not hashed, returns an empty string
+ * If the repo is not hashed, returns a slash
*/
function getHashPath( $name ) {
if ( $this->isHashed() ) {
}
return $path;
} else {
- return '';
+ return '/';
}
}
function enumFiles( $callback ) {
$this->enumFilesInFS( $callback );
}
+
+ /**
+ * Get the name of an image from its title object
+ */
+ function getNameFromTitle( $title ) {
+ global $wgCapitalLinks;
+ if ( $this->initialCapital != $wgCapitalLinks ) {
+ global $wgContLang;
+ $name = $title->getUserCaseDBKey();
+ if ( $this->initialCapital ) {
+ $name = $wgContLang->ucfirst( $name );
+ }
+ } else {
+ $name = $title->getDBkey();
+ }
+ return $name;
+ }
}
?>