Matthias Mullie has uploaded a new change for review. https://gerrit.wikimedia.org/r/78081
Change subject: Decompress revision text ...................................................................... Decompress revision text Revision text gzip-saved (via Revision::compressRevisionText()) was not being decompressed (resulting in garbled output) Meanwhile, I don't really see why find() needs its own code; it does exactly what findMulti() does, so no need to duplicate that code. Depends on https://gerrit.wikimedia.org/r/#/c/78079/, which introduces Revision::decompressRevisionText() Change-Id: I82a5f68dde312fbb5cb6ce60fe46234a23f7a3b0 --- M includes/Data/ObjectManager.php M includes/Data/RevisionStorage.php 2 files changed, 18 insertions(+), 17 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Flow refs/changes/81/78081/1 diff --git a/includes/Data/ObjectManager.php b/includes/Data/ObjectManager.php index 64e7a9e..4155762 100644 --- a/includes/Data/ObjectManager.php +++ b/includes/Data/ObjectManager.php @@ -31,9 +31,9 @@ interface ObjectStorage { function find( array $attributes, array $options = array() ); /** - * The BagOStuff interface returns with keys matching the key, unfortunatly + * The BagOStuff interface returns with keys matching the key, unfortunately * we deal with composite keys which makes that awkward. Instead all findMulti - * implementations must return their result as if it was arrap_map( array( $obj, 'find' ), $queries ). + * implementations must return their result as if it was array_map( array( $obj, 'find' ), $queries ). * This is necessary so result sets stay ordered * * diff --git a/includes/Data/RevisionStorage.php b/includes/Data/RevisionStorage.php index 7ef7cbb..9585012 100644 --- a/includes/Data/RevisionStorage.php +++ b/includes/Data/RevisionStorage.php @@ -25,21 +25,13 @@ } // Find one by specific attributes + // @todo: this method can probably be generalized in parent class? public function find( array $attributes, array $options = array() ) { - global $wgFlowExternalStore; - - $res = $this->findInternal( $attributes, $options ); - if ( $res === false ) { - return false; + $multi = $this->findMulti( array( $attributes ), $options ); + if ( $multi ) { + return reset( $multi ); } - if ( $wgFlowExternalStore ) { - $res = Merger::merge( - $res, - 'text_content', - array( 'ExternalStore', 'batchFetchByURLs' ) - ); - } - return $res; + return null; } protected function findInternal( array $attributes, array $options = array() ) { @@ -73,16 +65,25 @@ } else { $res = $this->findMultiInternal( $queries, $options ); } + if ( $wgFlowExternalStore ) { - return Merger::mergeMulti( + $res = Merger::mergeMulti( $res, 'text_content', array( 'ExternalStore', 'batchFetchFromURLs' ) ); } + + // decompress content + foreach ( $res as &$record ) { + foreach ( $record as $id => &$row ) { + $flags = explode( ',', $row['text_flags'] ); + $row['text_content'] = \Revision::decompressRevisionText( $row['text_content'], $flags ); + } + } + return $res; } - protected function fallbackFindMulti( array $queries, array $options ) { $result = array(); -- To view, visit https://gerrit.wikimedia.org/r/78081 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I82a5f68dde312fbb5cb6ce60fe46234a23f7a3b0 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Flow Gerrit-Branch: master Gerrit-Owner: Matthias Mullie <[email protected]> _______________________________________________ MediaWiki-commits mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
