Merge "Add MessagesBi.php"
[lhc/web/wiklou.git] / includes / filerepo / file / LocalFile.php
index 742d78d..fa6e180 100644 (file)
@@ -2115,17 +2115,22 @@ class LocalFile extends File {
         * @param Language|null $lang What language to get description in (Optional)
         * @return string|false
         */
-       function getDescriptionText( $lang = null ) {
-               $revision = Revision::newFromTitle( $this->title, false, Revision::READ_NORMAL );
+       function getDescriptionText( Language $lang = null ) {
+               $store = MediaWikiServices::getInstance()->getRevisionStore();
+               $revision = $store->getRevisionByTitle( $this->title, 0, Revision::READ_NORMAL );
                if ( !$revision ) {
                        return false;
                }
-               $content = $revision->getContent();
-               if ( !$content ) {
+
+               $renderer = MediaWikiServices::getInstance()->getRevisionRenderer();
+               $rendered = $renderer->getRenderedRevision( $revision, new ParserOptions( null, $lang ) );
+
+               if ( !$rendered ) {
+                       // audience check failed
                        return false;
                }
-               $pout = $content->getParserOutput( $this->title, null, new ParserOptions( null, $lang ) );
 
+               $pout = $rendered->getRevisionParserOutput();
                return $pout->getText();
        }
 
@@ -3146,7 +3151,7 @@ class LocalFileRestoreBatch {
 
        /**
         * Cleanup a failed batch. The batch was only partially successful, so
-        * rollback by removing all items that were succesfully copied.
+        * rollback by removing all items that were successfully copied.
         *
         * @param Status $storeStatus
         * @param array[] $storeBatch