You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
884 B
PHP
31 lines
884 B
PHP
<?php
|
|
namespace Isekai\Job;
|
|
|
|
use Isekai\MiscUtils;
|
|
use Job;
|
|
use MediaWiki\MediaWikiServices;
|
|
use MediaWiki\Title\Title;
|
|
|
|
class CheckActivatedEditorJob extends Job {
|
|
public function __construct(Title $title, array $params){
|
|
parent::__construct('isekaiCheckActivatedEditor', $title, $params);
|
|
}
|
|
|
|
/**
|
|
* 检测用户是否满足加入编辑者用户组的条件
|
|
*/
|
|
public function run() {
|
|
$services = MediaWikiServices::getInstance();
|
|
if (!$this->params['user_id']) {
|
|
return true;
|
|
}
|
|
|
|
$user = $services->getUserFactory()->newFromId($this->params['user_id']);
|
|
|
|
if ($user->isRegistered() && MiscUtils::checkUserIsActivatedEditor($user)) {
|
|
$services->getUserGroupManager()->addUserToGroup($user, 'activated-editor');
|
|
}
|
|
|
|
return true;
|
|
}
|
|
} |