Agora_Driver::moveThread PHP Method

moveThread() public method

Moves a thread to another forum.
public moveThread ( integer $thread_id, integer $forum_id )
$thread_id integer The ID of the thread to move.
$forum_id integer The ID of the destination forum.
    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;
    }