public function moveThread($thread_id, $forum_id)
{
$sql = 'SELECT forum_id FROM ' . $this->_threads_table . ' WHERE message_id = ?';
try {
$old_forum = $this->_db->selectValue($sql, array($thread_id));
} catch (Horde_Db_Exception $e) {
throw new Agora_Exception($e->getMessage());
}
$sql = 'UPDATE ' . $this->_threads_table . ' SET forum_id = ? WHERE message_thread = ? OR message_id = ?';
try {
$this->_db->execute($sql, array($forum_id, $thread_id, $thread_id));
} catch (Horde_Db_Exception $e) {
throw new Agora_Exception($e->getMessage());
}
$this->_forumSequence($old_forum, 'thread', '-');
$this->_forumSequence($forum_id, 'thread', '+');
/* Update last message */
$this->_lastInForum($old_forum);
$this->_lastInForum($forum_id);
/* Update cache */
$this->_updateCacheState($thread_id);
return true;
}