* Add APCOND_INGROUPS
* Add DBA caching to installer
* (bug 18585) Added a bunch of parameters to the revertpage message
+* Support redirects in image namespace
=== Bug fixes in 1.12 ===
$upload = SpecialPage::getTitleFor( 'Upload' );
if( $text == '' )
$text = htmlspecialchars( $title->getPrefixedText() );
+ $redir = RepoGroup::getLocalRepo()->checkRedirect( $title );
+ if( $redir ) {
+ return $this->makeKnownLinkObj( $title, $text, $query, $trail, $prefix );
+ }
$q = 'wpDestFile=' . $title->getPartialUrl();
if( $query != '' )
$q .= '&' . $query;
switch( $title->getNamespace() ) {
case NS_IMAGE:
+ $file = wfFindFile( $title );
+ if( $file && $file->getRedirected() ) {
+ return new Article( $title );
+ }
return new ImagePage( $title );
case NS_CATEGORY:
return new CategoryPage( $title );
if ( $img->exists() ) {
return $img;
}
+
+ # Now try redirects
+ $redir = $this->checkRedirect( $title );
+ if( $redir ) {
+ $img = $this->newFile( $redir );
+ if( !$img ) {
+ return false;
+ }
+ if( $img->exists() ) {
+ $img->redirectedFrom( $title->getText() );
+ return $img;
+ }
+ }
}
/**
* STUB
*/
function cleanupDeletedBatch( $storageKeys ) {}
+
+ /**
+ * Checks if there is a redirect named as $title
+ * STUB
+ *
+ * @param Title $title Title of image
+ */
+ function checkRedirect( $title ) {
+ return false;
+ }
}
}
return $status;
}
+
+ /**
+ * Function link Title::getArticleID().
+ * We can't say Title object, what database it should use, so we duplicate that function here.
+ */
+ function getArticleID( $title ) {
+ if( !$title instanceof Title ) {
+ return 0;
+ }
+ $dbr = $this->getSlaveDB();
+ $id = $dbr->selectField(
+ 'page', // Table
+ 'page_id', //Field
+ array( //Conditions
+ 'page_namespace' => $title->getNamespace(),
+ 'page_title' => $title->getDbKey(),
+ ),
+ __METHOD__ //Function name
+ );
+ return $id;
+ }
+
+ function checkRedirect( $title ) {
+ $id = $this->getArticleID( $title );
+ if( !$id ) {
+ return false;
+ }
+ $dbr = $this->getSlaveDB();
+ $row = $dbr->selectRow(
+ 'redirect',
+ array( 'rd_title', 'rd_namespace' ),
+ array( 'rd_from' => $id ),
+ __METHOD__
+ );
+ if( !$row ) {
+ return false;
+ }
+ if( $row->rd_namespace != NS_IMAGE ) {
+ return false;
+ }
+ return Title::makeTitle( $row->rd_namespace, $row->rd_title );
+ }
}
return false;
}
+ /**
+ * Interface for FileRepo::checkRedirect()
+ */
+ function checkRedirect( $title ) {
+ if ( !$this->reposInitialised ) {
+ $this->initialiseRepos();
+ }
+
+ $redir = $this->localRepo->checkRedirect( $title );
+ if( $redir ) {
+ return $redir;
+ }
+ foreach ( $this->foreignRepos as $repo ) {
+ $redir = $repo->checkRedirect( $title );
+ if ( $redir ) {
+ return $redir;
+ }
+ }
+ return false;
+ }
+
/**
* Get the repo instance with a given key.
*/