Ppchelko has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/316016

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

Don't set rev_len if it's unknown

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


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/EventBus 
refs/changes/16/316016/1

diff --git a/EventBus.hooks.php b/EventBus.hooks.php
index 3a8b25f..97fea36 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,7 +658,7 @@
                        '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 ) ) {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I994ca98ae3809eb16167692ba6fc974f7e67139d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/EventBus
Gerrit-Branch: master
Gerrit-Owner: Ppchelko <ppche...@wikimedia.org>

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

Reply via email to