function updateEditMilestones($datestamp) { $dbr = wfGetDB(DB_SLAVE); echo "Updating the editing milestones for " . $datestamp . "\n"; $timestamp = $datestamp . "000000"; $dateUnix = wfTimestamp(TS_UNIX, $timestamp); $tomorrowUnix = strtotime("+1 day", $dateUnix); $tomorrowTimestamp = wfTimestamp(TS_MW, $tomorrowUnix); $tomorrowDatestamp = substr($tomorrowTimestamp, 0, 8); echo "starting " . $timestamp . " " . $tomorrowTimestamp . "\n"; $res = $dbr->select('recentchanges', array('rc_user', 'rc_comment'), array('rc_namespace' => 0, "rc_timestamp >= '{$timestamp}'", "rc_timestamp < '{$tomorrowTimestamp}'", 'rc_user != 0'), __METHOD__); $users = array(); $usersArray = array(); foreach ($res as $object) { $userArray[] = $object; } foreach ($userArray as $user) { if ($users[$user->rc_user] == null) { if (stripos($user->rc_comment, "Reverted edits by") !== false) { continue; } $users[$user->rc_user] = $user; } } echo "Found " . count($users) . " users who edited\n"; foreach ($users as $user) { Milestones::updateUserStat('edit', $user, $datestamp); $userObj = User::newFromId($user->rc_user); } }