Last modified: 2014-02-12 23:32:46 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T47160, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 45160 - --bot flag for maintenance/createAndPromote.php
--bot flag for maintenance/createAndPromote.php
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
Maintenance scripts (Other open bugs)
1.20.x
All All
: Normal minor (vote)
: 1.22.0 release
Assigned To: Hazard-SJ
: patch
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-02-19 17:20 UTC by Kasper Souren
Modified: 2014-02-12 23:32 UTC (History)
5 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Kasper Souren 2013-02-19 17:20:50 UTC
I want to be able to automatically add bot users with maintenance/createAndPromote.php

There are flags for sysop and bureaucrat but there's no --bot.

Ideally however, it would be possible to add any kind of group to a new user. E.g. --groups=bot,sysop,bureaucrat,editor
Comment 1 Kasper Souren 2013-02-19 17:23:20 UTC
Here's a quick patch for the --bot flag:

--- maintenance/createAndPromote.php
+++ maintenance/createAndPromote.php
@@ -35,6 +35,7 @@ class CreateAndPromote extends Maintenance {
                parent::__construct();
                $this->mDescription = "Create a new user account";
                $this->addOption( "sysop", "Grant the account sysop rights" );
+               $this->addOption( "bot", "Add the bot flag to the account" );
                $this->addOption( "bureaucrat", "Grant the account bureaucrat rights" );
                $this->addArg( "username", "Username of new user" );
                $this->addArg( "password", "Password to set" );
@@ -71,6 +72,9 @@ class CreateAndPromote extends Maintenance {
                if ( $this->hasOption( 'bureaucrat' ) ) {
                        $user->addGroup( 'bureaucrat' );
                }
+               if ( $this->hasOption( 'bot' ) ) {
+                       $user->addGroup( 'bot' );
+               }
 
                # Increment site_stats.ss_users
                $ssu = new SiteStatsUpdate( 0, 0, 0, 0, 1 );
Comment 2 Andre Klapper 2013-02-20 13:10:32 UTC
Hi Kasper! Thanks for your patch!

You are welcome to use Developer access
  https://www.mediawiki.org/wiki/Developer_access
to submit this as a Git branch directly into Gerrit:
  https://www.mediawiki.org/wiki/Git/Tutorial

Putting your branch in Git makes it easier to review it quickly.
Thanks again! We appreciate your contribution.
Comment 3 Gerrit Notification Bot 2013-05-29 04:48:36 UTC
Related URL: https://gerrit.wikimedia.org/r/65872 (Gerrit Change I61348e2d45b90b65a117efcce65d7c581105e612)
Comment 4 Hazard-SJ 2013-05-29 04:52:40 UTC
I've added the bot group using a different patch. I tried to use $permitGroups as array_diff( array_keys( $wgGroupPermissions ), $wgImplicitGroups ), but I got an error (and just to add, my PHP isn't that good ... yet).
Comment 5 Liangent 2013-05-29 05:25:00 UTC
I imagine this script is used for emergency cases eg. the only sysop/bcrat removed their own admin flag accidentally so no one can recover it on web UI. Do we want to add more groups to it?
Comment 6 Hazard-SJ 2013-05-29 05:47:50 UTC
By the looks of the request, people use it for other purposes as well, but I understand what you're saying.
Comment 7 Gerrit Notification Bot 2013-10-12 19:26:48 UTC
Change 65872 merged by jenkins-bot:
Add bot to createAndPromote.php groups

https://gerrit.wikimedia.org/r/65872
Comment 8 Bartosz Dziewoński 2013-10-12 19:33:45 UTC
Merged, I see no reason not to do it.

I updated the docs at [[mw:Manual:createAndPromote.php]].

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links