jenkins-bot has submitted this change and it was merged.

Change subject: Don't set rev_len if it's unknown
......................................................................


Don't set rev_len if it's unknown

Also emoved unneeded spaces with square brackets.

Change-Id: I994ca98ae3809eb16167692ba6fc974f7e67139d
---
M EventBus.hooks.php
1 file changed, 10 insertions(+), 5 deletions(-)

Approvals:
  Ottomata: Looks good to me, but someone else must approve
  Mobrovac: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/EventBus.hooks.php b/EventBus.hooks.php
index 3a8b25f..69339f0 100644
--- a/EventBus.hooks.php
+++ b/EventBus.hooks.php
@@ -155,11 +155,16 @@
                        'rev_id'             => $revision->getId(),
                        'rev_timestamp'      => wfTimestamp( TS_ISO_8601, 
$revision->getTimestamp() ),
                        'rev_sha1'           => $revision->getSha1(),
-                       'rev_len'            => $revision->getSize(),
                        'rev_minor_edit'     => $revision->isMinor(),
                        'rev_content_model'  => $revision->getContentModel(),
                        'rev_content_format' => $revision->getContentModel(),
                ];
+
+               // It is possible rev_len is not known. It's not a required 
field,
+               // so don't set it if it's NULL
+               if ( !is_null( $revision->getSize() ) ) {
+                       $attrs['rev_len'] = $revision->getSize();
+               }
 
                // It is possible that the $revision object does not have any 
content
                // at the time of RevisionInsertComplete.  This might happen 
during
@@ -653,19 +658,19 @@
                        'page_title'         => $title->getPrefixedDBkey(),
                        'page_namespace'     => $title->getNamespace(),
                        'page_is_redirect'   => $title->isRedirect(),
-                       'rev_id'             =>$revision->getId()
+                       'rev_id'             => $revision->getId()
                ];
 
                if ( !is_null( $user ) ) {
-                       $attrs[ 'performer' ] = self::createPerformerAttrs( 
$user );
+                       $attrs['performer'] = self::createPerformerAttrs( $user 
);
                }
 
                if ( !empty( $addedProps ) ) {
-                       $attrs[ 'added_properties' ] = $addedProps;
+                       $attrs['added_properties'] = $addedProps;
                }
 
                if ( !empty( $removedProps ) ) {
-                       $attrs[ 'removed_properties' ] = $removedProps;
+                       $attrs['removed_properties'] = $removedProps;
                }
 
                $events[] = self::createEvent(

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I994ca98ae3809eb16167692ba6fc974f7e67139d
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/EventBus
Gerrit-Branch: master
Gerrit-Owner: Ppchelko <ppche...@wikimedia.org>
Gerrit-Reviewer: GWicke <gwi...@wikimedia.org>
Gerrit-Reviewer: Mobrovac <mobro...@wikimedia.org>
Gerrit-Reviewer: Ottomata <o...@wikimedia.org>
Gerrit-Reviewer: Ppchelko <ppche...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to