ulrikkold

Bugfix for ratings extension in TYPO3

Nov 15th, 2011
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.86 KB | None | 0 0
  1. // There seems to be a problem with the ratings extension in TYPO3
  2. // (http://typo3.org/extensions/repository/view/ratings/current/)
  3. //
  4. // The existing code tries to the DBAL-enabled method exec_UPDATEquery to update the table
  5. // but it would appear that this method does not like "column+1" values in the updateFields array.
  6. // Therefore I replaced a couple of lines in method updateRating():
  7.  
  8.  
  9. // line ~142-147:
  10. $GLOBALS['TYPO3_DB']->exec_UPDATEquery('tx_ratings_data', $dataWhere,
  11.     array(
  12.         'vote_count' => 'vote_count+1',
  13.         'rating' => 'rating+' . intval($this->rating),
  14.         'tstamp' => time(),
  15.     ), 'vote_count,rating');
  16.  
  17. // replace with the following code:
  18. $updateSql = 'UPDATE tx_ratings_data SET vote_count = vote_count+1, rating=rating+' . $this->rating . ', tstamp =' .time() . " WHERE " . $dataWhere;
  19. $GLOBALS['TYPO3_DB']->sql_query($updateSql);
Advertisement
Add Comment
Please, Sign In to add comment