Page MenuHomePhabricator
Paste P208

+accountcreator users not part of ACC
ActivePublic

Authored by stwalkerster on May 14 2018, 8:19 PM.
<?php
chdir(__DIR__);
require('config.php');
$database = new PDO($dburl, '', '');
$enwpdatabase = new PDO('mysql:host=enwiki.analytics.db.svc.eqiad.wmflabs;dbname=enwiki_p', '', '');
$database->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$enwpdatabase->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$stmt = $database->query("SELECT username, status, oauthidentitycache, lastactive FROM user where status in ('User', 'Admin') and oauthidentitycache is not null");
$result = $stmt->fetchAll(PDO::FETCH_ASSOC);
$stmt->closeCursor();
$stmt = $enwpdatabase->query("select user_name from user_groups inner join user on user_id = ug_user where ug_group = 'accountcreator' and ug_expiry is null");
$enwpresult = $stmt->fetchAll(PDO::FETCH_COLUMN);
$stmt->closeCursor();
// print_r($enwpresult);
$removable =[];
foreach($result as $accUser) {
$userinfo = unserialize($accUser['oauthidentitycache']);
$onwikiname = $userinfo->username;
$present = array_search($onwikiname, $enwpresult);
if($present !== false) {
unset($enwpresult[$present]);
}
}
foreach($enwpresult as $u) {
echo $u . "\n";
}

Event Timeline

stwalkerster created this object with visibility "Public (No Login Required)".