<classname>wcf\system\cronjob\AssignTrophiesCronjob</classname>
<description>Assign trophies based on rules</description>
<description language="de">Ordnet Trophäen aufgrund der Regeln zu</description>
- <startminute>*/15</startminute>
+ <startminute>*/5</startminute>
<starthour>*</starthour>
<startdom>*</startdom>
<startmonth>*</startmonth>
use wcf\data\trophy\Trophy;
use wcf\data\trophy\TrophyList;
use wcf\data\user\trophy\UserTrophyAction;
-use wcf\data\user\User;
use wcf\data\user\UserList;
use wcf\system\SingletonFactory;
$i = 0;
foreach ($trophyList as $trophy) {
- $users = $this->getUsers($trophy);
+ $userIDs = $this->getUserIDs($trophy);
- foreach ($users as $user) {
+ foreach ($userIDs as $userID) {
(new UserTrophyAction([], 'create', [
'data' => [
'trophyID' => $trophy->trophyID,
- 'userID' => $user->userID,
+ 'userID' => $userID,
'time' => TIME_NOW
]
]))->executeAction();
* Returns the users who fulfill all conditions of the given trophy.
*
* @param Trophy $trophy
- * @return User[]
+ * @return integer[]
*/
- private function getUsers(Trophy $trophy) {
+ private function getUserIDs(Trophy $trophy) {
$userList = new UserList();
$conditions = $trophy->getConditions();
// prevent multiple awards from a trophy for a user
$userList->getConditionBuilder()->add('user_table.userID NOT IN (SELECT userID FROM wcf'.WCF_N.'_user_trophy WHERE trophyID IN (?))', [$trophy->trophyID]);
- $userList->readObjects();
+ $userList->readObjectIDs();
- return $userList->getObjects();
+ return $userList->getObjectIDs();
}
}