From 7a6aadf42d73d1e65310fdff6e803b45a2205760 Mon Sep 17 00:00:00 2001 From: Bryan Tong Minh Date: Wed, 2 Mar 2011 21:06:54 +0000 Subject: [PATCH] Revert r69907, r69908, r70264, r70296: introduces bug 27477. The previous situation is not very nice and this should be fixed properly, but is not so much of a priority it did work before. There are some long discussions on CR about this if anybody is interested in fixing this. --- includes/filerepo/File.php | 15 --------------- includes/filerepo/ForeignDBFile.php | 10 ++++++++++ includes/filerepo/LocalFile.php | 23 +++++++++++++++++++++-- 3 files changed, 31 insertions(+), 17 deletions(-) diff --git a/includes/filerepo/File.php b/includes/filerepo/File.php index 6dfb634f25..e4de3383bc 100644 --- a/includes/filerepo/File.php +++ b/includes/filerepo/File.php @@ -1122,23 +1122,8 @@ abstract class File { /** * Get the HTML text of the description page, if available - * For local files ImagePage does not use it, because it skips the parser cache. */ function getDescriptionText() { - if( $this->isLocal() ) { - global $wgParser; - $revision = Revision::newFromTitle( $this->title ); - if ( !$revision ) { - return false; - } - $text = $revision->getText(); - if ( !$text ) { - return false; - } - $pout = $wgParser->parse( $text, $this->title, new ParserOptions() ); - return $pout->getText(); - } - global $wgMemc, $wgLang; if ( !$this->repo->fetchDescription ) { return false; diff --git a/includes/filerepo/ForeignDBFile.php b/includes/filerepo/ForeignDBFile.php index 34a11cc29c..5f04ea731b 100644 --- a/includes/filerepo/ForeignDBFile.php +++ b/includes/filerepo/ForeignDBFile.php @@ -44,4 +44,14 @@ class ForeignDBFile extends LocalFile { function move( $target ) { $this->readOnlyError(); } + + function getDescriptionUrl() { + // Restore remote behaviour + return File::getDescriptionUrl(); + } + + function getDescriptionText() { + // Restore remote behaviour + return File::getDescriptionText(); + } } diff --git a/includes/filerepo/LocalFile.php b/includes/filerepo/LocalFile.php index 328951c05b..ebc0efef78 100644 --- a/includes/filerepo/LocalFile.php +++ b/includes/filerepo/LocalFile.php @@ -1217,8 +1217,27 @@ class LocalFile extends File { /** scaleHeight inherited */ /** getImageSize inherited */ - /** getDescriptionUrl inherited */ - /** getDescriptionText inherited */ + /** + * Get the URL of the file description page. + */ + function getDescriptionUrl() { + return $this->title->getLocalUrl(); + } + + /** + * Get the HTML text of the description page + * This is not used by ImagePage for local files, since (among other things) + * it skips the parser cache. + */ + function getDescriptionText() { + global $wgParser; + $revision = Revision::newFromTitle( $this->title ); + if ( !$revision ) return false; + $text = $revision->getText(); + if ( !$text ) return false; + $pout = $wgParser->parse( $text, $this->title, new ParserOptions() ); + return $pout->getText(); + } function getDescription() { $this->load(); -- 2.20.1