wfProfileIn( $fname );
+ $key = strtolower( $key );
+
$k = $wgDBname.':interwiki:'.$key;
if( array_key_exists( $k, $wgTitleInterwikiCache ) ) {
wfProfileOut( $fname );
* @access public
*/
function getNsText() {
- global $wgLang;
- return $wgLang->getNsText( $this->mNamespace );
+ global $wgContLang;
+ return $wgContLang->getNsText( $this->mNamespace );
}
+ /**
+ * Get the namespace text of the subject (rather than talk) page
+ * @return string
+ * @access public
+ */
+ function getSubjectNsText() {
+ global $wgContLang;
+ return $wgContLang->getNsText( Namespace::getSubject( $this->mNamespace ) );
+ }
+
/**
* Get the interwiki prefix (or null string)
* @return string
# Interwiki link
$t = $m[2];
- $this->mInterwiki = $p;
+ $this->mInterwiki = strtolower( $p );
# Redundant interwiki prefix to the local wiki
if ( 0 == strcasecmp( $this->mInterwiki, $wgLocalInterwiki ) ) {
# Is it a redirect?
$id = $nt->getArticleID();
$obj = $dbw->selectRow( array( 'page', 'revision', 'text'),
- array( 'page_is_redirect','old_text' ),
+ array( 'page_is_redirect','old_text','old_flags' ),
array( 'page_id' => $id, 'page_latest=rev_id', 'rev_text_id=old_id' ),
$fname, 'FOR UPDATE' );
# Not a redirect
return false;
}
+ $text = Revision::getRevisionText( $obj );
# Does the redirect point to the source?
- if ( preg_match( "/\\[\\[\\s*([^\\]\\|]*)]]/", $obj->old_text, $m ) ) {
+ if ( preg_match( "/\\[\\[\\s*([^\\]\\|]*)]]/", $text, $m ) ) {
$redirTitle = Title::newFromText( $m[1] );
if( !is_object( $redirTitle ) ||
$redirTitle->getPrefixedDBkey() != $this->getPrefixedDBkey() ) {
return false;
}
+ } else {
+ # Fail safe
+ return false;
}
# Does the article have a history?