Revert r69907, r69908, r70264, r70296: introduces bug 27477.
authorBryan Tong Minh <btongminh@users.mediawiki.org>
Wed, 2 Mar 2011 21:06:54 +0000 (21:06 +0000)
committerBryan Tong Minh <btongminh@users.mediawiki.org>
Wed, 2 Mar 2011 21:06:54 +0000 (21:06 +0000)
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
includes/filerepo/ForeignDBFile.php
includes/filerepo/LocalFile.php

index 6dfb634..e4de338 100644 (file)
@@ -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;
index 34a11cc..5f04ea7 100644 (file)
@@ -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();
+       }
 }
index 328951c..ebc0efe 100644 (file)
@@ -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();