return $row['title'];
}
- $pageId = isset( $row['page'] ) ? $row['page'] : 0;
- $revId = isset( $row['id'] ) ? $row['id'] : 0;
+ $pageId = $row['page'] ?? 0;
+ $revId = $row['id'] ?? 0;
} else {
- $pageId = isset( $row->rev_page ) ? $row->rev_page : 0;
- $revId = isset( $row->rev_id ) ? $row->rev_id : 0;
+ $pageId = $row->rev_page ?? 0;
+ $revId = $row->rev_id ?? 0;
}
try {
* 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
? 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;
}
/**
* @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 );
}
// 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();
}