Aude has uploaded a new change for review.
https://gerrit.wikimedia.org/r/67985
Change subject: (bug 49417) Skip changes in client change handling that with
unknown data type
......................................................................
(bug 49417) Skip changes in client change handling that with unknown data type
(see stack trace and bug report)
Change-Id: Ida64d89b8f44cc862c17558294cea2f1f3d1ecde
---
M client/includes/ChangeHandler.php
1 file changed, 43 insertions(+), 38 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase
refs/changes/85/67985/1
diff --git a/client/includes/ChangeHandler.php
b/client/includes/ChangeHandler.php
index ad41378..f8feca4 100644
--- a/client/includes/ChangeHandler.php
+++ b/client/includes/ChangeHandler.php
@@ -339,50 +339,55 @@
$breakNext = false;
foreach ( $changes as $change ) {
- $action = $change->getAction();
- $meta = $change->getMetadata();
- $user = $meta['user_text'];
- $entityId = $change->getEntityId()->getPrefixedId();
+ try {
+ $action = $change->getAction();
+ $meta = $change->getMetadata();
+ $user = $meta['user_text'];
+ $entityId =
$change->getEntityId()->getPrefixedId();
- $break = $breakNext
- || $currentAction !== $action
- || $currentUser !== $user
- || $currentEntity !== $entityId;
+ $break = $breakNext
+ || $currentAction !== $action
+ || $currentUser !== $user
+ || $currentEntity !== $entityId;
- $breakNext = false;
- $siteGlobalId = $this->site->getGlobalId();
+ $breakNext = false;
+ $siteGlobalId = $this->site->getGlobalId();
- if ( !$break && ( $change instanceof ItemChange ) ) {
- $siteLinkDiff = $change->getSiteLinkDiff();
- if ( isset( $siteLinkDiff[ $siteGlobalId ] ) ) {
- $break = true;
- $breakNext = true;
- };
- }
-
- // FIXME: We should call changeNeedsRendering() and see
if the needs-rendering
- // stays the same, and break the run if not.
This way, uninteresting
- // changes can be sorted out more cleanly later.
- // FIXME: Perhaps more easily, get rid of them here and
now!
- if ( $break ) {
- if ( !empty( $currentRun ) ) {
- try {
- $coalesced[] =
$this->mergeChanges( $currentRun );
- } catch ( \MWException $ex ) {
- // Something went wrong while
trying to merge the changes.
- // Just keep the original run.
- wfWarn( $ex->getMessage() );
- $coalesced = array_merge(
$coalesced, $currentRun );
- }
+ if ( !$break && ( $change instanceof ItemChange
) ) {
+ $siteLinkDiff =
$change->getSiteLinkDiff();
+ if ( isset( $siteLinkDiff[
$siteGlobalId ] ) ) {
+ $break = true;
+ $breakNext = true;
+ };
}
- $currentRun = array();
- $currentUser = $user;
- $currentEntity = $entityId;
- $currentAction = $action === EntityChange::ADD
? EntityChange::UPDATE : $action;
- }
+ // FIXME: We should call changeNeedsRendering()
and see if the needs-rendering
+ // stays the same, and break the run if
not. This way, uninteresting
+ // changes can be sorted out more
cleanly later.
+ // FIXME: Perhaps more easily, get rid of them
here and now!
+ if ( $break ) {
+ if ( !empty( $currentRun ) ) {
+ try {
+ $coalesced[] =
$this->mergeChanges( $currentRun );
+ } catch ( \MWException $ex ) {
+ // Something went wrong
while trying to merge the changes.
+ // Just keep the
original run.
+ wfWarn(
$ex->getMessage() );
+ $coalesced =
array_merge( $coalesced, $currentRun );
+ }
+ }
- $currentRun[] = $change;
+ $currentRun = array();
+ $currentUser = $user;
+ $currentEntity = $entityId;
+ $currentAction = $action ===
EntityChange::ADD ? EntityChange::UPDATE : $action;
+ }
+
+ $currentRun[] = $change;
+ // skip any change that failed to process in some way
(bug 49417)
+ } catch ( \Exception $e ) {
+ wfLogWarning( __CLASS__, __METHOD__ . ':' .
$e->getMessage() );
+ }
}
if ( !empty( $currentRun ) ) {
--
To view, visit https://gerrit.wikimedia.org/r/67985
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ida64d89b8f44cc862c17558294cea2f1f3d1ecde
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: mw1.22-wmf6
Gerrit-Owner: Aude <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits