Page MenuHomePhabricator

Makesysop outputs a completely different log entry than Userrights
Closed, ResolvedPublic

Description

Author: rotemliss

Description:
Userrights output matches to "bureaucratlogentry" (which is 'changed group
membership for $1 from $2 to $3'). It outputs the old permissions (with comma
and space between them) to $2, and the new permissions (the same pattern) to $3
(actually, these are $parameters) – with no further comments (the field
"log_comment" in the table "logging" is unused). It looks like:

21:34, 6 October 2005 Datrio changed group membership for User:Datrio@jawiki
from to checkuser

Makesysop output doesn't match to "bureaucratlogentry". It outputs "+sysop", and
"+bureaucrat" if needed, to the comment ("log_comment"), and outputs no
parameters, and that means with no $2 and $3 parameters. It looks like (copied
from [[m:Special:Log/rights]]):

23:51, 2 October 2005 Daniel Mayer changed group membership for User:Daniel
Mayer from $2 to $3 (+sysop)

Which is not very pretty. It should look like:

23:51, 2 October 2005 Daniel Mayer changed group membership for User:Daniel
Mayer from to sysop

Becuase most of the wikis, excluding Meta, don't use Userrights because they
don't have any Sterwards, most of them has changed "bureaucratlogentry" to
something else – but I strongly prefer an out-of-box fix. I suggest to fix
Makesysop so it will output the standard log entry.

I've created a patch doing that, and tested it. I will upload it in a moment.

I suggest you also run a script for Wikimedia sites for fixing the old entries
(although it is not mandatory), doing that for every row in the table "logging":

  • Checking if "log_type" equals to "rights", "log_action" equals to "rights",

"log_comments" isn't empty and "log_params" is empty in this line - else,
continuing.

  • Setting "log_params" as two parameters:
    • Old parameters – nothing.
    • New parameters – if "log_comments" includes "+sysop" (which is actually

mandatory), write "sysop"; if it also includes "+bureaucrat", write ", buearucrat".

  • Setting "log_comment" to empty.
  • Moving to next row.

Thanks a lot, and even if you don't run the script, please check in the patch.


Version: unspecified
Severity: minor

Details

Reference
bz5585

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 9:11 PM
bzimport set Reference to bz5585.
bzimport added a subscriber: Unknown Object (MLST).

rotemliss wrote:

Patch

The patch fixes the bug. A description of it:

  • It changes "groups" array to "oldGroups", for there will be also "newGroups".
  • It changes the info storing of "oldGroups" from '$oldGroups["sysop"] = true'

to '$oldGroups[] = "sysop"', to match the later use of "newGroups"
(makeGroupNameList), which is copied from "oldGroups".

  • It changes the string "rightsNotation" to the array "addedGroups" includes

all the added groups (mandatory sysop, optionally bureaucrat), for we will be
able to use "array_merge" for "newGroups" with "addedGroups" (we shouldn't read
it again from the database, should we?).

  • It changes the order of the permissions granting, for "sysop" will be before

"bureaucrat", exactly like Userrights.

  • It adds the function "makeGroupNameList", copied from Userrights, for we will

be able to create a proper list of the parameters.

  • It changes, of course, the call to "addEntry", for it will be exactly like in

Userrights.

Please check it in, and thank you very much.

Attached:

rotemliss wrote:

Please note I've checked the patch on my computer, but you may want to review it
by yourselves.

rotemliss wrote:

Could you please check in the patch, or at least say if there's something wrong
with it? Thanks.

rotemliss wrote:

*** Bug 6145 has been marked as a duplicate of this bug. ***