X-Git-Url: https://git.cyclocoop.org/?a=blobdiff_plain;f=includes%2FRevision.php;h=7ff73dddbf56fc4849c7c5e1d2450c453fece557;hb=b824b6c052b6a22d7505496c5324c3d906adc5ee;hp=213abbef902c536c78278c5c397a0157ec897f0a;hpb=369b34f0ae64076b91df63e7432f5bf6f19a76a6;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/Revision.php b/includes/Revision.php index 213abbef90..7ff73dddbf 100644 --- a/includes/Revision.php +++ b/includes/Revision.php @@ -739,7 +739,7 @@ class Revision implements IDBAccessObject { /** * Set the title of the revision * - * @deprecated: since 1.31, this is now a noop. Pass the Title to the constructor instead. + * @deprecated since 1.31, this is now a noop. Pass the Title to the constructor instead. * * @param Title $title */ @@ -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 @@ -927,7 +927,7 @@ class Revision implements IDBAccessObject { * used to determine the content model to use. If no title is know, CONTENT_MODEL_WIKITEXT * is used as a last resort. * - * @todo: drop this, with MCR, there no longer is a single model associated with a revision. + * @todo drop this, with MCR, there no longer is a single model associated with a revision. * * @return string The content model id associated with this revision, * see the CONTENT_MODEL_XXX constants. @@ -942,7 +942,7 @@ class Revision implements IDBAccessObject { * If no content format was stored in the database, the default format for this * revision's content model is returned. * - * @todo: drop this, the format is irrelevant to the revision! + * @todo drop this, the format is irrelevant to the revision! * * @return string The content format id associated with this revision, * see the CONTENT_FORMAT_XXX constants. @@ -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 ); } @@ -1094,8 +1110,6 @@ class Revision implements IDBAccessObject { // Avoid PHP 7.1 warning of passing $this by reference $revision = $this; - // TODO: hard-deprecate in 1.32 (or even 1.31?) - Hooks::run( 'RevisionInsertComplete', [ &$revision, null, null ] ); return $rec->getId(); }