<classname>wcf\system\worker\UserRebuildDataWorker</classname>
<nicevalue>70</nicevalue>
</type>
+ <type>
+ <name>com.woltlab.wcf.activityPointItems</name>
+ <definitionname>com.woltlab.wcf.rebuildData</definitionname>
+ <classname>wcf\system\worker\UserActivityPointItemsRebuildDataWorker</classname>
+ <nicevalue>75</nicevalue>
+ </type>
<type>
<name>com.woltlab.wcf.attachment</name>
<definitionname>com.woltlab.wcf.rebuildData</definitionname>
--- /dev/null
+<?php
+namespace wcf\system\worker;
+use wcf\data\user\UserList;
+use wcf\system\database\util\PreparedStatementConditionBuilder;
+use wcf\system\user\activity\point\UserActivityPointHandler;
+use wcf\system\WCF;
+
+/**
+ * Worker implementation for update the user activity point database table's `items` column
+ * and afterwards also the `activityPoints`
+ *
+ * This worker is intended to run after the `UserRebuildDataWorker` so that the object counters
+ * in the `wcf1_user` table are updated.
+ *
+ * @author Matthias Schmidt
+ * @copyright 2001-2019 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package WoltLabSuite\Core\System\Worker
+ * @since 5.2
+ *
+ * @method UserList getObjectList()
+ */
+class UserActivityPointItemsRebuildDataWorker extends AbstractRebuildDataWorker {
+ /**
+ * @inheritDoc
+ */
+ protected $objectListClassName = UserList::class;
+
+ /**
+ * @inheritDoc
+ */
+ protected $limit = 50;
+
+ /**
+ * @inheritDoc
+ */
+ public function execute() {
+ parent::execute();
+
+ if (count($this->getObjectList()) === 0) {
+ return;
+ }
+
+ // update activity points for positive reactions
+ $reactionObjectType = UserActivityPointHandler::getInstance()->getObjectTypeByName('com.woltlab.wcf.like.activityPointEvent.receivedLikes');
+
+ $conditionBuilder = new PreparedStatementConditionBuilder();
+ $conditionBuilder->add('user_activity_point.objectTypeID = ?', [$reactionObjectType->objectTypeID]);
+ $conditionBuilder->add('user_activity_point.userID IN (?)', [$this->getObjectList()->getObjectIDs()]);
+
+ $sql = "UPDATE wcf" . WCF_N . "_user_activity_point user_activity_point
+ LEFT JOIN wcf" . WCF_N . "_user user_table
+ ON (user_table.userID = user_activity_point.userID)
+ SET user_activity_point.items = user_table.positiveReactionsReceived,
+ user_activity_point.activityPoints = user_activity_point.items * ?
+ " . $conditionBuilder;
+ $statement = WCF::getDB()->prepareStatement($sql);
+ $statement->execute(array_merge(
+ [$reactionObjectType->points],
+ $conditionBuilder->getParameters()
+ ));
+
+ // update activity points
+ UserActivityPointHandler::getInstance()->updateUsers($this->getObjectList()->getObjectIDs());
+ }
+}
use wcf\system\exception\SystemException;
use wcf\system\html\input\HtmlInputProcessor;
use wcf\system\image\ImageHandler;
-use wcf\system\user\activity\point\UserActivityPointHandler;
use wcf\system\WCF;
/**
}
if (!empty($userIDs)) {
- // update activity points
- UserActivityPointHandler::getInstance()->updateUsers($userIDs);
-
// update article counter
$conditionBuilder = new PreparedStatementConditionBuilder();
$conditionBuilder->add('user_table.userID IN (?)', [$userIDs]);
<item name="wcf.acp.rebuildData.com.woltlab.wcf.sitemap.description"><![CDATA[Erstellt die Sitemap neu.]]></item>
<item name="wcf.acp.rebuildData.com.woltlab.wcf.activityPointEvent"><![CDATA[Punkte pro Aktivität aktualisieren]]></item>
<item name="wcf.acp.rebuildData.com.woltlab.wcf.activityPointEvent.description"><![CDATA[Berechnet Punkte pro Aktivität neu]]></item>
+ <item name="wcf.acp.rebuildData.com.woltlab.wcf.activityPointItems"><![CDATA[Punkte-Aktivitäten aktualisieren]]></item>
+ <item name="wcf.acp.rebuildData.com.woltlab.wcf.activityPointItems.description"><![CDATA[Berechnet Anzahl an Aktivitäten neu, für die Benutzer Punkte erhalten]]></item>
</category>
<category name="wcf.acp.rescueMode">
<item name="wcf.acp.rescueMode"><![CDATA[Systemwiederherstellung]]></item>
<item name="wcf.acp.rebuildData.com.woltlab.wcf.sitemap"><![CDATA[Rebuild Sitemap]]></item>
<item name="wcf.acp.rebuildData.com.woltlab.wcf.sitemap.description"><![CDATA[Rebuilds the sitemap.]]></item>
<item name="wcf.acp.rebuildData.com.woltlab.wcf.activityPointEvent"><![CDATA[Rebuilds Points per Activity]]></item>
- <item name="wcf.acp.rebuildData.com.woltlab.wcf.activityPointEvent.description"><![CDATA[Recalculates points per activity]]></item>
+ <item name="wcf.acp.rebuildData.com.woltlab.wcf.activityPointEvent.description"><![CDATA[Recalculates points per activity.]]></item>
+ <item name="wcf.acp.rebuildData.com.woltlab.wcf.activityPointItems"><![CDATA[Rebuilds Point Activities]]></item>
+ <item name="wcf.acp.rebuildData.com.woltlab.wcf.activityPointItems.description"><![CDATA[Recalculates the number of activities for which users get points.]]></item>
</category>
<category name="wcf.acp.rescueMode">
<item name="wcf.acp.rescueMode"><![CDATA[Rescue Mode]]></item>