Mobrovac has uploaded a new change for review.
https://gerrit.wikimedia.org/r/300291
Change subject: Bug fix: determine correctly if a revision was made by a bot
......................................................................
Bug fix: determine correctly if a revision was made by a bot
Ic79690da726698ee785e048cbb2959c731bd017d introduces the rev_by_bot flag
for revision_create events. However, it was wrongfully calculated and
always yielded 'false' because $flags is actually a string comprised of
a list of comma-separated values. The correct way to see if an edit was
made by a bot is to load the User object and check its bot status via
isBot().
Change-Id: Ibcda64abeee2038905dac8f0ae999eed05ed3a9d
---
M EventBus.hooks.php
M extension.json
2 files changed, 5 insertions(+), 3 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/EventBus
refs/changes/91/300291/1
diff --git a/EventBus.hooks.php b/EventBus.hooks.php
index 7752729..397dc3d 100644
--- a/EventBus.hooks.php
+++ b/EventBus.hooks.php
@@ -101,6 +101,7 @@
*/
public static function onRevisionInsertComplete( $revision, $data,
$flags ) {
$attrs = [];
+ $user = User::newFromId( $revision->getUser() );
$attrs['page_title'] =
$revision->getTitle()->getPrefixedDBkey();
$attrs['page_id'] = $revision->getPage();
$attrs['page_namespace'] =
$revision->getTitle()->getNamespace();
@@ -109,7 +110,7 @@
$attrs['user_id'] = $revision->getUser();
$attrs['user_text'] = $revision->getUserText();
$attrs['comment'] = $revision->getComment();
- $attrs['rev_by_bot'] = (bool) ( $flags & EDIT_FORCE_BOT );
+ $attrs['rev_by_bot'] = $user->loadFromId() ? $user->isBot() :
false;
// The parent_revision_id attribute is not required, but when
supplied
// must have a minimum value of 1, so omit it entirely when
there is no
diff --git a/extension.json b/extension.json
index 821c0ce..3ba9f47 100644
--- a/extension.json
+++ b/extension.json
@@ -1,9 +1,10 @@
{
"name": "EventBus",
- "version": "0.2.9",
+ "version": "0.2.10",
"author": [
"Eric Evans",
- "Petr Pchelko"
+ "Petr Pchelko",
+ "Marko Obrovac"
],
"url": "https://www.mediawiki.org/wiki/Extension:EventBus",
"descriptionmsg": "eventbus-desc",
--
To view, visit https://gerrit.wikimedia.org/r/300291
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibcda64abeee2038905dac8f0ae999eed05ed3a9d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/EventBus
Gerrit-Branch: master
Gerrit-Owner: Mobrovac <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits