Revert brion's revert. And learning a lesson about rebinding references. Ergh, I need to read php docs again :)
Removing several & in previous code would have fixed everything, bwah.
This commit is contained in:
parent
8c63b503b1
commit
a2f8d2ac74
2 changed files with 31 additions and 20 deletions
|
|
@ -91,11 +91,8 @@ class Article {
|
|||
} else {
|
||||
return $rt->getFullURL();
|
||||
}
|
||||
} elseif( $rt->exists() ) {
|
||||
// Internal redirects can be handled relatively gracefully.
|
||||
// We may have to change to another Article subclass, though.
|
||||
return $rt;
|
||||
}
|
||||
}
|
||||
return $rt;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -427,6 +424,7 @@ class Article {
|
|||
* @access private
|
||||
*/
|
||||
function loadPageData( $data ) {
|
||||
$this->mTitle->mArticleID = $data->page_id;
|
||||
$this->mTitle->loadRestrictions( $data->page_restrictions );
|
||||
$this->mTitle->mRestrictionsLoaded = true;
|
||||
|
||||
|
|
|
|||
|
|
@ -195,6 +195,7 @@ class MediaWiki {
|
|||
* @return mixed an Article, or a string to redirect to another URL
|
||||
*/
|
||||
function initializeArticle( $title, $request ) {
|
||||
global $wgTitle;
|
||||
wfProfileIn( 'MediaWiki::initializeArticle' );
|
||||
|
||||
$action = $this->getVal('Action');
|
||||
|
|
@ -202,21 +203,33 @@ class MediaWiki {
|
|||
|
||||
// Namespace might change when using redirects
|
||||
if( $action == 'view' && !$request->getVal( 'oldid' ) && $request->getVal( 'redirect' ) != 'no' ) {
|
||||
$target = $article->followRedirect();
|
||||
if( is_string( $target ) ) {
|
||||
global $wgDisableHardRedirects;
|
||||
if( !$wgDisableHardRedirects ) {
|
||||
// we'll need to redirect
|
||||
return $target;
|
||||
$dbr=&wfGetDB(DB_SLAVE);
|
||||
$article->loadPageData($article->pageDataFromTitle($dbr,$title));
|
||||
/* Follow redirects only for... redirects */
|
||||
if ($article->mIsRedirect) {
|
||||
$target = $article->followRedirect();
|
||||
if( is_string( $target ) ) {
|
||||
global $wgDisableHardRedirects;
|
||||
if( !$wgDisableHardRedirects ) {
|
||||
// we'll need to redirect
|
||||
return $target;
|
||||
}
|
||||
}
|
||||
}
|
||||
if( is_object( $target ) ) {
|
||||
// evil globals hack!
|
||||
global $wgTitle;
|
||||
$wgTitle = $target;
|
||||
|
||||
$article = $this->articleFromTitle( $target );
|
||||
$article->setRedirectedFrom( $title );
|
||||
if( is_object( $target ) ) {
|
||||
// evil globals hack!
|
||||
/* Rewrite environment to redirected article */
|
||||
$rarticle =& new Article($target);
|
||||
$rarticle->loadPageData($rarticle->pageDataFromTitle($dbr,$target));
|
||||
if ($rarticle->mTitle->mArticleID) {
|
||||
$article =& $rarticle;
|
||||
$wgTitle = $target;
|
||||
$article->setRedirectedFrom( $title );
|
||||
} else {
|
||||
$wgTitle = $title;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$wgTitle = $article->mTitle;
|
||||
}
|
||||
}
|
||||
wfProfileOut( 'MediaWiki::initializeArticle' );
|
||||
|
|
@ -363,4 +376,4 @@ class MediaWiki {
|
|||
|
||||
}; /* End of class MediaWiki */
|
||||
|
||||
?>
|
||||
?>
|
||||
|
|
|
|||
Loading…
Reference in a new issue