From: Derk-Jan Hartman Date: Sun, 1 Aug 2010 22:07:52 +0000 (+0000) Subject: Repair getDescriptionUrl() and getDescriptionText() Follow up to r69907 and r69908 X-Git-Tag: 1.31.0-rc.0~35791 X-Git-Url: http://git.cyclocoop.org/wiki/Target_page?a=commitdiff_plain;h=410ac75304d8b3f43f1dc1b6aa01b28c1dfea004;p=lhc%2Fweb%2Fwiklou.git Repair getDescriptionUrl() and getDescriptionText() Follow up to r69907 and r69908 All this functionality is now moved to File.php. for getDescriptionUrl there was no real need to subclass this method, for getDescriptionText() there was, but duplicating the code or changing the inheritence model of LocalFile and ForeignDBFile seems too much work if an isLocal in File.php suffices. --- diff --git a/includes/filerepo/File.php b/includes/filerepo/File.php index 1469668e87..a9c6437f46 100644 --- a/includes/filerepo/File.php +++ b/includes/filerepo/File.php @@ -1078,8 +1078,19 @@ 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 bec288f009..83c12f9d55 100644 --- a/includes/filerepo/ForeignDBFile.php +++ b/includes/filerepo/ForeignDBFile.php @@ -36,14 +36,4 @@ class ForeignDBFile extends LocalFile { function move( $target ) { $this->readOnlyError(); } - - function getDescriptionUrl() { - // Restore remote behaviour - return parent::getDescriptionUrl(); - } - - function getDescriptionText() { - // Restore remote behaviour - return parent::getDescriptionText(); - } } diff --git a/includes/filerepo/LocalFile.php b/includes/filerepo/LocalFile.php index b35ba0b6a1..3dd294cb7d 100644 --- a/includes/filerepo/LocalFile.php +++ b/includes/filerepo/LocalFile.php @@ -1121,27 +1121,8 @@ class LocalFile extends File { /** scaleHeight inherited */ /** getImageSize 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(); - } + /** getDescriptionUrl inherited */ + /** getDescriptionText inherited */ function getDescription() { $this->load();