[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Document expandBlob behavior when no flags are given.

2018-01-14 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/403922 )

Change subject: Document expandBlob behavior when no flags are given.
..


Document expandBlob behavior when no flags are given.

Bug: T184749
Change-Id: I5f1f029d928a7bc25877b0eae9f3822ec321b24a
---
M includes/Storage/RevisionStore.php
M includes/Storage/SqlBlobStore.php
2 files changed, 11 insertions(+), 4 deletions(-)

Approvals:
  Daniel Kinzler: Looks good to me, approved
  Addshore: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/Storage/RevisionStore.php 
b/includes/Storage/RevisionStore.php
index b0c193b..f8481fe 100644
--- a/includes/Storage/RevisionStore.php
+++ b/includes/Storage/RevisionStore.php
@@ -804,7 +804,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|null $blobFlags Flags indicating how $blobData needs 
to be processed.
-*  null if no processing should happen.
+*Use null if no processing should happen. That is in constrast 
to the empty string,
+*which causes the blob to be decoded according to the 
configured legacy encoding.
 * @param string|null $blobFormat MIME type indicating how $dataBlob is 
encoded
 * @param int $queryFlags
 *
@@ -825,6 +826,7 @@
$cacheKey = $slot->hasAddress() ? $slot->getAddress() : 
null;
 
if ( $blobFlags === null ) {
+   // No blob flags, so use the blob verbatim.
$data = $blobData;
} else {
$data = $this->blobStore->expandBlob( 
$blobData, $blobFlags, $cacheKey );
diff --git a/includes/Storage/SqlBlobStore.php 
b/includes/Storage/SqlBlobStore.php
index ec66431..031cb58 100644
--- a/includes/Storage/SqlBlobStore.php
+++ b/includes/Storage/SqlBlobStore.php
@@ -369,6 +369,8 @@
 *May be the blob itself, or the blob compressed, or just the 
address
 *of the actual blob, depending on $flags.
 * @param string|string[] $flags Blob flags, such as 'external' or 
'gzip'.
+*   Note that not including 'utf-8' in $flags will cause the data to 
be decoded
+*   according to the legacy encoding specified via setLegacyEncoding.
 * @param string|null $cacheKey May be used for caching if given
 *
 * @return false|string The expanded blob or false on failure
@@ -431,7 +433,8 @@
$blobFlags = [];
 
// Revisions not marked as UTF-8 will have legacy decoding 
applied by decompressData().
-   // XXX: if $this->legacyEncoding is not set, we could skip 
this. May be risky, though.
+   // XXX: if $this->legacyEncoding is not set, we could skip 
this. That would however be
+   // risky, since $this->legacyEncoding being set in the future 
would lead to data corruption.
$blobFlags[] = 'utf-8';
 
if ( $this->compressBlobs ) {
@@ -460,11 +463,13 @@
 * @todo make this private, there should be no need to use this method 
outside this class.
 *
 * @param mixed $blob Reference to a text
-* @param array $blobFlags Compression flags
+* @param array $blobFlags Compression flags, such as 'gzip'.
+*   Note that not including 'utf-8' in $blobFlags will cause the data 
to be decoded
+*   according to the legacy encoding specified via setLegacyEncoding.
 *
 * @return string|bool Decompressed text, or false on failure
 */
-   public function decompressData( $blob, $blobFlags ) {
+   public function decompressData( $blob, array $blobFlags ) {
if ( $blob === false ) {
// Text failed to be fetched; nothing to do
return false;

-- 
To view, visit https://gerrit.wikimedia.org/r/403922
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I5f1f029d928a7bc25877b0eae9f3822ec321b24a
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Daniel Kinzler 
Gerrit-Reviewer: Addshore 
Gerrit-Reviewer: Anomie 
Gerrit-Reviewer: Daniel Kinzler 
Gerrit-Reviewer: jenkins-bot <>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Document expandBlob behavior when no flags are given.

2018-01-12 Thread Daniel Kinzler (Code Review)
Daniel Kinzler has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/403922 )

Change subject: Document expandBlob behavior when no flags are given.
..

Document expandBlob behavior when no flags are given.

Bug: T184749
Change-Id: I5f1f029d928a7bc25877b0eae9f3822ec321b24a
---
M includes/Storage/RevisionStore.php
M includes/Storage/SqlBlobStore.php
2 files changed, 11 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/22/403922/1

diff --git a/includes/Storage/RevisionStore.php 
b/includes/Storage/RevisionStore.php
index bca4a4d..246f33a 100644
--- a/includes/Storage/RevisionStore.php
+++ b/includes/Storage/RevisionStore.php
@@ -798,7 +798,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|null $blobFlags Flags indicating how $blobData needs 
to be processed.
-*  null if no processing should happen.
+*Use null if no processing should happen. That is in constrast 
to the empty string,
+*which causes the blob to be decoded according to the 
configured legacy encoding.
 * @param string|null $blobFormat MIME type indicating how $dataBlob is 
encoded
 * @param int $queryFlags
 *
@@ -819,6 +820,7 @@
$cacheKey = $slot->hasAddress() ? $slot->getAddress() : 
null;
 
if ( $blobFlags === null ) {
+   // No blob flags, so use the blob verbatim.
$data = $blobData;
} else {
$data = $this->blobStore->expandBlob( 
$blobData, $blobFlags, $cacheKey );
diff --git a/includes/Storage/SqlBlobStore.php 
b/includes/Storage/SqlBlobStore.php
index 5ddbd34..b270844 100644
--- a/includes/Storage/SqlBlobStore.php
+++ b/includes/Storage/SqlBlobStore.php
@@ -365,6 +365,8 @@
 *May be the blob itself, or the blob compressed, or just the 
address
 *of the actual blob, depending on $flags.
 * @param string|string[] $flags Blob flags, such as 'external' or 
'gzip'.
+*   Note that not including 'utf-8' in $flags will cause the data to 
be decoded
+*   according to the legacy encoding specified via setLegacyEncoding.
 * @param string|null $cacheKey May be used for caching if given
 *
 * @return false|string The expanded blob or false on failure
@@ -427,7 +429,8 @@
$blobFlags = [];
 
// Revisions not marked as UTF-8 will have legacy decoding 
applied by decompressData().
-   // XXX: if $this->legacyEncoding is not set, we could skip 
this. May be risky, though.
+   // XXX: if $this->legacyEncoding is not set, we could skip 
this. That would however be
+   // risky, since $this->legacyEncoding being set in the future 
would lead to data corruption.
$blobFlags[] = 'utf-8';
 
if ( $this->compressBlobs ) {
@@ -456,11 +459,13 @@
 * @todo make this private, there should be no need to use this method 
outside this class.
 *
 * @param mixed $blob Reference to a text
-* @param array $blobFlags Compression flags
+* @param array $blobFlags Compression flags, such as 'gzip'.
+*   Note that not including 'utf-8' in $blobFlags will cause the data 
to be decoded
+*   according to the legacy encoding specified via setLegacyEncoding.
 *
 * @return string|bool Decompressed text, or false on failure
 */
-   public function decompressData( $blob, $blobFlags ) {
+   public function decompressData( $blob, array $blobFlags ) {
if ( $blob === false ) {
// Text failed to be fetched; nothing to do
return false;

-- 
To view, visit https://gerrit.wikimedia.org/r/403922
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5f1f029d928a7bc25877b0eae9f3822ec321b24a
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Daniel Kinzler 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits