<classname>wcf\system\stat\LikeStatDailyHandler</classname>
<categoryname>com.woltlab.wcf.user</categoryname>
</type>
- <type>
- <name>com.woltlab.wcf.dislike</name>
- <definitionname>com.woltlab.wcf.statDailyHandler</definitionname>
- <classname>wcf\system\stat\DislikeStatDailyHandler</classname>
- <categoryname>com.woltlab.wcf.user</categoryname>
- </type>
<type>
<name>com.woltlab.wcf.userProfileComment</name>
<definitionname>com.woltlab.wcf.statDailyHandler</definitionname>
<definitionname>com.woltlab.wcf.condition.userGroupAssignment</definitionname>
<classname>wcf\system\condition\UserIntegerPropertyCondition</classname>
<conditiongroup>contents</conditiongroup>
- <propertyname>positiveReactionsReceived</propertyname>
- <minvalue>0</minvalue>
- </type>
- <type>
- <name>com.woltlab.wcf.negativeReactionsReceived</name>
- <definitionname>com.woltlab.wcf.condition.userGroupAssignment</definitionname>
- <classname>wcf\system\condition\UserIntegerPropertyCondition</classname>
- <conditiongroup>contents</conditiongroup>
- <propertyname>negativeReactionsReceived</propertyname>
- <minvalue>0</minvalue>
- </type>
- <type>
- <name>com.woltlab.wcf.neutralReactionsReceived</name>
- <definitionname>com.woltlab.wcf.condition.userGroupAssignment</definitionname>
- <classname>wcf\system\condition\UserIntegerPropertyCondition</classname>
- <conditiongroup>contents</conditiongroup>
- <propertyname>neutralReactionsReceived</propertyname>
+ <propertyname>likesReceived</propertyname>
<minvalue>0</minvalue>
</type>
<type>
<definitionname>com.woltlab.wcf.condition.trophy</definitionname>
<classname>wcf\system\condition\UserIntegerPropertyCondition</classname>
<conditiongroup>contents</conditiongroup>
- <propertyname>positiveReactionsReceived</propertyname>
- <minvalue>0</minvalue>
- </type>
- <type>
- <name>com.woltlab.wcf.negativeReactionsReceived</name>
- <definitionname>com.woltlab.wcf.condition.trophy</definitionname>
- <classname>wcf\system\condition\UserIntegerPropertyCondition</classname>
- <conditiongroup>contents</conditiongroup>
- <propertyname>negativeReactionsReceived</propertyname>
- <minvalue>0</minvalue>
- </type>
- <type>
- <name>com.woltlab.wcf.neutralReactionsReceived</name>
- <definitionname>com.woltlab.wcf.condition.trophy</definitionname>
- <classname>wcf\system\condition\UserIntegerPropertyCondition</classname>
- <conditiongroup>contents</conditiongroup>
- <propertyname>neutralReactionsReceived</propertyname>
+ <propertyname>likesReceived</propertyname>
<minvalue>0</minvalue>
</type>
<type>
<classname>wcf\system\condition\UserIntegerPropertyCondition</classname>
<conditionobject>com.woltlab.wcf.user</conditionobject>
<conditiongroup>contents</conditiongroup>
- <propertyname>positiveReactionsReceived</propertyname>
- <minvalue>0</minvalue>
- </type>
- <type>
- <name>com.woltlab.wcf.negativeReactionsReceived</name>
- <definitionname>com.woltlab.wcf.condition.notice</definitionname>
- <classname>wcf\system\condition\UserIntegerPropertyCondition</classname>
- <conditionobject>com.woltlab.wcf.user</conditionobject>
- <conditiongroup>contents</conditiongroup>
- <propertyname>negativeReactionsReceived</propertyname>
- <minvalue>0</minvalue>
- </type>
- <type>
- <name>com.woltlab.wcf.neutralReactionsReceived</name>
- <definitionname>com.woltlab.wcf.condition.notice</definitionname>
- <classname>wcf\system\condition\UserIntegerPropertyCondition</classname>
- <conditionobject>com.woltlab.wcf.user</conditionobject>
- <conditiongroup>contents</conditiongroup>
- <propertyname>neutralReactionsReceived</propertyname>
+ <propertyname>likesReceived</propertyname>
<minvalue>0</minvalue>
</type>
<type>
<classname>wcf\system\condition\UserIntegerPropertyCondition</classname>
<conditionobject>com.woltlab.wcf.user</conditionobject>
<conditiongroup>contents</conditiongroup>
- <propertyname>positiveReactionsReceived</propertyname>
- <minvalue>0</minvalue>
- </type>
- <type>
- <name>com.woltlab.wcf.negativeReactionsReceived</name>
- <definitionname>com.woltlab.wcf.condition.ad</definitionname>
- <classname>wcf\system\condition\UserIntegerPropertyCondition</classname>
- <conditionobject>com.woltlab.wcf.user</conditionobject>
- <conditiongroup>contents</conditiongroup>
- <propertyname>negativeReactionsReceived</propertyname>
- <minvalue>0</minvalue>
- </type>
- <type>
- <name>com.woltlab.wcf.neutralReactionsReceived</name>
- <definitionname>com.woltlab.wcf.condition.ad</definitionname>
- <classname>wcf\system\condition\UserIntegerPropertyCondition</classname>
- <conditionobject>com.woltlab.wcf.user</conditionobject>
- <conditiongroup>contents</conditiongroup>
- <propertyname>neutralReactionsReceived</propertyname>
+ <propertyname>likesReceived</propertyname>
<minvalue>0</minvalue>
</type>
<type>
<definitionname>com.woltlab.wcf.bulkProcessing.user.condition</definitionname>
<classname>wcf\system\condition\UserIntegerPropertyCondition</classname>
<conditiongroup>contents</conditiongroup>
- <propertyname>positiveReactionsReceived</propertyname>
- <minvalue>0</minvalue>
- </type>
- <type>
- <name>com.woltlab.wcf.negativeReactionsReceived</name>
- <definitionname>com.woltlab.wcf.bulkProcessing.user.condition</definitionname>
- <classname>wcf\system\condition\UserIntegerPropertyCondition</classname>
- <conditiongroup>contents</conditiongroup>
- <propertyname>negativeReactionsReceived</propertyname>
- <minvalue>0</minvalue>
- </type>
- <type>
- <name>com.woltlab.wcf.neutralReactionsReceived</name>
- <definitionname>com.woltlab.wcf.bulkProcessing.user.condition</definitionname>
- <classname>wcf\system\condition\UserIntegerPropertyCondition</classname>
- <conditiongroup>contents</conditiongroup>
- <propertyname>neutralReactionsReceived</propertyname>
+ <propertyname>likesReceived</propertyname>
<minvalue>0</minvalue>
</type>
<type>
<definitionname>com.woltlab.wcf.condition.userSearch</definitionname>
<classname>wcf\system\condition\UserIntegerPropertyCondition</classname>
<conditiongroup>contents</conditiongroup>
- <propertyname>positiveReactionsReceived</propertyname>
- <minvalue>0</minvalue>
- </type>
- <type>
- <name>com.woltlab.wcf.negativeReactionsReceived</name>
- <definitionname>com.woltlab.wcf.condition.userSearch</definitionname>
- <classname>wcf\system\condition\UserIntegerPropertyCondition</classname>
- <conditiongroup>contents</conditiongroup>
- <propertyname>negativeReactionsReceived</propertyname>
- <minvalue>0</minvalue>
- </type>
- <type>
- <name>com.woltlab.wcf.neutralReactionsReceived</name>
- <definitionname>com.woltlab.wcf.condition.userSearch</definitionname>
- <classname>wcf\system\condition\UserIntegerPropertyCondition</classname>
- <conditiongroup>contents</conditiongroup>
- <propertyname>neutralReactionsReceived</propertyname>
+ <propertyname>likesReceived</propertyname>
<minvalue>0</minvalue>
</type>
<type>
<dl class="plain dataList">
{content}
{if MODULE_LIKE && MESSAGE_SIDEBAR_ENABLE_LIKES_RECEIVED && !$isReply}
- {assign var=overallReactionCount value=$userProfile->positiveReactionsReceived - $userProfile->negativeReactionsReceived}
<dt><a href="{link controller='User' object=$userProfile}{/link}#likes" class="jsTooltip" title="{lang user=$userProfile}wcf.like.showLikesReceived{/lang}">{lang}wcf.like.likesReceived{/lang}</a></dt>
- <dd>{#$overallReactionCount}</dd>
+ <dd>{#$userProfile->cumulativeLikes}</dd>
{/if}
{if MESSAGE_SIDEBAR_ENABLE_ACTIVITY_POINTS && $userProfile->activityPoints}
{event name='statistics'}
-{if MODULE_LIKE}
- {assign var=reactionReputation value=$user->positiveReactionsReceived - $user->negativeReactionsReceived}
- {if $reactionReputation}
- <dt>{if $__wcf->getSession()->getPermission('user.profile.canViewUserProfile') && !$user->isProtected()}<a href="{link controller='User' object=$user}{/link}#likes" class="jsTooltip" title="{lang}wcf.like.showLikesReceived{/lang}">{lang}wcf.like.reputation{/lang}</a>{else}{lang}wcf.like.reputation{/lang}{/if}</dt>
- <dd>{#$reactionReputation}</dd>
- {/if}
+{if MODULE_LIKE && $user->cumulativeLikes}
+ <dt>{if $__wcf->getSession()->getPermission('user.profile.canViewUserProfile') && !$user->isProtected()}<a href="{link controller='User' object=$user}{/link}#likes" class="jsTooltip" title="{lang}wcf.like.showLikesReceived{/lang}">{lang}wcf.like.reputation{/lang}</a>{else}{lang}wcf.like.reputation{/lang}{/if}</dt>
+ <dd>{#$user->cumulativeLikes}</dd>
{/if}
{if $user->activityPoints}
WCF::getDB()->beginTransaction();
$reactionTypes = <<<DATA
-('wcf.reactionType.title1', 1, 1, 'like.svg'),
-('wcf.reactionType.title2', 1, 2, 'haha.svg'),
-('wcf.reactionType.title3', -1, 3, 'sad.svg'),
-('wcf.reactionType.title4', 0, 4, 'confused.svg'),
-('wcf.reactionType.title5', 1, 5, 'thanks.svg'),
+('wcf.reactionType.title1', 1, 'like.svg'),
+('wcf.reactionType.title2', 2, 'haha.svg'),
+('wcf.reactionType.title3', 3, 'sad.svg'),
+('wcf.reactionType.title4', 4, 'confused.svg'),
+('wcf.reactionType.title5', 5, 'thanks.svg'),
DATA;
// add reaction columns
- $statement = WCF::getDB()->prepareStatement(str_replace('wcf1_', 'wcf'.WCF_N.'_', 'INSERT INTO wcf1_reaction_type (title, type, showOrder, iconFile) VALUES '. $reactionTypes));
+ $statement = WCF::getDB()->prepareStatement('INSERT INTO wcf'.WCF_N.'_reaction_type (title, showOrder, iconFile) VALUES '. $reactionTypes);
$statement->execute();
// update current likes
- $sql = "UPDATE wcf1_like SET reactionTypeID = ? WHERE likeValue = ?";
- $statement = WCF::getDB()->prepareStatement(str_replace('wcf1_', 'wcf'.WCF_N.'_', $sql));
-
+ $sql = "UPDATE wcf".WCF_N."_like SET reactionTypeID = ? WHERE likeValue = ?";
+ $statement = WCF::getDB()->prepareStatement($sql);
$statement->execute([
Like::LIKE,
1
]);
- $statement->execute([
- Like::DISLIKE,
- 3
- ]);
- // delete outdated likes, which aren't likes nor dislikes (normally none should exist)
- $sql = "DELETE FROM wcf1_like WHERE reactionTypeID = 0";
- $statement = WCF::getDB()->prepareStatement(str_replace('wcf1_', 'wcf'.WCF_N.'_', $sql));
+ // Delete outdated or unsupported likes.
+ WCF::getDB()->prepareStatement("DELETE FROM wcf".WCF_N."_like WHERE reactionTypeID = 0")->execute();
// add foreign key
- $statement = WCF::getDB()->prepareStatement(str_replace('wcf1_', 'wcf'.WCF_N.'_', 'ALTER TABLE wcf1_like ADD FOREIGN KEY (reactionTypeID) REFERENCES wcf1_reaction_type (reactionTypeID) ON DELETE CASCADE'));
+ $statement = WCF::getDB()->prepareStatement('ALTER TABLE wcf'.WCF_N.'_like ADD FOREIGN KEY (reactionTypeID) REFERENCES wcf1_reaction_type (reactionTypeID) ON DELETE CASCADE');
$statement->execute();
WCF::getDB()->commitTransaction();
->maximumLength(255)
->i18n()
->languageItemPattern('wcf.reactionType.title\d+'),
- RadioButtonFormField::create('type')
- ->label('wcf.acp.reactionType.type')
- ->required()
- ->options([
- ReactionType::REACTION_TYPE_POSITIVE => 'wcf.acp.reactionType.type.positive',
- ReactionType::REACTION_TYPE_NEUTRAL => 'wcf.acp.reactionType.type.neutral',
- ReactionType::REACTION_TYPE_NEGATIVE => 'wcf.acp.reactionType.type.negative'
- ])
- ->value(ReactionType::REACTION_TYPE_POSITIVE),
ShowOrderFormField::create()
->description('wcf.acp.reactionType.showOrder.description')
->required()
use wcf\data\article\content\ViewableArticleContentList;
use wcf\system\cache\runtime\UserProfileRuntimeCache;
use wcf\system\label\object\ArticleLabelObjectHandler;
-use wcf\system\reaction\ReactionHandler;
use wcf\system\visitTracker\VisitTracker;
use wcf\system\WCF;
$this->sqlSelects .= 'tracked_visit.visitTime';
$this->sqlJoins .= " LEFT JOIN wcf".WCF_N."_tracked_visit tracked_visit ON (tracked_visit.objectTypeID = ".VisitTracker::getInstance()->getObjectTypeID('com.woltlab.wcf.article')." AND tracked_visit.objectID = article.articleID AND tracked_visit.userID = ".WCF::getUser()->userID.")";
}
-
- // get like status
- if (!empty($this->sqlSelects)) $this->sqlSelects .= ',';
- $this->sqlSelects .= "like_object.likes, like_object.dislikes, like_object.neutralReactions";
- $this->sqlJoins .= " LEFT JOIN wcf".WCF_N."_like_object like_object ON (like_object.objectTypeID = ".ReactionHandler::getInstance()->getObjectType('com.woltlab.wcf.likeableArticle')->objectTypeID." AND like_object.objectID = article.articleID)";
}
/**
return 'like_table';
}
- /**
- * Returns true, if like value is a like.
- *
- * @return boolean
- * @deprecated 5.2
- */
- public function isLike() {
- return $this->getReactionType()->isPositive();
- }
-
- /**
- * Returns true, if like value is a dislike.
- *
- * @return boolean
- * @deprecated 5.2
- */
- public function isDislike() {
- return $this->getReactionType()->isNegative();
- }
-
/**
* Returns the reaction for these like.
*
use wcf\data\reaction\type\ReactionTypeCache;
use wcf\data\user\User;
use wcf\data\DatabaseObject;
-use wcf\system\reaction\ReactionHandler;
use wcf\system\WCF;
use wcf\util\JSON;
* @property-read integer $objectID id of the liked object
* @property-read integer|null $objectUserID id of the user who created the liked object or null if user has been deleted or object was created by guest
* @property-read integer $likes number of likes of the liked object
- * @property-read integer $dislikes number of dislikes of the liked object
- * @property-read integer $neutralReactions number of neutral reactions on the liked object
- * @property-read integer $cumulativeLikes cumulative result of likes (counting +1) and dislikes (counting -1)
+ * @property-read integer $dislikes legacy column, not used anymore
+ * @property-read integer $cumulativeLikes number of likes of the liked object
* @property-read string $cachedUsers serialized array with the ids and names of the three users who liked (+1) the object last
* @property-read string $cachedReactions serialized array with the reactionTypeIDs and the count of the reactions
*/
return $this->reactions;
}
- /**
- * Returns the reputation of the current like object. Returns null, if
- * there are no reactions on the object.
- *
- * @return integer|null
- * @since 5.2
- */
- public function getReputation() {
- if ($this->reputation === null && !empty($this->getReactions())) {
- $this->reputation = 0;
- foreach ($this->getReactions() as $reactionTypeID => $data) {
- $reactionType = ReactionHandler::getInstance()->getReactionTypeByID($reactionTypeID);
- if ($reactionType->isPositive()) {
- $this->reputation += $data['reactionCount'];
- }
- else if ($reactionType->isNegative()) {
- $this->reputation -= $data['reactionCount'];
- }
- }
- }
-
- return $this->reputation;
- }
-
/**
* Sets the liked object.
*
//
if ($newLikeObject->objectUserID) {
- $sql = "SELECT COUNT(*) as count, like_table.reactionTypeID
- FROM wcf".WCF_N."_like like_table
- WHERE like_table.objectTypeID = ?
- AND like_table.objectID = ?
- GROUP BY like_table.reactionTypeID";
+ $sql = "SELECT COUNT(*) as count
+ FROM wcf".WCF_N."_like
+ WHERE objectTypeID = ?
+ AND objectID = ?";
$statement = WCF::getDB()->prepareStatement($sql);
$statement->execute([
$targetObjectType->objectTypeID,
$this->parameters['targetObjectID']
]);
-
- $updateValues = [
- 'positive' => 0,
- 'neutral' => 0,
- 'negative' => 0
- ];
- while ($row = $statement->fetchArray()) {
- $reactionType = ReactionTypeCache::getInstance()->getReactionTypeByID($row['reactionTypeID']);
-
- if (!$reactionType->isDisabled) {
- if ($reactionType->isPositive()) {
- $updateValues['positive'] += $row['count'];
- }
- else if ($reactionType->isNegative()) {
- $updateValues['negative'] += $row['count'];
- }
- else if ($reactionType->isNeutral()) {
- $updateValues['neutral'] += $row['count'];
- }
- }
- }
+ $count = $statement->fetchSingleColumn();
// update received likes
$userEditor = new UserEditor(new User($newLikeObject->objectUserID));
$userEditor->updateCounters([
- 'likesReceived' => $updateValues['positive'],
- 'positiveReactionsReceived' => $updateValues['positive'],
- 'negativeReactionsReceived' => $updateValues['negative'],
- 'neutralReactionsReceived' => $updateValues['neutral']
+ 'likesReceived' => $count,
]);
// add activity points
- UserActivityPointHandler::getInstance()->fireEvents('com.woltlab.wcf.like.activityPointEvent.receivedLikes', [$newLikeObject->objectUserID => $updateValues['positive']]);
+ UserActivityPointHandler::getInstance()->fireEvents('com.woltlab.wcf.like.activityPointEvent.receivedLikes', [$newLikeObject->objectUserID => $count]);
}
}
}
*
* @property-read integer $reactionTypeID unique id of the reaction type
* @property-read string $title
- * @property-read integer $type type of the reaction (1 is positive, 0 is neutral and -1 is negative)
* @property-read integer $showOrder position of the reaction type in relation to the other reaction types
* @property-read string $iconFile the file location of the icon
* @property-read integer $isDisabled is `1` if the reaction type is disabled and thus not shown, otherwise `0`
*/
class ReactionType extends DatabaseObject implements ITitledObject {
- /**
- * The type value, if this reaction type is a positive reaction.
- * @var integer
- */
- const REACTION_TYPE_POSITIVE = 1;
-
- /**
- * The type value, if this reaction type is a neutral reaction.
- * @var integer
- */
- const REACTION_TYPE_NEUTRAL = 0;
-
- /**
- * The type value, if this reaction type is a negative reaction.
- * @var integer
- */
- const REACTION_TYPE_NEGATIVE = -1;
-
/**
* @inheritDoc
*/
return WCF::getPath() . 'images/reaction/'. $this->iconFile;
}
- /**
- * Returns true, if reaction is a positive reaction.
- *
- * @return bool
- */
- public function isPositive() {
- return $this->type == self::REACTION_TYPE_POSITIVE;
- }
-
- /**
- * Returns true, if reaction is a negative reaction.
- *
- * @return bool
- */
- public function isNegative() {
- return $this->type == self::REACTION_TYPE_NEGATIVE;
- }
-
- /**
- * Returns true, if reaction is a neutral reaction.
- *
- * @return bool
- */
- public function isNeutral() {
- return $this->type == self::REACTION_TYPE_NEUTRAL;
- }
-
/**
* Returns the absolute location of the icon file.
*
*/
protected function readObjects() {
if ($this->sortField === 'reactionReputation') {
- $this->sqlOrderBy = '(user_table.positiveReactionsReceived - user_table.negativeReactionsReceived) '. $this->sortOrder;
+ $this->sqlOrderBy = 'user_table.likesReceived '. $this->sortOrder;
}
parent::readObjects();
if (isset($conditionData['greaterThan'])) {
/** @noinspection PhpUndefinedFieldInspection */
- $objectList->getConditionBuilder()->add('(user_table.positiveReactionsReceived - user_table.negativeReactionsReceived) > ?', [$conditionData['greaterThan']]);
+ $objectList->getConditionBuilder()->add('user_table.likesReceived > ?', [$conditionData['greaterThan']]);
}
if (isset($conditionData['lessThan'])) {
- $objectList->getConditionBuilder()->add('(user_table.positiveReactionsReceived - user_table.negativeReactionsReceived) < ?', [$conditionData['lessThan']]);
+ $objectList->getConditionBuilder()->add('user_table.likesReceived < ?', [$conditionData['lessThan']]);
}
}
* @inheritDoc
*/
public function checkUser(Condition $condition, User $user) {
- if ($condition->greaterThan !== null && ($user->positiveReactionsReceived - $user->negativeReactionsReceived) <= $condition->greaterThan) {
+ if ($condition->greaterThan !== null && $user->likesReceived <= $condition->greaterThan) {
return false;
}
- if ($condition->lessThan !== null && ($user->positiveReactionsReceived - $user->negativeReactionsReceived) >= $condition->lessThan) {
+ if ($condition->lessThan !== null && $user->likesReceived >= $condition->lessThan) {
return false;
}
if (!isset($data['reactionTypeID'])) {
if ($data['likeValue'] == 1) {
- $data['reactionTypeID'] = ReactionHandler::getInstance()->getLegacyReactionTypeID(ReactionType::REACTION_TYPE_POSITIVE);
- }
- else {
- $data['reactionTypeID'] = ReactionHandler::getInstance()->getLegacyReactionTypeID(ReactionType::REACTION_TYPE_NEGATIVE);
+ $data['reactionTypeID'] = ReactionHandler::getInstance()->getFirstReactionTypeID();
}
}
else {
* @return array
*/
public function like(ILikeObject $likeable, User $user, $likeValue, $time = TIME_NOW) {
+ $reactionTypeID = null;
if ($likeValue == 1) {
- $reactionTypeID = ReactionHandler::getInstance()->getLegacyReactionTypeID(ReactionType::REACTION_TYPE_POSITIVE);
- }
- else {
- $reactionTypeID = ReactionHandler::getInstance()->getLegacyReactionTypeID(ReactionType::REACTION_TYPE_NEGATIVE);
+ $reactionTypeID = ReactionHandler::getInstance()->getFirstReactionTypeID();
}
if ($reactionTypeID === null) {
'like' => 0,
'newValue' => 0,
'oldValue' => 0,
- 'users' => []
+ 'users' => [],
];
}
$reactData = ReactionHandler::getInstance()->react($likeable, $user, $reactionTypeID, $time);
- if ($reactData['reactionTypeID'] === null) {
- $newValue = 0;
- }
- else if (ReactionTypeCache::getInstance()->getReactionTypeByID($reactData['reactionTypeID'])->type == ReactionType::REACTION_TYPE_NEGATIVE) {
- $newValue = -1;
- }
- else {
- $newValue = 1;
- }
return [
'data' => $this->loadLikeStatus($reactData['likeObject'], $user),
'like' => $reactData['like'],
- 'newValue' => $newValue,
- 'oldValue' => 0, // this value is currently a dummy value, maybe determine a real value
- 'users' => []
+ 'newValue' => 0,
+ 'oldValue' => 0,
+ 'users' => [],
];
}
'data' => $this->loadLikeStatus($reactData['likeObject'], $user),
'like' => null,
'newValue' => 0,
- 'oldValue' => 0, // this value is currently a dummy value, maybe determine a real value
- 'users' => []
+ 'oldValue' => 0,
+ 'users' => [],
];
}
'reactionTypeID' => $reactionTypeID
]);
- if ($reaction->isPositive() && $likeable->getUserID()) {
+ if ($likeable->getUserID()) {
UserActivityPointHandler::getInstance()->fireEvent('com.woltlab.wcf.like.activityPointEvent.receivedLikes', $like->likeID, $likeable->getUserID());
}
}
]);
if ($likeable->getUserID()) {
- if ($like->getReactionType()->isPositive() && !$reaction->isPositive()) {
- UserActivityPointHandler::getInstance()->removeEvents('com.woltlab.wcf.like.activityPointEvent.receivedLikes', [$likeable->getUserID() => 1]);
- }
- else if (!$like->getReactionType()->isPositive() && $reaction->isPositive()) {
- UserActivityPointHandler::getInstance()->fireEvent('com.woltlab.wcf.like.activityPointEvent.receivedLikes', $like->likeID, $likeable->getUserID());
- }
+ UserActivityPointHandler::getInstance()->removeEvents('com.woltlab.wcf.like.activityPointEvent.receivedLikes', [$likeable->getUserID() => 1]);
}
}
private function updateLikeObject(ILikeObject $likeable, LikeObject $likeObject, Like $like, ReactionType $reactionType) {
// update existing object
if ($likeObject->likeObjectID) {
- $likes = $likeObject->likes;
- $dislikes = $likeObject->dislikes;
- $neutralReactions = $likeObject->neutralReactions;
$cumulativeLikes = $likeObject->cumulativeLikes;
if ($likeObject->cachedReactions !== null) {
}
if ($like->likeID) {
- if ($like->getReactionType()->isPositive()) {
- $likes--;
- $cumulativeLikes--;
- }
- else if ($like->getReactionType()->isNegative()) {
- $dislikes--;
- $cumulativeLikes++;
- }
- else {
- $neutralReactions--;
- }
+ $cumulativeLikes--;
if (isset($cachedReactions[$like->getReactionType()->reactionTypeID])) {
if (--$cachedReactions[$like->getReactionType()->reactionTypeID] == 0) {
}
}
- if ($reactionType->isPositive()) {
- $likes++;
- $cumulativeLikes++;
- }
- else if ($reactionType->isNegative()) {
- $dislikes++;
- $cumulativeLikes--;
- }
- else {
- $neutralReactions++;
- }
+ $cumulativeLikes++;
if (isset($cachedReactions[$reactionType->reactionTypeID])) {
$cachedReactions[$reactionType->reactionTypeID]++;
// build update date
$updateData = [
- 'likes' => $likes,
- 'dislikes' => $dislikes,
- 'neutralReactions' => $neutralReactions,
+ 'likes' => $cumulativeLikes,
+ 'dislikes' => 0,
'cumulativeLikes' => $cumulativeLikes,
- 'cachedReactions' => serialize($cachedReactions)
+ 'cachedReactions' => serialize($cachedReactions),
];
// update data
$likeObjectEditor->update($updateData);
}
else {
- $cumulativeLikes = $reactionType->type;
+ $cumulativeLikes = 1;
$cachedReactions = [
- $reactionType->reactionTypeID => 1
+ $reactionType->reactionTypeID => 1,
];
// create cache
'objectTypeID' => $likeable->getObjectType()->objectTypeID,
'objectID' => $likeable->getObjectID(),
'objectUserID' => $likeable->getUserID() ?: null,
- 'likes' => ($reactionType->isPositive()) ? 1 : 0,
- 'dislikes' => ($reactionType->isNegative()) ? 1 : 0,
- 'neutralReactions' => ($reactionType->isNeutral()) ? 1 : 0,
+ 'likes' => $cumulativeLikes,
+ 'dislikes' => 0,
'cumulativeLikes' => $cumulativeLikes,
- 'cachedReactions' => serialize($cachedReactions)
+ 'cachedReactions' => serialize($cachedReactions),
]);
}
return [
'cumulativeLikes' => $cumulativeLikes,
'cachedReactions' => $cachedReactions,
- 'likeObject' => $likeObject
+ 'likeObject' => $likeObject,
];
}
*/
private function updateUsersLikeCounter(ILikeObject $likeable, LikeObject $likeObject, Like $like, ReactionType $reactionType = null) {
if ($likeable->getUserID()) {
- $counters = [
- 'likesReceived' => 0,
- 'positiveReactionsReceived' => 0,
- 'negativeReactionsReceived' => 0,
- 'neutralReactionsReceived' => 0
- ];
-
+ $likesReceived = 0;
if ($like->likeID) {
- if ($like->getReactionType()->isPositive()) {
- $counters['likesReceived']--;
- $counters['positiveReactionsReceived']--;
- }
- else if ($like->getReactionType()->isNegative()) {
- $counters['negativeReactionsReceived']--;
- }
- else if ($like->getReactionType()->isNeutral()) {
- $counters['neutralReactionsReceived']--;
- }
+ $likesReceived--;
}
if ($reactionType !== null) {
- if ($reactionType->isPositive()) {
- $counters['likesReceived']++;
- $counters['positiveReactionsReceived']++;
- }
- else if ($reactionType->isNegative()) {
- $counters['negativeReactionsReceived']++;
- }
- else if ($reactionType->isNeutral()) {
- $counters['neutralReactionsReceived']++;
- }
+ $likesReceived++;
}
- $userEditor = new UserEditor(UserRuntimeCache::getInstance()->getObject($likeable->getUserID()));
- $userEditor->updateCounters($counters);
+ if ($likesReceived !== 0) {
+ $userEditor = new UserEditor(UserRuntimeCache::getInstance()->getObject($likeable->getUserID()));
+ $userEditor->updateCounters(['likesReceived' => $likesReceived]);
+ }
}
}
$likeEditor = new LikeEditor($like);
$likeEditor->delete();
- if ($likeable->getUserID() && $like->getReactionType()->isPositive()) {
+ if ($likeable->getUserID()) {
UserActivityPointHandler::getInstance()->removeEvents('com.woltlab.wcf.like.activityPointEvent.receivedLikes', [$likeable->getUserID() => 1]);
}
}
// update existing object
- $likes = $likeObject->likes;
- $dislikes = $likeObject->dislikes;
- $neutralReactions = $likeObject->neutralReactions;
$cumulativeLikes = $likeObject->cumulativeLikes;
$cachedReactions = @unserialize($likeObject->cachedReactions);
if (!is_array($cachedReactions)) {
}
if ($like->likeID) {
- if ($like->getReactionType()->isPositive()) {
- $likes--;
- $cumulativeLikes--;
- }
- else if ($like->getReactionType()->isNegative()) {
- $dislikes--;
- $cumulativeLikes++;
- }
- else if ($like->getReactionType()->isNeutral()) {
- $neutralReactions--;
- }
- else {
- throw new \LogicException('Unreachable');
- }
+ $cumulativeLikes--;
if (isset($cachedReactions[$like->getReactionType()->reactionTypeID])) {
if (--$cachedReactions[$like->getReactionType()->reactionTypeID] == 0) {
// build update date
$updateData = [
- 'likes' => $likes,
- 'dislikes' => $dislikes,
- 'neutralReactions' => $neutralReactions,
+ 'likes' => $cumulativeLikes,
+ 'dislikes' => 0,
'cumulativeLikes' => $cumulativeLikes,
'cachedReactions' => serialize($cachedReactions)
];
foreach ($likeObjects as $likeObject) {
if ($likeObject->likes) {
if (!isset($users[$likeObject->objectUserID])) {
- $users[$likeObject->objectUserID] = [
- 'positiveReactions' => 0,
- 'negativeReactions' => 0,
- 'neutralReactions' => 0
- ];
+ $users[$likeObject->objectUserID] = 0;
}
- foreach ($likeObject->getReactions() as $reactionTypeID => $data) {
- switch (ReactionTypeCache::getInstance()->getReactionTypeByID($reactionTypeID)->type) {
- case ReactionType::REACTION_TYPE_POSITIVE:
- $users[$likeObject->objectUserID]['positiveReactions'] += $data['reactionCount'];
- break;
-
- case ReactionType::REACTION_TYPE_NEUTRAL:
- $users[$likeObject->objectUserID]['neutralReactions'] += $data['reactionCount'];
- break;
-
- case ReactionType::REACTION_TYPE_NEGATIVE:
- $users[$likeObject->objectUserID]['negativeReactions'] += $data['reactionCount'];
- break;
-
- default:
- throw new \LogicException('Unreachable');
- }
- }
+ $users[$likeObject->objectUserID] -= count($likeObject->getReactions());
}
}
foreach ($users as $userID => $reactionData) {
$userEditor = new UserEditor(new User(null, ['userID' => $userID]));
$userEditor->updateCounters([
- 'positiveReactionsReceived' => $users[$userID]['positiveReactions'] *-1,
- 'negativeReactionsReceived' => $users[$userID]['negativeReactions'] *-1,
- 'neutralReactionsReceived' => $users[$userID]['neutralReactions'] *-1,
-
- // maintain deprecated value for legacy reasons
- 'likesReceived' => $users[$userID]['positiveReactions'] *-1
+ 'likesReceived' => $users[$userID],
]);
}
$likeList->readObjects();
if (count($likeList)) {
- $likeData = $positiveLikeData = [];
+ $likeData = [];
foreach ($likeList as $like) {
$likeData[$like->likeID] = $like->userID;
-
- if ($like->getReactionType()->isPositive()) {
- $positiveLikeData[$like->likeID] = $like->userID;
- }
}
// delete like notifications
}
// revoke activity points
- UserActivityPointHandler::getInstance()->removeEvents('com.woltlab.wcf.like.activityPointEvent.receivedLikes', $positiveLikeData);
+ UserActivityPointHandler::getInstance()->removeEvents('com.woltlab.wcf.like.activityPointEvent.receivedLikes', $likeData);
// delete likes
LikeEditor::deleteAll(array_keys($likeData));
}
/**
- * Returns the legacy reactionTypeID for a specific type. The given type must be
- * ReactionType::REACTION_TYPE_POSITIVE for a like
- * or ReactionType::REACTION_TYPE_NEGATIVE for a dislike
- * other values are not allowed and will resulted in a LogicException.
- * If there are no legacy reaction type, the method returns null.
+ * Returns the first available reaction type.
*
- * @param integer $type
- * @return integer|null
+ * @return ReactionType|null
*/
- public function getLegacyReactionTypeID($type) {
- $reactionTypes = ReactionTypeCache::getInstance()->getEnabledReactionTypes();
- ReactionType::sort($reactionTypes, 'showOrder');
- switch ($type) {
- case ReactionType::REACTION_TYPE_POSITIVE:
- foreach ($reactionTypes as $reactionType) {
- if ($reactionType->isPositive()) {
- return $reactionType->reactionTypeID;
- }
- }
-
- return null;
-
- case ReactionType::REACTION_TYPE_NEGATIVE:
- foreach ($reactionTypes as $reactionType) {
- if ($reactionType->isNegative()) {
- return $reactionType->reactionTypeID;
- }
- }
-
- return null;
+ public function getFirstReactionType() {
+ static $firstReactionType;
+
+ if ($firstReactionType === null) {
+ $reactionTypes = ReactionTypeCache::getInstance()->getEnabledReactionTypes();
+ ReactionType::sort($reactionTypes, 'showOrder');
- default:
- throw new \LogicException('Invalid type given.');
+ $firstReactionType = reset($reactionTypes);
}
+
+ return $firstReactionType;
+ }
+
+ /**
+ * Returns the first available reaction type's id.
+ *
+ * @return int|null
+ */
+ public function getFirstReactionTypeID() {
+ $firstReactionType = $this->getFirstReactionType();
+
+ return $firstReactionType ? $firstReactionType->reactionTypeID : null;
}
}
+++ /dev/null
-<?php
-namespace wcf\system\stat;
-use wcf\data\like\Like;
-
-/**
- * Stat handler implementation for dislike stats.
- *
- * @author Marcel Werk
- * @copyright 2001-2019 WoltLab GmbH
- * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
- * @package WoltLabSuite\Core\System\Stat
- */
-class DislikeStatDailyHandler extends LikeStatDailyHandler {
- protected $likeValue = Like::DISLIKE;
-}
<?php
namespace wcf\system\stat;
-use wcf\data\like\Like;
use wcf\system\WCF;
/**
* @package WoltLabSuite\Core\System\Stat
*/
class LikeStatDailyHandler extends AbstractStatDailyHandler {
- protected $likeValue = Like::LIKE;
-
/**
* @inheritDoc
*/
public function getData($date) {
$sql = "SELECT COUNT(*)
FROM wcf".WCF_N."_like
- WHERE time BETWEEN ? AND ?
- AND likeValue = ?";
+ WHERE time BETWEEN ? AND ?";
$statement = WCF::getDB()->prepareStatement($sql);
- $statement->execute([$date, $date + 86399, $this->likeValue]);
+ $statement->execute([$date, $date + 86399]);
$counter = intval($statement->fetchSingleColumn());
$sql = "SELECT COUNT(*)
FROM wcf".WCF_N."_like
- WHERE time < ?
- AND likeValue = ?";
+ WHERE time < ?";
$statement = WCF::getDB()->prepareStatement($sql);
- $statement->execute([$date + 86400, $this->likeValue]);
+ $statement->execute([$date + 86400]);
$total = intval($statement->fetchSingleColumn());
return [
$itemsToUser = [];
$likeObjectData = [];
foreach ($this->objectList as $like) {
- if ($like->objectUserID && $like->likeValue == Like::LIKE) {
+ if ($like->objectUserID) {
if (!isset($itemsToUser[$like->objectUserID])) {
$itemsToUser[$like->objectUserID] = 0;
}
if (!isset($likeObjectData[$like->objectTypeID][$like->objectID])) {
$likeObjectData[$like->objectTypeID][$like->objectID] = [
'likes' => 0,
- 'dislikes' => 0,
- 'neutralReactions' => 0,
'cumulativeLikes' => 0,
'objectUserID' => $like->objectUserID,
'cachedReactions' => []
];
}
- if ($like->isLike()) {
- $likeObjectData[$like->objectTypeID][$like->objectID]['likes']++;
- }
- else if ($like->isDislike()) {
- $likeObjectData[$like->objectTypeID][$like->objectID]['dislikes']++;
- }
- else {
- $likeObjectData[$like->objectTypeID][$like->objectID]['neutralReactions']++;
- }
- $likeObjectData[$like->objectTypeID][$like->objectID]['cumulativeLikes'] += $like->likeValue;
+ $likeObjectData[$like->objectTypeID][$like->objectID]['likes']++;
+ $likeObjectData[$like->objectTypeID][$like->objectID]['cumulativeLikes']++;
if (!isset($likeObjectData[$like->objectTypeID][$like->objectID]['cachedReactions'][$like->getReactionType()->reactionTypeID])) {
$likeObjectData[$like->objectTypeID][$like->objectID]['cachedReactions'][$like->getReactionType()->reactionTypeID] = 0;
UserActivityPointHandler::getInstance()->fireEvents('com.woltlab.wcf.like.activityPointEvent.receivedLikes', $itemsToUser, false);
$sql = "INSERT INTO wcf".WCF_N."_like_object
- (objectTypeID, objectID, objectUserID, likes, dislikes, neutralReactions, cumulativeLikes, cachedReactions)
- VALUES (?, ?, ?, ?, ?, ?, ?, ?)
+ (objectTypeID, objectID, objectUserID, likes, dislikes, cumulativeLikes, cachedReactions)
+ VALUES (?, ?, ?, ?, ?, ?, ?)
ON DUPLICATE KEY UPDATE likes = likes + VALUES(likes),
- dislikes = dislikes + VALUES(dislikes),
- neutralReactions = neutralReactions + VALUES(neutralReactions),
cumulativeLikes = cumulativeLikes + VALUES(cumulativeLikes),
cachedReactions = VALUES(cachedReactions)";
$statement = WCF::getDB()->prepareStatement($sql);
$objectID,
$data['objectUserID'],
$data['likes'],
- $data['dislikes'],
- $data['neutralReactions'],
$data['cumulativeLikes'],
serialize($data['cachedReactions'])
]);
// update like counter
if (MODULE_LIKE) {
- $positiveReactionTypes = $negativeReactionTypes = $neutralReactionTypes = [];
-
- foreach (ReactionTypeCache::getInstance()->getEnabledReactionTypes() as $reactionType) {
- switch ($reactionType->type) {
- case ReactionType::REACTION_TYPE_POSITIVE:
- $positiveReactionTypes[] = $reactionType->reactionTypeID;
- break;
-
- case ReactionType::REACTION_TYPE_NEGATIVE:
- $negativeReactionTypes[] = $reactionType->reactionTypeID;
- break;
-
- case ReactionType::REACTION_TYPE_NEUTRAL:
- $neutralReactionTypes[] = $reactionType->reactionTypeID;
- break;
-
- default:
- throw new \LogicException('Unreachable');
- }
- }
-
$sql = "UPDATE wcf".WCF_N."_user user_table SET";
-
- if (!empty($positiveReactionTypes)) {
+
+ $reactionTypeIDs = array_keys(ReactionTypeCache::getInstance()->getEnabledReactionTypes());
+ if (!empty($reactionTypeIDs)) {
$sql .= " likesReceived = (
SELECT COUNT(*)
FROM wcf".WCF_N."_like
WHERE objectUserID = user_table.userID
- AND reactionTypeID IN (". implode(',', $positiveReactionTypes) .")
- ), positiveReactionsReceived = (
- SELECT COUNT(*)
- FROM wcf".WCF_N."_like
- WHERE objectUserID = user_table.userID
- AND reactionTypeID IN (". implode(',', $positiveReactionTypes) ."))";
+ AND reactionTypeID IN (". implode(',', $reactionTypeIDs) .")
+ )";
}
else {
- $sql .= " likesReceived = 0, positiveReactionsReceived = 0";
+ $sql .= " likesReceived = 0";
}
- if (!empty($negativeReactionTypes)) {
- $sql .= ", negativeReactionsReceived = (
- SELECT COUNT(*)
- FROM wcf".WCF_N."_like
- WHERE objectUserID = user_table.userID
- AND reactionTypeID IN (". implode(',', $negativeReactionTypes) ."))";
- }
- else {
- $sql .= ", negativeReactionsReceived = 0";
- }
-
- if (!empty($neutralReactionTypes)) {
- $sql .= ", neutralReactionsReceived = (
- SELECT COUNT(*)
- FROM wcf".WCF_N."_like
- WHERE objectUserID = user_table.userID
- AND reactionTypeID IN (". implode(',', $neutralReactionTypes) ."))";
- }
- else {
- $sql .= ", neutralReactionsReceived = 0";
- }
-
$sql .= " ".$conditionBuilder;
$statement = WCF::getDB()->prepareStatement($sql);
$statement->execute($conditionBuilder->getParameters());
<category name="wcf.acp.reactionType">
<item name="wcf.acp.reactionType.delete.confirmMessage"><![CDATA[{if LANGUAGE_USE_INFORMAL_VARIANT}Willst du{else}Wollen Sie{/if} den Reaktions-Typen <span class="confirmationObject">{$reactionType->getTitle()}</span> wirklich löschen?]]></item>
<item name="wcf.acp.reactionType.type"><![CDATA[Reaktions-Typ]]></item>
- <item name="wcf.acp.reactionType.type.positive"><![CDATA[Positiv]]></item>
- <item name="wcf.acp.reactionType.type.negative"><![CDATA[Negativ]]></item>
- <item name="wcf.acp.reactionType.type.neutral"><![CDATA[Neutral]]></item>
<item name="wcf.acp.reactionType.isDisabled"><![CDATA[Reaktion deaktivieren]]></item>
<item name="wcf.acp.reactionType.image"><![CDATA[Reaktions-Datei]]></item>
<item name="wcf.acp.reactionType.showOrder.description"><![CDATA[Der Reaktions-Typ wird nach dem ausgewählten Reaktions-Typ angezeigt.]]></item>
<item name="wcf.user.condition.notUserTrophyIDs.description"><![CDATA[Benutzer dürfen keine der ausgewählten Trophäen erhalten haben.]]></item>
<item name="wcf.user.condition.notUserTrophyIDs.error.userTrophyIntersection"><![CDATA[Die ausgewählten Trophäen in „hat Trophäe“ und „hat nicht Trophäe“ sind widersprüchlich.]]></item>
<item name="wcf.user.condition.trophyPoints"><![CDATA[Trophäen]]></item>
- <item name="wcf.user.condition.positiveReactionsReceived"><![CDATA[Positive Reaktionen]]></item>
- <item name="wcf.user.condition.negativeReactionsReceived"><![CDATA[Negative Reaktionen]]></item>
- <item name="wcf.user.condition.neutralReactionsReceived"><![CDATA[Neutrale Reaktionen]]></item>
<item name="wcf.user.condition.userReputation"><![CDATA[Reputation aus Reaktionen]]></item>
</category>
<category name="wcf.user.coverPhoto">
<category name="wcf.acp.reactionType">
<item name="wcf.acp.reactionType.delete.confirmMessage"><![CDATA[Do you really want to delete the reaction type <span class="confirmationObject">{$reactionType->getTitle()}</span>?]]></item>
<item name="wcf.acp.reactionType.type"><![CDATA[Reaction Type]]></item>
- <item name="wcf.acp.reactionType.type.positive"><![CDATA[Positiv]]></item>
- <item name="wcf.acp.reactionType.type.negative"><![CDATA[Negativ]]></item>
- <item name="wcf.acp.reactionType.type.neutral"><![CDATA[Neutral]]></item>
<item name="wcf.acp.reactionType.isDisabled"><![CDATA[Disable Reaction]]></item>
<item name="wcf.acp.reactionType.image"><![CDATA[Reaction File]]></item>
<item name="wcf.acp.reactionType.showOrder.description"><![CDATA[The reaction type will be shown after the selected reaction type.]]></item>
<item name="wcf.user.condition.notUserTrophyIDs.description"><![CDATA[User has not received the selected trophies.]]></item>
<item name="wcf.user.condition.notUserTrophyIDs.error.userTrophyIntersection"><![CDATA[The selected trophies in “User has Trophy” and “User does not have Trophy” are conflicting.]]></item>
<item name="wcf.user.condition.trophyPoints"><![CDATA[Trophies]]></item>
- <item name="wcf.user.condition.positiveReactionsReceived"><![CDATA[Positive Reactions]]></item>
- <item name="wcf.user.condition.negativeReactionsReceived"><![CDATA[Negative Reactions]]></item>
- <item name="wcf.user.condition.neutralReactionsReceived"><![CDATA[Neutral Reactions]]></item>
<item name="wcf.user.condition.userReputation"><![CDATA[Reputation from Reactions]]></item>
</category>
<category name="wcf.user.coverPhoto">
objectUserID INT(10),
likes MEDIUMINT(7) NOT NULL DEFAULT 0,
dislikes MEDIUMINT(7) NOT NULL DEFAULT 0,
- neutralReactions MEDIUMINT(7) NOT NULL DEFAULT 0,
cumulativeLikes MEDIUMINT(7) NOT NULL DEFAULT 0,
cachedUsers TEXT,
cachedReactions TEXT,
CREATE TABLE wcf1_reaction_type (
reactionTypeID INT(10) NOT NULL AUTO_INCREMENT PRIMARY KEY,
title VARCHAR(255),
- type TINYINT(1),
showOrder INT(10) NOT NULL DEFAULT 0,
iconFile MEDIUMTEXT,
isDisabled TINYINT(1) NOT NULL DEFAULT 0
disableCoverPhotoReason TEXT,
disableCoverPhotoExpires INT(10) NOT NULL DEFAULT 0,
articles INT(10) NOT NULL DEFAULT 0,
- positiveReactionsReceived INT(10) NOT NULL DEFAULT 0,
- negativeReactionsReceived INT(10) NOT NULL DEFAULT 0,
- neutralReactionsReceived INT(10) NOT NULL DEFAULT 0,
blacklistMatches VARCHAR(255) NOT NULL DEFAULT '',
KEY username (username),
KEY registrationData (registrationIpAddress, registrationDate),
KEY activityPoints (activityPoints),
KEY likesReceived (likesReceived),
- KEY positiveReactionsReceived (positiveReactionsReceived),
- KEY negativeReactionsReceived (negativeReactionsReceived),
- KEY neutralReactionsReceived (neutralReactionsReceived),
KEY authData (authData),
KEY trophyPoints (trophyPoints)
);
INSERT INTO wcf1_contact_recipient (recipientID, name, email, isAdministrator, originIsSystem) VALUES (1, 'wcf.contact.recipient.name1', '', 1, 1);
-- default reaction type
-INSERT INTO wcf1_reaction_type (title, type, showOrder, iconFile) VALUES ('wcf.reactionType.title1', 1, 1, 'like.svg');
-INSERT INTO wcf1_reaction_type (title, type, showOrder, iconFile) VALUES ('wcf.reactionType.title2', 1, 2, 'haha.svg');
-INSERT INTO wcf1_reaction_type (title, type, showOrder, iconFile) VALUES ('wcf.reactionType.title3', -1, 3, 'sad.svg');
-INSERT INTO wcf1_reaction_type (title, type, showOrder, iconFile) VALUES ('wcf.reactionType.title4', 0, 4, 'confused.svg');
-INSERT INTO wcf1_reaction_type (title, type, showOrder, iconFile) VALUES ('wcf.reactionType.title5', 1, 5, 'thanks.svg');
+INSERT INTO wcf1_reaction_type (title, showOrder, iconFile) VALUES ('wcf.reactionType.title1', 1, 'like.svg');
+INSERT INTO wcf1_reaction_type (title, showOrder, iconFile) VALUES ('wcf.reactionType.title2', 2, 'haha.svg');
+INSERT INTO wcf1_reaction_type (title, showOrder, iconFile) VALUES ('wcf.reactionType.title3', 3, 'sad.svg');
+INSERT INTO wcf1_reaction_type (title, showOrder, iconFile) VALUES ('wcf.reactionType.title4', 4, 'confused.svg');
+INSERT INTO wcf1_reaction_type (title, showOrder, iconFile) VALUES ('wcf.reactionType.title5', 5, 'thanks.svg');