/** * Get all users that don't have to much sites added. * @return GWTUser[] */ function getAvailableUsers() { $users = $this->userRepository->allCountLt($this->getMaxSitesPerAccount()); $resultUsers = array(); foreach ($users as $i => $u) { /* @var $u GWTUser */ $sites = $this->webmasterToolsUtil->getSites($u); if ($u->getCount() != count($sites)) { $u->setCount(count($sites)); $this->userRepository->update($u); } if ($u->getCount() < $this->getMaxSitesPerAccount()) { $resultUsers[] = $u; } } return $resultUsers; }
<?php // example: SERVER_ID=5915 php maintenance/wikia/GoogleWebmasterToolsSync/list_non_full_users.php --conf /usr/wikia/docroot/wiki.factory/LocalSettings.php $max_count = 495; require_once __DIR__ . "/common.php"; GWTLogHelper::notice(__FILE__ . " script starts."); try { $userRepository = new GWTUserRepository(); $users = $userRepository->allCountLt($max_count); foreach ($users as $i => $w) { echo $w->getEmail() . " " . $w->getCount() . "\n"; } } catch (Exception $ex) { GWTLogHelper::error(__FILE__ . " script failed.", $ex); }