getMainConfig(); $userGroupManager = $services->getUserGroupManager(); $userGroups = $userGroupManager->getUserGroups($user); if (in_array('activated-editor', $userGroups)) { return true; } $requiredWords = $config->get('IsekaiActivateEditorRequiredWords'); $continueKey = null; $userCreditSize = 0; do { $apiParams = [ 'action' => 'query', 'list' => 'usercontribs', 'ucprop' => 'sizediff', 'uclimit' => 20, 'ucuserids' => $user->getId(), ]; if ($continueKey) { $apiParams['uccontinue'] = $continueKey; } $api = new ApiMain( new FauxRequest( $apiParams ) ); $api->execute(); $result = $api->getResult(); $continueKey = $result->getResultData( [ 'continue', 'uccontinue' ] ); if ($continueKey === '||') { $continueKey = null; } $userCredits = $result->getResultData( [ 'query', 'usercontribs' ] ); foreach ($userCredits as $userCreditData) { if (is_array($userCreditData) && isset($userCreditData['sizediff'])) { if ($userCreditData['sizediff'] > 0) { $userCreditSize += $userCreditData['sizediff']; } } } if ($userCreditSize > $requiredWords) { return true; } } while($continueKey); return false; } }