maintenance/interwiki.*: Replace Wikimedia Foundation wiki URL
[lhc/web/wiklou.git] / includes / Revision.php
index b9a03f5..d6ff384 100644 (file)
@@ -887,7 +887,7 @@ class Revision implements IDBAccessObject {
         *   Revision::FOR_PUBLIC       to be displayed to all users
         *   Revision::FOR_THIS_USER    to be displayed to $user
         *   Revision::RAW              get the text regardless of permissions
-        * @param User $user User object to check for, only if FOR_THIS_USER is passed
+        * @param User|null $user User object to check for, only if FOR_THIS_USER is passed
         *   to the $audience parameter
         * @since 1.21
         * @return Content|null
@@ -1038,7 +1038,18 @@ class Revision implements IDBAccessObject {
                        ? SqlBlobStore::makeAddressFromTextId( $row->old_id )
                        : null;
 
-               return self::getBlobStore( $wiki )->expandBlob( $text, $flags, $cacheKey );
+               $revisionText = self::getBlobStore( $wiki )->expandBlob( $text, $flags, $cacheKey );
+
+               if ( $revisionText === false ) {
+                       if ( isset( $row->old_id ) ) {
+                               wfLogWarning( __METHOD__ . ": Bad data in text row {$row->old_id}! " );
+                       } else {
+                               wfLogWarning( __METHOD__ . ": Bad data in text row! " );
+                       }
+                       return false;
+               }
+
+               return $revisionText;
        }
 
        /**
@@ -1063,6 +1074,11 @@ class Revision implements IDBAccessObject {
         * @return string|bool Decompressed text, or false on failure
         */
        public static function decompressRevisionText( $text, $flags ) {
+               if ( $text === false ) {
+                       // Text failed to be fetched; nothing to do
+                       return false;
+               }
+
                return self::getBlobStore()->decompressData( $text, $flags );
        }