* (bug 12644) Template list on edit page now sorted on preview
* (bug 14058) Support pipe trick for namespaces and interwikis with "-"
* Message name filter on Special:Allmessages now case-insensitive
+* (bug 13943) Fix image redirect behaviour on image pages
=== API changes in 1.13 ===
// Foreign image page
$from = $this->img->getRedirected();
- return $this->mRedirectTarget = Title::makeTitle( NS_IMAGE, $from );
+ $to = $this->img->getName();
+ if ($from == $to) return null;
+ return $this->mRedirectTarget = Title::makeTitle( NS_IMAGE, $to );
}
public function followRedirect() {
if ( $this->img->isLocal() )
return parent::followRedirect();
$from = $this->img->getRedirected();
- return Title::makeTitle( NS_IMAGE, $from );
+ $to = $this->img->getName();
+ if ($from == $to) return false;
+ return Title::makeTitle( NS_IMAGE, $to );
}
public function isRedirect( $text = false ) {
if ( $this->img->isLocal() )
return (bool)$this->img->getRedirected();
}
+
+ public function isLocal() {
+ return $this->img->isLocal();
+ }
/**
* Create the TOC
return $target;
}
}
+
if( is_object( $target ) ) {
// Rewrite environment to redirected article
$rarticle = self::articleFromTitle( $target );
$rarticle->loadPageData( $rarticle->pageDataFromTitle( $dbr, $target ) );
- if ( $rarticle->getTitle()->exists() ) {
+ if ( $rarticle->getTitle()->exists() ||
+ ( $title->getNamespace() == NS_IMAGE &&
+ !$article->isLocal() ) ) {
$rarticle->setRedirectedFrom( $title );
$article = $rarticle;
$title = $target;