<?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'");
$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";
}