Addshore has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/403909 )
Change subject: RevisionStore, fix loadSlotContent with no $blobFlags
......................................................................
RevisionStore, fix loadSlotContent with no $blobFlags
Tested in followup:
I6dcfc0497bfce6605fa5517c9f91faf7131f4334
Bug: T184749
Change-Id: Ieb02ac593fc6b42af1692d03d9d578a76417eb54
---
M includes/Storage/RevisionStore.php
1 file changed, 17 insertions(+), 12 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/09/403909/1
diff --git a/includes/Storage/RevisionStore.php
b/includes/Storage/RevisionStore.php
index 6c8cac9..bca4a4d 100644
--- a/includes/Storage/RevisionStore.php
+++ b/includes/Storage/RevisionStore.php
@@ -689,7 +689,7 @@
$content = null;
$blobData = null;
- $blobFlags = '';
+ $blobFlags = null;
if ( is_object( $row ) ) {
// archive row
@@ -706,7 +706,7 @@
if ( isset( $row->old_text ) ) {
// this happens when the text-table gets joined
directly, in the pre-1.30 schema
$blobData = isset( $row->old_text ) ? strval(
$row->old_text ) : null;
- $blobFlags = isset( $row->old_flags ) ? strval(
$row->old_flags ) : '';
+ $blobFlags = isset( $row->old_flags ) ? strval(
$row->old_flags ) : null;
}
$mainSlotRow->slot_revision = intval( $row->rev_id );
@@ -735,7 +735,7 @@
$mainSlotRow->format_name = isset(
$row['content_format'] )
? strval( $row['content_format'] ) : null;
$blobData = isset( $row['text'] ) ? rtrim( strval(
$row['text'] ) ) : null;
- $blobFlags = isset( $row['flags'] ) ? trim( strval(
$row['flags'] ) ) : '';
+ $blobFlags = isset( $row['flags'] ) ? trim( strval(
$row['flags'] ) ) : null;
// if we have a Content object, override mText and
mContentModel
if ( !empty( $row['content'] ) ) {
@@ -797,7 +797,8 @@
*
* @param SlotRecord $slot The SlotRecord to load content for
* @param string|null $blobData The content blob, in the form indicated
by $blobFlags
- * @param string $blobFlags Flags indicating how $blobData needs to be
processed
+ * @param string|null $blobFlags Flags indicating how $blobData needs
to be processed.
+ * null if no processing should happen.
* @param string|null $blobFormat MIME type indicating how $dataBlob is
encoded
* @param int $queryFlags
*
@@ -807,23 +808,27 @@
private function loadSlotContent(
SlotRecord $slot,
$blobData = null,
- $blobFlags = '',
+ $blobFlags = null,
$blobFormat = null,
$queryFlags = 0
) {
if ( $blobData !== null ) {
Assert::parameterType( 'string', $blobData, '$blobData'
);
- Assert::parameterType( 'string', $blobFlags,
'$blobFlags' );
+ Assert::parameterType( 'string|null', $blobFlags,
'$blobFlags' );
$cacheKey = $slot->hasAddress() ? $slot->getAddress() :
null;
- $data = $this->blobStore->expandBlob( $blobData,
$blobFlags, $cacheKey );
-
- if ( $data === false ) {
- throw new RevisionAccessException(
- "Failed to expand blob data using flags
$blobFlags (key: $cacheKey)"
- );
+ if ( $blobFlags === null ) {
+ $data = $blobData;
+ } else {
+ $data = $this->blobStore->expandBlob(
$blobData, $blobFlags, $cacheKey );
+ if ( $data === false ) {
+ throw new RevisionAccessException(
+ "Failed to expand blob data
using flags $blobFlags (key: $cacheKey)"
+ );
+ }
}
+
} else {
$address = $slot->getAddress();
try {
--
To view, visit https://gerrit.wikimedia.org/r/403909
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ieb02ac593fc6b42af1692d03d9d578a76417eb54
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Addshore <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits