Mainframe98 has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/385805 )

Change subject: Rework and improve HAWelcome
......................................................................

Rework and improve HAWelcome

As noted by Jack Phoenix in ca43438211d194749715fc541334ed9c030f098c,
there are still some outstanding TODO's. This patch attempts to
address those.
* The hardcoded welcomer name has been changed to use a configuration
variable, $wgHAWelcomeUserName, with the previously hardcoded value
as default.
* The global_user_groups table will only be queried if the
GlobalUserrights extension is installed, and the dependency on that
extension has been dropped.
* Expiring user rights are now taken in account for both local and
global user rights, which means only users with a valid group
membership will be used as welcomer.
* Two patches to HAWelcome from the Wikia codebase have been
incorporated:
** If the last active sysop has their groups changed, they will be
removed from cache. This has been adjusted to only remove the user
from cache when the sysop group is removed.
** Instead of checking against a list of hardcoded groups whose
members should never be welcomed, a user right welcomeexempt has
been introduced. Granted to the groups bureaucrat, sysop, staff
and bot, users with this right will not have their user page created
nor will a message be left on their talk page.

Other improvements include the removal of deprecated globals such as
$wgUser, $wgTitle and $wgRequest, i18n of the extension name and
description adding message documentation, adding a LICENSE file and
dedicated selection of staff users when the fallback has been activated.

Bug: T178605
Change-Id: Iea20bad42abf2e1f966b835c6965aa1fd67fa92d
---
M HAWelcome.class.php
A HAWelcome.hooks.php
A LICENSE
A README
M extension.json
M i18n/en.json
A i18n/qqq.json
7 files changed, 712 insertions(+), 272 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/HAWelcome 
refs/changes/05/385805/1

diff --git a/HAWelcome.class.php b/HAWelcome.class.php
index fbf7478..ef3d344 100644
--- a/HAWelcome.class.php
+++ b/HAWelcome.class.php
@@ -21,17 +21,14 @@
                $mAnon,
                $mSysop;
 
-       const WELCOMEUSER = 'ShoutWiki';
-
        /**
         * Construct a job
         *
         * @param Title $title The title linked to
         * @param array $params Job parameters (table, start and end page_ids)
-        * @param int $id job_id, 0 by default
         */
-       public function __construct( $title, $params, $id = 0 ) {
-               parent::__construct( 'HAWelcome', $title, $params, $id );
+       public function __construct( $title, $params ) {
+               parent::__construct( 'HAWelcome', $title, $params );
 
                $this->mUserId   = $params['user_id'];
                $this->mUserIP   = $params['user_ip'];
@@ -45,9 +42,7 @@
                        $this->mUser = User::newFromId( $this->mUserId );
                }
 
-               /**
-                * fallback
-                */
+               // Fallback
                if ( !$this->mUser ) {
                        $this->mUser = User::newFromName( $this->mUserName );
                }
@@ -57,91 +52,88 @@
         * Main entry point
         */
        public function run() {
-               global $wgUser, $wgTitle, $wgLanguageCode;
+               global $wgLanguageCode, $wgHAWelcomeWelcomeUsername;
 
-               /**
-                * overwrite $wgUser for ~~~~ expanding
-                */
                $sysop = trim( wfMessage( 'welcome-user' )->plain() );
-               if ( !in_array( $sysop, [ '@disabled', '-' ] ) ) {
-                       $tmpUser = $wgUser;
-                       $wgUser = User::newFromName( self::WELCOMEUSER );
-                       $flags = 0;
-                       if ( $wgUser && $wgUser->isBot() ) {
-                               $flags = EDIT_FORCE_BOT;
-                       }
+               if ( in_array( $sysop, [ '@disabled', '-' ] ) ) {
+                       return true;
+               }
 
-                       if ( $this->mUser && $this->mUser->getName() !== 
self::WELCOMEUSER && !$wgUser->isBlocked() ) {
-                               /**
-                                * check again if talk page exists
-                                */
-                               $talkPage = 
$this->mUser->getUserPage()->getTalkPage();
+               $welcomeUser = User::newFromName( $wgHAWelcomeWelcomeUsername );
+               $flags = 0;
+               if ( $welcomeUser && $welcomeUser->isBot() ) {
+                       $flags = EDIT_FORCE_BOT;
+               }
 
-                               if ( $talkPage ) {
-                                       $this->mSysop = $this->getLastSysop();
-                                       $tmpTitle     = $wgTitle;
-                                       $sysopPage    = 
$this->mSysop->getUserPage()->getTalkPage();
-                                       $signature    = $this->expandSig();
+               if ( $this->mUser && $this->mUser->getName() !== 
$wgHAWelcomeWelcomeUsername && !$welcomeUser->isBlocked() ) {
+                       // Check again if talk page exists
+                       $talkPage = $this->mUser->getUserPage()->getTalkPage();
 
-                                       $wgTitle     = $talkPage;
-                                       $welcomeMsg  = false;
-                                       $talkArticle = new Article( $talkPage, 
0 );
+                       if ( $talkPage ) {
+                               $this->mSysop = $this->getLastSysop();
+                               $sysopTalkPage = 
$this->mSysop->getUserPage()->getTalkPage();
+                               $signature = $this->expandSig();
 
-                                       if ( !$talkArticle->exists() ) {
-                                               if ( $this->mAnon ) {
-                                                       if ( $this->isEnabled( 
'message-anon' ) ) {
-                                                               $welcomeMsg = 
wfMessage(
-                                                                       
'welcome-message-anon'
-                                                               )->inLanguage( 
$wgLanguageCode )->params(
-                                                                       
$this->getPrefixedText(),
-                                                                       
$sysopPage->getPrefixedText(),
-                                                                       
$signature,
-                                                                       
wfEscapeWikiText( $this->mUser->getName() )
-                                                               )->text();
-                                                       }
-                                               } else {
-                                                       /**
-                                                        * now create user page 
(if it doesn't exist already, of course)
-                                                        */
-                                                       if ( $this->isEnabled( 
'page-user' ) ) {
-                                                               $userPage = 
$this->getUserPage();
-                                                               if ( $userPage 
) {
-                                                                       
$wgTitle = $userPage;
-                                                                       
$userArticle = new Article( $userPage, 0 );
-                                                                       if ( 
!$userArticle->exists() ) {
-                                                                               
$pageMsg = wfMessage( 'welcome-user-page' )->inContentLanguage()->text();
-                                                                               
$content = ContentHandler::makeContent( $pageMsg, $userPage );
-                                                                               
$userArticle->doEditContent( $content, '', $flags );
-                                                                       }
+                               $welcomeMsg = false;
+                               $talkWikiPage = WikiPage::factory( $talkPage );
+
+                               if ( !$talkWikiPage->exists() ) {
+                                       if ( $this->mAnon ) {
+                                               if ( $this->isEnabled( 
'message-anon' ) ) {
+                                                       $welcomeMsg = wfMessage(
+                                                               
'welcome-message-anon'
+                                                       )->inLanguage( 
$wgLanguageCode )->params(
+                                                               
$this->getPrefixedText(),
+                                                               
$sysopTalkPage->getPrefixedText(),
+                                                               $signature,
+                                                               
wfEscapeWikiText( $this->mUser->getName() )
+                                                       )->text();
+                                               }
+                                       } else {
+                                               // Now create user page (if it 
doesn't exist already, of course)
+                                               if ( $this->isEnabled( 
'page-user' ) ) {
+                                                       $userPage = 
$this->getUserPage();
+                                                       if ( $userPage ) {
+                                                               $userWikiPage = 
WikiPage::factory( $userPage );
+
+                                                               if ( 
!$userWikiPage->exists() ) {
+                                                                       
$pageMsg = wfMessage( 'welcome-user-page' )->inContentLanguage()->text();
+                                                                       
$content = ContentHandler::makeContent( $pageMsg, $userPage );
+                                                                       
$userWikiPage->doEditContent(
+                                                                               
$content,
+                                                                               
'',
+                                                                               
$flags,
+                                                                               
0,
+                                                                               
$welcomeUser
+                                                                       );
                                                                }
                                                        }
-
-                                                       if ( $this->isEnabled( 
'message-user' ) ) {
-                                                               $welcomeMsg = 
wfMessage(
-                                                                       
'welcome-message-user'
-                                                               )->inLanguage( 
$wgLanguageCode )->params(
-                                                                       
$this->getPrefixedText(),
-                                                                       
$sysopPage->getPrefixedText(),
-                                                                       
$signature,
-                                                                       
wfEscapeWikiText( $this->mUser->getName() )
-                                                               )->text();
-                                                       }
                                                }
-                                               if ( $welcomeMsg ) {
-                                                       $wgTitle = $talkPage; 
/* is it necessary there? */
-                                                       $content = 
ContentHandler::makeContent( $welcomeMsg, $talkPage );
-                                                       
$talkArticle->doEditContent(
-                                                               $content,
-                                                               wfMessage( 
'welcome-message-log' )->inContentLanguage()->escaped(),
-                                                               $flags
-                                                       );
+
+                                               if ( $this->isEnabled( 
'message-user' ) ) {
+                                                       $welcomeMsg = wfMessage(
+                                                               
'welcome-message-user'
+                                                       )->inLanguage( 
$wgLanguageCode )->params(
+                                                               
$this->getPrefixedText(),
+                                                               
$sysopTalkPage->getPrefixedText(),
+                                                               $signature,
+                                                               
wfEscapeWikiText( $this->mUser->getName() )
+                                                       )->text();
                                                }
                                        }
-                                       $wgTitle = $tmpTitle;
+
+                                       if ( $welcomeMsg ) {
+                                               $content = 
ContentHandler::makeContent( $welcomeMsg, $talkPage );
+                                               $talkWikiPage->doEditContent(
+                                                       $content,
+                                                       wfMessage( 
'welcome-message-log' )->inContentLanguage()->escaped(),
+                                                       $flags,
+                                                       0,
+                                                       $welcomeUser
+                                               );
+                                       }
                                }
                        }
-
-                       $wgUser = $tmpUser;
                }
 
                return true;
@@ -153,92 +145,115 @@
         * @return User class instance
         */
        public function getLastSysop() {
-               global $wgMemc;
+               global $wgMemc, $wgHAWelcomeWelcomeUsername, 
$wgHAWelcomeStaffGroupName;
 
-               /**
-                * maybe already loaded?
-                */
+               // Maybe already loaded?
                if ( !$this->mSysop ) {
                        $sysop = trim( wfMessage( 'welcome-user' )->plain() );
                        if ( !in_array( $sysop, [ '@disabled', '-' ] ) ) {
                                if ( in_array( $sysop, [ '@latest', '@sysop' ] 
) ) {
-                                       /**
-                                        * first: check memcached, maybe we 
have already stored id of sysop
-                                        */
-                                       $sysopId = $wgMemc->get( wfMemcKey( 
'last-sysop-id' ) );
+                                       // First: check memcached, maybe we 
have already stored id of sysop
+                                       $sysopId = $wgMemc->get( 
$wgMemc->makeKey( 'last-sysop-id' ) );
                                        if ( $sysopId ) {
                                                $this->mSysop = 
User::newFromId( $sysopId );
                                        } else {
-                                               /**
-                                                * second: check database, 
could be expensive for database
-                                                */
+                                               // Second: check database, 
could be expensive for database
                                                $dbr = wfGetDB( DB_REPLICA );
 
                                                /**
-                                                * get all users which are 
sysops/sysops or staff
-                                                * but not bots
+                                                * Get all users which are 
sysops/sysops or staff but not bots
                                                 *
                                                 * @todo check $db->makeList( 
$array )
                                                 */
+
+                                               $groups = [ 'ug_group' => [ 
'sysop', 'bot' ] ];
+
+                                               $bots = [];
+                                               $admins = [];
+                                               $res = $dbr->select(
+                                                               'user_groups',
+                                                               
UserGroupMembership::selectFields(),
+                                                               $dbr->makeList( 
$groups, LIST_OR ),
+                                                               __METHOD__
+                                                       );
+
+                                               foreach ( $res as $row ) {
+                                                       $ugm = 
UserGroupMembership::newFromRow( $row );
+                                                       if ( !$ugm->isExpired() 
) {
+                                                               if ( 
$ugm->getGroup() === 'bot' ) {
+                                                                       $bots[] 
= $ugm->getUserId();
+                                                               } else {
+                                                                       
$admins[] = $ugm->getUserId();
+                                                               }
+                                                       }
+                                               }
+
                                                // ShoutWiki patch begin
                                                // Tweaked code for SW 
compatibility
                                                // If we should fetch staff 
member names, then they'll
                                                // be fetched from 
global_user_groups table
+                                               // However, we should only do 
so when the GlobalUserrights extension is
+                                               // installed.
                                                // @author Jack Phoenix 
<j...@shoutwiki.com>
                                                // @date October 13, 2009
-                                               $groups = [ 'ug_group' => [ 
'sysop', 'bot' ] ];
-                                               $wantStaff = false;
-                                               if ( $sysop !== '@sysop' ) {
-                                                       $wantStaff = true;
-                                               }
+                                               $wantStaff = $sysop !== 
'@sysop' && ExtensionRegistry::getInstance()->isLoaded( 'GlobalUserrights' );
+                                               $staff = [];
 
-                                               $bots   = [];
-                                               $admins = [];
-                                               $res = $dbr->select(
-                                                       [ 'user_groups' ],
-                                                       [ 'ug_user', 'ug_group' 
],
-                                                       $dbr->makeList( 
$groups, LIST_OR ),
-                                                       __METHOD__
-                                               );
                                                if ( $wantStaff ) {
-                                                       // If we should fetch 
staffers, fetch 'em from the
-                                                       // correct table
+                                                       // If we should fetch 
staffers, fetch 'em from the correct table
                                                        $res2 = $dbr->select(
-                                                               [ 
'global_user_groups' ],
-                                                               [ 'gug_user', 
'gug_group' ],
-                                                               [ 'gug_group' 
=> 'staff' ],
+                                                               
'global_user_groups',
+                                                               
GlobalUserGroupMembership::selectFields(),
+                                                               [ 'gug_group' 
=> $wgHAWelcomeStaffGroupName ],
                                                                __METHOD__
                                                        );
+
+                                                       $lookup = 
CentralIdLookup::factory();
+
                                                        foreach ( $res2 as 
$row2 ) {
-                                                               $admins[] = 
$row2->gug_user;
-                                                       }
-                                               }
-                                               // End ShoutWiki patch
-                                               foreach ( $res as $row ) {
-                                                       if ( $row->ug_group == 
'bot' ) {
-                                                               $bots[] = 
$row->ug_user;
-                                                       } else {
-                                                               $admins[] = 
$row->ug_user;
+                                                               $gugm = 
GlobalUserGroupMembership::newFromRow( $row2 );
+                                                               if ( 
!$gugm->isExpired() ) {
+                                                                       // Get 
the local user id, since GlobalUserrights stores
+                                                                       // 
central ID's. This is a two step process, because you can't
+                                                                       // get 
a local ID directly from a central Id.
+                                                                       
$staffMember = $lookup->localUserFromCentralId( $gugm->getUserId() );
+                                                                       
$staff[] = $staffMember->getId();
+                                                               }
                                                        }
                                                }
 
-                                               /**
-                                                * remove bots from admins
-                                                */
+                                               // Merge arrays - Add the staff 
members to the list of potential welcomers
+                                               $admins += $staff;
+
+                                               // End ShoutWiki patch
+
+                                               // Remove bots from admins.
+                                               // Some bots also have 
administrator privileges, but since they are not
+                                               // real users, they shouldn't 
be welcoming new users.
                                                $admins = [ 'rev_user' => 
array_unique( array_diff( $admins, $bots ) ) ];
+
+                                               // Get the sysop who was active 
last
                                                $row = $dbr->selectRow(
                                                        'revision',
                                                        [ 'rev_user', 
'rev_user_text' ],
                                                        [
                                                                $dbr->makeList( 
$admins, LIST_OR ),
-                                                               'rev_timestamp 
> ' . $dbr->addQuotes( $dbr->timestamp( time() - 5184000 ) ) // 60 days ago 
(24*60*60*60)
+                                                               'rev_timestamp 
> ' .
+                                                               
$dbr->addQuotes( $dbr->timestamp( time() - 5184000 ) ) // 60 days ago 
(24*60*60*60)
                                                        ],
                                                        __METHOD__,
                                                        [ 'ORDER BY' => 
'rev_timestamp DESC' ]
                                                );
+
                                                if ( $row && $row->rev_user ) {
                                                        $this->mSysop = 
User::newFromId( $row->rev_user );
-                                                       $wgMemc->set( 
wfMemcKey( 'last-sysop-id' ), $row->rev_user, 86400 );
+                                                       $wgMemc->set( 
$wgMemc->makeKey( 'last-sysop-id' ), $row->rev_user, 86400 );
+                                               } elseif ( $wantStaff ) {
+                                                       $staffCount = count( 
$staff );
+                                                       // Pick a random staff 
member so no-one gets left out
+                                                       $index = mt_rand( 0, 
$staffCount - 1 );
+                                                       $this->mSysop = 
User::newFromId( $staffCount[$index] );
+                                                       $wgMemc->set( 
$wgMemc->makeKey( 'last-sysop-id' ), $staffCount[$index], 86400 );
                                                }
                                        }
                                } else {
@@ -246,13 +261,11 @@
                                }
                        }
 
-                       /**
-                        * fallback, if still user is unknown we use welcome 
user
-                        */
+                       // Fallback, if the user is still unknown we use 
welcome user
                        if ( $this->mSysop instanceof User && 
$this->mSysop->getId() ) {
                                wfDebugLog( 'HAWelcome', 'Found sysop: ' . 
$this->mSysop->getName() );
                        } else {
-                               $this->mSysop = User::newFromName( 
self::WELCOMEUSER );
+                               $this->mSysop = User::newFromName( 
$wgHAWelcomeWelcomeUsername );
                        }
                }
 
@@ -260,124 +273,32 @@
        }
 
        /**
-        * Static method called as hook
-        *
-        * @param Revision $revision Revision object
-        * @param string $url URL to external object
-        * @param string $flags Flags for this revision
-        * @return bool True means process other hooks
-        */
-       public static function revisionInsertComplete( &$revision, $url, $flags 
) {
-               global $wgRequest, $wgUser, $wgCommandLineMode, $wgMemc;
-
-               /**
-                * Do not create job when DB is locked (rt#12229)
-                */
-               if ( wfReadOnly() ) {
-                       return true;
-               }
-
-               /**
-                * Revision has valid Title field but sometimes not filled
-                */
-               $title = $revision->getTitle();
-               if ( !$title ) {
-                       $title = Title::newFromId( $revision->getPage(), 
Title::GAID_FOR_UPDATE );
-                       $revision->setTitle( $title );
-               }
-
-               /**
-                * get groups for user rt#12215
-                */
-               $groups = $wgUser->getEffectiveGroups();
-               $invalid = [
-                       'bot' => true,
-                       'staff' => true,
-                       'sysop' => true,
-                       'bureaucrat' => true
-               ];
-               $canWelcome = true;
-               foreach ( $groups as $group ) {
-                       if ( isset( $invalid[$group] ) && $invalid[$group] ) {
-                               $canWelcome = false;
-                               wfDebugLog( 'HAWelcome', "Skipping welcome 
since user is in $group group" );
-                               break;
-                       }
-               }
-
-               /**
-                * put possible welcomer into memcached, RT#14067
-                */
-               if ( $wgUser->getId() && self::isWelcomer( $wgUser ) ) {
-                       $wgMemc->set( wfMemcKey( 'last-sysop-id' ), 
$wgUser->getId(), 86400 );
-                       wfDebugLog( 'HAWelcome', 'Storing possible welcomer in 
memcached' );
-               }
-
-               if ( $title && !$wgCommandLineMode && $canWelcome ) {
-                       $welcomer = trim( wfMessage( 'welcome-user' 
)->inContentLanguage()->plain() );
-
-                       if ( $welcomer !== '@disabled' && $welcomer !== '-' ) {
-                               /**
-                                * check if talk page for wgUser exists
-                                *
-                                * @todo check editcount for user
-                                */
-                               $talkPage = 
$wgUser->getUserPage()->getTalkPage();
-                               if ( $talkPage ) {
-                                       $talkArticle = new Article( $talkPage, 
0 );
-                                       if ( !$talkArticle->exists() ) {
-                                               $welcomeJob = new HAWelcomeJob(
-                                                       $title,
-                                                       [
-                                                               'is_anon'   => 
$wgUser->isAnon(),
-                                                               'user_id'   => 
$wgUser->getId(),
-                                                               'user_ip'   => 
$wgRequest->getIP(),
-                                                               'user_name' => 
$wgUser->getName(),
-                                                       ]
-                                               );
-                                               $welcomeJob->insert();
-                                       }
-                               }
-                       }
-               }
-
-               return true;
-       }
-
-       /**
-        * HACK, expand signature from message for sysop
+        * Expand signature from a message or preference for sysop
+        * @return string
         */
        private function expandSig() {
-               global $wgContLang, $wgUser;
+               global $wgContLang, $wgHAWelcomeSignatureFromPreferences;
 
                $this->mSysop = $this->getLastSysop();
-               $tmpUser = $wgUser;
-               $wgUser = $this->mSysop;
+
                $sysopName = wfEscapeWikiText( $this->mSysop->getName() );
-               $signature = sprintf(
-                       '-- [[%s:%s|%s]] ([[%s:%s|%s]]) %s',
-                       $wgContLang->getNsText( NS_USER ),
-                       $sysopName,
-                       $sysopName,
-                       $wgContLang->getNsText( NS_USER_TALK ),
-                       $sysopName,
-                       wfMessage( 'talkpagelinktext' 
)->inContentLanguage()->text(),
-                       $wgContLang->timeanddate( wfTimestampNow( TS_MW ) )
-               );
-               $wgUser = $tmpUser;
+               $signature = wfMessage( 'signature' )->params( $sysopName, 
$sysopName )->plain();
+
+               $signature = "-- $signature";
+
+               if ( $wgHAWelcomeSignatureFromPreferences ) {
+                       // Nickname references to the preference that stores 
the custom signature
+                       $signature = $this->mSysop->getOption( 'nickname', 
$signature );
+               }
+
+               // Append timestamp
+               $signature .= ' ' . $wgContLang->timeanddate( wfTimestampNow() 
);
 
                return $signature;
        }
 
        /**
-        * @return Title instance of Title object
-        */
-       public function getTitle() {
-               return $this->title;
-       }
-
-       /**
-        * @return Title instance of Title object
+        * @return string the prefixed title with spaces
         */
        public function getPrefixedText() {
                return $this->title->getPrefixedText();
@@ -392,6 +313,7 @@
        public function isEnabled( $what ) {
                $return = false;
                $message = wfMessage( 'welcome-enabled' 
)->inContentLanguage()->plain();
+
                if (
                        in_array( $what, [ 'page-user', 'message-anon', 
'message-user' ] ) &&
                        strpos( $message, $what ) !== false
@@ -401,31 +323,6 @@
                }
 
                return $return;
-       }
-
-       /**
-        * Check if user can welcome other users
-        *
-        * @param User $user Instance of User class
-        * @return bool Status of the operation
-        */
-       public static function isWelcomer( &$user ) {
-               $sysop  = trim( wfMessage( 'welcome-user' )->plain() );
-               $groups = $user->getEffectiveGroups();
-               $result = false;
-
-               /**
-                * bots can't welcome
-                */
-               if ( !in_array( 'bot', $groups ) ) {
-                       if ( $sysop === '@sysop' ) {
-                               $result = in_array( 'sysop', $groups ) ? true : 
false;
-                       } else {
-                               $result = in_array( 'sysop', $groups ) || 
in_array( 'staff', $groups ) ? true : false;
-                       }
-               }
-
-               return $result;
        }
 
        /**
@@ -440,6 +337,7 @@
         */
        private function getUserPage() {
                $userPage = $this->mUser->getUserPage();
+
                if ( class_exists( 'UserProfile' ) ) {
                        // SocialProfile is installed -> the user
                        // might've opted in for the social profile
@@ -449,9 +347,11 @@
                        // This is somewhat c+p from UserProfile's
                        // UserProfile.php, the ArticleFromTitle hook callback
                        global $wgUserPageChoice;
+
                        if ( $wgUserPageChoice ) {
                                $profile = new UserProfile( 
$this->mUser->getName() );
                                $profileData = $profile->getProfile();
+
                                if (
                                        isset( $profileData['user_id'] ) &&
                                        $profileData['user_id'] &&
@@ -464,6 +364,7 @@
                                }
                        }
                }
+
                return $userPage;
        }
 }
diff --git a/HAWelcome.hooks.php b/HAWelcome.hooks.php
new file mode 100644
index 0000000..4f76c3d
--- /dev/null
+++ b/HAWelcome.hooks.php
@@ -0,0 +1,125 @@
+<?php
+
+class HAWelcomeHooks {
+       /**
+        * Static method called as hook for RevisionInsertComplete
+        *
+        * @param Revision $revision Revision object
+        * @param string $url URL to external object
+        * @param string $flags Flags for this revision
+        * @return bool True means process other hooks
+        */
+       public static function revisionInsertComplete( Revision &$revision, 
$url, $flags ) {
+               global $wgCommandLineMode, $wgMemc;
+
+               $request = RequestContext::getMain();
+               $user = $request->getUser();
+
+               // Do not create job when DB is locked (rt#12229)
+               if ( wfReadOnly() ) {
+                       return true;
+               }
+
+               // Revision has valid Title field but sometimes not filled
+               $title = $revision->getTitle();
+               if ( !$title ) {
+                       $title = Title::newFromID( $revision->getPage(), 
Title::GAID_FOR_UPDATE );
+                       $revision->setTitle( $title );
+               }
+
+               // Get groups for user rt#12215
+               $canWelcome = !$user->isAllowed( 'welcomeexempt' );
+               if ( !$canWelcome ) {
+                       wfDebugLog( 'HAWelcome', 'Skipping welcome since user 
has welcomeexempt right' );
+               }
+
+               // Put possible welcomer into memcached, RT#14067
+               if ( $user->getId() && self::isWelcomer( $user ) ) {
+                       $wgMemc->set( $wgMemc->makeKey( 'last-sysop-id' ), 
$user->getId(), 86400 );
+                       wfDebugLog( 'HAWelcome', 'Storing possible welcomer in 
memcached' );
+               }
+
+               if ( $title && !$wgCommandLineMode && $canWelcome ) {
+                       $welcomer = trim( wfMessage( 'welcome-user' 
)->inContentLanguage()->plain() );
+
+                       if ( in_array( $welcomer, [ '@disabled', '-' ] ) ) {
+                               // Check if talk page for current user exists, 
if they have made any edits, and
+                               // if the content model is wikitext. Only 
wikitext talk pages are supported.
+                               $talkPage = $user->getUserPage()->getTalkPage();
+                               if (
+                                       $talkPage &&
+                                       $talkPage->getContentModel() === 
CONTENT_MODEL_WIKITEXT &&
+                                       $user->getEditCount() === 0
+                               ) {
+                                       $talkWikiPage = WikiPage::factory( 
$talkPage );
+                                       if ( !$talkWikiPage->exists() ) {
+                                               $welcomeJob = new HAWelcomeJob(
+                                                       $title,
+                                                       [
+                                                               'is_anon'   => 
$user->isAnon(),
+                                                               'user_id'   => 
$user->getId(),
+                                                               'user_ip'   => 
$request->getRequest()->getIP(),
+                                                               'user_name' => 
$user->getName(),
+                                                       ]
+                                               );
+                                               
JobQueueGroup::singleton()->push( $welcomeJob );
+                                       }
+                               }
+                       }
+               }
+
+               return true;
+       }
+
+       /**
+        * Check if a user can welcome other users
+        *
+        * @param User $user Instance of User class
+        * @return bool Status of the operation
+        */
+       public static function isWelcomer( User &$user ) {
+               global $wgHAWelcomeStaffGroupName;
+
+               $sysop  = trim( wfMessage( 'welcome-user' )->plain() );
+               $groups = $user->getEffectiveGroups();
+               $result = false;
+
+               // Bots can't welcome
+               if ( !in_array( 'bot', $groups ) ) {
+                       if ( $sysop === '@sysop' ) {
+                               $result = in_array( 'sysop', $groups );
+                       } else {
+                               $result = in_array( 'sysop', $groups ) || 
in_array( $wgHAWelcomeStaffGroupName, $groups );
+                       }
+               }
+
+               return $result;
+       }
+
+       /**
+        * Wikia backport:
+        * Invalidates cached welcomer user ID if equal to changed user ID
+        * @author Kamil Koterba ka...@wikia-inc.com
+        *
+        * Adjusted to use the UserGroupsChanged hook rather than the 
UserRights hook, which was
+        * removed in 1.26, and to check if the removed group is sysop
+        *
+        * @param User $user
+        * @param array $added
+        * @param array $removed
+        * @param bool|User $performer
+        * @param string $reason
+        * @return bool
+        */
+       public static function onUserGroupsChanged( User $user, array $added, 
array $removed, $performer, $reason ) {
+               global $wgMemc;
+
+               // Only remove the cache key if the user has the sysop group 
removed since other group
+               // changes are not relevant
+               if ( $user->getId() === $wgMemc->get( $wgMemc->makeKey( 
'last-sysop-id' ) ) && in_array( 'sysop', $removed ) ) {
+                       $wgMemc->delete( $wgMemc->makeKey( 'last-sysop-id' ) );
+               }
+
+               return true;
+       }
+}
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..d159169
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,339 @@
+                    GNU GENERAL PUBLIC LICENSE
+                       Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+                            Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users.  This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it.  (Some other Free Software Foundation software is covered by
+the GNU Lesser General Public License instead.)  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+  To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have.  You must make sure that they, too, receive or can get the
+source code.  And you must show them these terms so they know their
+rights.
+
+  We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+  Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software.  If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+  Finally, any free program is threatened constantly by software
+patents.  We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary.  To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+                    GNU GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License.  The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language.  (Hereinafter, translation is included without limitation in
+the term "modification".)  Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+  1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+  2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) You must cause the modified files to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    b) You must cause any work that you distribute or publish, that in
+    whole or in part contains or is derived from the Program or any
+    part thereof, to be licensed as a whole at no charge to all third
+    parties under the terms of this License.
+
+    c) If the modified program normally reads commands interactively
+    when run, you must cause it, when started running for such
+    interactive use in the most ordinary way, to print or display an
+    announcement including an appropriate copyright notice and a
+    notice that there is no warranty (or else, saying that you provide
+    a warranty) and that users may redistribute the program under
+    these conditions, and telling the user how to view a copy of this
+    License.  (Exception: if the Program itself is interactive but
+    does not normally print such an announcement, your work based on
+    the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+    a) Accompany it with the complete corresponding machine-readable
+    source code, which must be distributed under the terms of Sections
+    1 and 2 above on a medium customarily used for software interchange; or,
+
+    b) Accompany it with a written offer, valid for at least three
+    years, to give any third party, for a charge no more than your
+    cost of physically performing source distribution, a complete
+    machine-readable copy of the corresponding source code, to be
+    distributed under the terms of Sections 1 and 2 above on a medium
+    customarily used for software interchange; or,
+
+    c) Accompany it with the information you received as to the offer
+    to distribute corresponding source code.  (This alternative is
+    allowed only for noncommercial distribution and only if you
+    received the program in object code or executable form with such
+    an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it.  For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable.  However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License.  Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+  5. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Program or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+  6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+  7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+  8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded.  In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+  9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation.  If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+  10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission.  For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this.  Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+                            NO WARRANTY
+
+  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+                     END OF TERMS AND CONDITIONS
+
+            How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License along
+    with this program; if not, write to the Free Software Foundation, Inc.,
+    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+    Gnomovision version 69, Copyright (C) year name of author
+    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+  `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+  <signature of Ty Coon>, 1 April 1989
+  Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs.  If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library.  If this is what you want to do, use the GNU Lesser General
+Public License instead of this License.
diff --git a/README b/README
new file mode 100644
index 0000000..d3aca58
--- /dev/null
+++ b/README
@@ -0,0 +1,34 @@
+Highly Automated Welcome Tool
+
+The Highly Automated Welcome Tool or HAWelcome for short, helps sysops welcome 
new editors. By default it creates their user page and leaves a welcome message 
on their talk page, but this is configurable on-wiki.
+
+== Configuration options ==
+=== In LocalSettings.php ===
+HAWelcome adds two new configuration variables:
+* $wgHAWelcomeWelcomeUsername - This configuration variable contains the name 
of the user that should leave the welcome message. If this user is flagged as a 
bot, the edits will be marked as a bot edit. For compatibility with ShoutWiki's 
setup, the default value is ShoutWiki.
+* $wgHAWelcomeStaffGroupName - Name of the group that can serve as a fallback 
when no sysops have been active in the last 60 days. This is the staff group by 
default.
+* $wgHAWelcomeSignatureFromPreferences - This configuration variable toggles 
if the signature of the welcomer should be the one they have set in their 
preferences. This is false by default, and messages will use the default 
signature.
+=== On-wiki ===
+HAWelcome adds three new configuration messages:
+* welcome-user - Determines of which user the signature should be placed under 
the welcome message. This can be a username, or any of the special values:
+** @sysop - The most recently active sysop, with no fallback on staff
+** @latest - The most recently active sysop or staff when no sysops have been 
active in 60 days
+** @disabled - Don't leave welcome messages. In addition to @disabled, the 
message content may also be set to a single dash (-)
+* welcome-enabled - Determines which action to preform. It can be any 
combination of the following:
+** page-user - Create a user page for a registered user. The content of the 
user page is controlled by the message welcome-user-page
+** message-anon - Leave welcome messages for anonymous users. The content of 
the message is controlled by the message welcome-message-anon
+** message-user - Leave welcome messages for registered users. The content of 
the message is controlled by the message welcome-message-user
+
+== User rights ==
+There is one user right, assigned to the groups bot, staff, sysop and 
bureaucrat by default: welcomeexempt. Users with this right will not receive a 
message or have their user page created when they make their first edit. This 
feature was backported from Wikia.
+
+== Features ==
+* When the user rights are changed, and the user is the last active sysop, the 
cached value will be removed from cache. Tweaked to only remove the cache entry 
when the group sysop is removed. This feature was backported from Wikia.
+* When GlobalUserrights is installed, the global user groups table will too be 
checked for staff users.
+* When SocialProfile is installed, and the user has opted to use the social 
profile, the user page will be created in the UserWiki: namespace rather than 
the User: namespace.
+
+== Known limitations ==
+* Structured Discussions are not supported. No welcome message will be left on 
the talk page of users with a Structured Discussions talk page.
+
+== License ==
+HAWelcome is licensed under GPL-2.0+. See LICENSE.
diff --git a/extension.json b/extension.json
index ba08800..2056594 100644
--- a/extension.json
+++ b/extension.json
@@ -1,14 +1,16 @@
 {
        "name": "Highly Automated Welcome Tool",
-       "version": "0.6.9",
+       "namemsg": "welcome-user-name",
+       "version": "0.7.0",
        "author": [
                "Krzysztof Krzyżaniak",
                "Maciej Błaszkowski",
-               "Jack Phoenix"
+               "Jack Phoenix",
+               "Mainframe98"
        ],
        "license-name": "GPL-2.0+",
        "url": "https://www.mediawiki.org/wiki/Extension:HAWelcome";,
-       "description": "Welcomes new users after their first edit",
+       "descriptionmsg": "welcome-user-desc",
        "type": "other",
        "MessagesDirs": {
                "HAWelcome": [
@@ -16,18 +18,37 @@
                ]
        },
        "AutoloadClasses": {
-               "HAWelcomeJob": "HAWelcome.class.php"
+               "HAWelcomeJob": "HAWelcome.class.php",
+               "HAWelcomeHooks": "HAWelcome.hooks.php"
        },
        "JobClasses": {
                "HAWelcome": "HAWelcomeJob"
        },
        "Hooks": {
-               "RevisionInsertComplete": "HAWelcomeJob::revisionInsertComplete"
+               "RevisionInsertComplete": 
"HAWelcomeHooks::revisionInsertComplete",
+               "UserGroupsChanged": "HAWelcomeHooks::onUserGroupsChanged"
+       },
+       "GroupPermissions": {
+               "bot": {
+                       "welcomeexempt": true
+               },
+               "staff": {
+                       "welcomeexempt": true
+               },
+               "sysop": {
+                       "welcomeexempt": true
+               },
+               "bureaucrat": {
+                       "welcomeexempt": true
+               }
+       },
+       "config": {
+               "HAWelcomeWelcomeUsername": "ShoutWiki",
+               "HAWelcomeStaffGroupName": "staff",
+               "HAWelcomeSignatureFromPreferences": false
        },
        "requires": {
-               "extensions": {
-                       "GlobalUserrights": ">=1.3.1"
-               }
+               "MediaWiki": ">= 1.29.0"
        },
        "manifest_version": 1
 }
diff --git a/i18n/en.json b/i18n/en.json
index bebf914..18484cd 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -1,7 +1,8 @@
 {
        "@metadata": {
                "authors": [
-                       "Krzysztof Krzyżaniak <e...@wikia-inc.com>"
+                       "Krzysztof Krzyżaniak <e...@wikia-inc.com>",
+                       "Mainframe98"
                ]
        },
        "welcome-user": "@latest",
@@ -9,5 +10,8 @@
        "welcome-user-page": "==About me==\n''This is your user page. Please 
edit this page to tell the community about yourself!''\n\n==My 
contributions==\n*[[Special:Contributions/{{PAGENAME}}|User 
contributions]]\n\n==My favorite pages==\n*Add links to your favorite pages on 
the wiki here!\n*Favorite page #2\n*Favorite page #3",
        "welcome-message-user": "Hi, welcome to {{SITENAME}}! Thanks for your 
edit to the [[:$1]] page.\n\nPlease leave a message on [[$2|my talk page]] if I 
can help with anything! $3",
        "welcome-message-anon": "Hi, welcome to {{SITENAME}}! Thanks for your 
edit to the [[:$1]] page.\n\n'''[[Special:UserLogin|Please sign in and create a 
user name]]'''. It's an easy way to keep track of your contributions and helps 
you communicate with the rest of the community.\n\nPlease leave a message on 
[[$2|my talk page]] if I can help with anything! $3",
-       "welcome-message-log": "welcoming new contributor"
+       "welcome-message-log": "welcoming new contributor",
+       "welcome-user-name": "Highly Automated Welcome Tool",
+       "welcome-user-desc": "Welcomes new users after their first edit",
+       "right-welcomeexempt": "Flags user as exempt from welcome tool messages"
 }
diff --git a/i18n/qqq.json b/i18n/qqq.json
new file mode 100644
index 0000000..0be2203
--- /dev/null
+++ b/i18n/qqq.json
@@ -0,0 +1,16 @@
+{
+       "@metadata": {
+               "authors": [
+                       "Mainframe98"
+               ]
+       },
+       "welcome-user": "{{notranslate}}",
+       "welcome-enabled": "{{notranslate}}",
+       "welcome-user-page": "Default text that will used to create the user 
page when a user makes their first edit.",
+       "welcome-message-user": "Welcome message sent to new registered 
users.\n\nParameters:\n* $1 - Name of the page the user edited\n* $2 - Talk 
page of the welcoming user\n* $3 - Signature of the welcoming user",
+       "welcome-message-anon": "Welcome message sent to anonymous 
users.\n\nParameters:\n* $1 - Name of the page the user edited\n* $2 - Talk 
page of the welcoming user\n* $3 - Signature of the welcoming user",
+       "welcome-message-log": "Edit summary used when leaving a message on the 
talk page",
+       "welcome-user-name": "{{name}}",
+       "welcome-user-desc": 
"{{desc|name=HAWelcome|url=https://www.mediawiki.org/wiki/Extension:HAWelcome}}";,
+       "right-welcomeexempt": "{{doc-right|welcomeexempt}}"
+}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iea20bad42abf2e1f966b835c6965aa1fd67fa92d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/HAWelcome
Gerrit-Branch: master
Gerrit-Owner: Mainframe98 <k.s.w...@hotmail.com>

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

Reply via email to