Skip to content

Commit

Permalink
Only increment counters if we actually tagged the item.
Browse files Browse the repository at this point in the history
Related to Bug: 14112
  • Loading branch information
mrubinsk committed Sep 16, 2015
1 parent 1b3e4ed commit 26c3700
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions content/lib/Tagger.php
Expand Up @@ -117,16 +117,16 @@ public function tag($userId, $objectId, $tags, Horde_Date $created = null)
} catch (Horde_Db_Exception $e) {
throw new Content_Exception($e);
}
}

// increment tag stats
if (!$this->_db->update('UPDATE ' . $this->_t('tag_stats') . ' SET count = count + 1 WHERE tag_id = ' . (int)$tagId)) {
$this->_db->insert('INSERT INTO ' . $this->_t('tag_stats') . ' (tag_id, count) VALUES (' . (int)$tagId . ', 1)', null, null, 'tag_id', $tagId);
}
// increment tag stats
if (!$this->_db->update('UPDATE ' . $this->_t('tag_stats') . ' SET count = count + 1 WHERE tag_id = ' . (int)$tagId)) {
$this->_db->insert('INSERT INTO ' . $this->_t('tag_stats') . ' (tag_id, count) VALUES (' . (int)$tagId . ', 1)', null, null, 'tag_id', $tagId);
}

// increment user-tag stats
if (!$this->_db->update('UPDATE ' . $this->_t('user_tag_stats') . ' SET count = count + 1 WHERE user_id = ' . (int)$userId . ' AND tag_id = ' . (int)$tagId)) {
$this->_db->insert('INSERT INTO ' . $this->_t('user_tag_stats') . ' (user_id, tag_id, count) VALUES (' . (int)$userId . ', ' . (int)$tagId . ', 1)');
// increment user-tag stats
if (!$this->_db->update('UPDATE ' . $this->_t('user_tag_stats') . ' SET count = count + 1 WHERE user_id = ' . (int)$userId . ' AND tag_id = ' . (int)$tagId)) {
$this->_db->insert('INSERT INTO ' . $this->_t('user_tag_stats') . ' (user_id, tag_id, count) VALUES (' . (int)$userId . ', ' . (int)$tagId . ', 1)');
}
}
}
}
Expand Down

0 comments on commit 26c3700

Please sign in to comment.