Example #1
0
 /**
  * Overridding parent function to add search index updates
  *
  * @param	boolean	Do the query?
  * @param	mixed	Whether to run the query now; see db_update() for more info
  * @param bool 	Whether to return the number of affected rows.
  * @param bool		Perform REPLACE INTO instead of INSERT
  * @param bool		Perfrom INSERT IGNORE instead of INSERT
  *
  * @return	mixed	If this was an INSERT query, the INSERT ID is returned
  */
 function save($doquery = true, $delayed = false, $affected_rows = false, $replace = false, $ignore = false)
 {
     // Call and get the new id
     $result = parent::save($doquery, $delayed, $affected_rows, $replace, $ignore);
     if ($result and ($this->post['postid'] or $this->existing['postid'])) {
         // Search index maintenance. Use the new cron'd processing;
         require_once DIR . '/vb/search/indexcontroller/queue.php';
         $msgid = intval($this->existing['postid']) > 0 ? $this->existing['postid'] : $this->post['postid'];
         vb_Search_Indexcontroller_Queue::indexQueue('vBForum', 'Post', 'index', $msgid);
     }
     return $result;
 }
Example #2
0
	/**
	 * Overridding parent function to add search index updates
	 *
	* @param	boolean	Do the query?
	* @param	mixed	Whether to run the query now; see db_update() for more info
	* @param bool 	Whether to return the number of affected rows.
	* @param bool		Perform REPLACE INTO instead of INSERT
	8 @param bool		Perfrom INSERT IGNORE instead of INSERT
	*
	* @return	mixed	If this was an INSERT query, the INSERT ID is returned
	*/
	function save($doquery = true, $delayed = false, $affected_rows = false, $replace = false, $ignore = false)
	{
		global $vbulletin;
		
		// Call and get the new id
		$result = parent::save($doquery, $delayed, $affected_rows, $replace, $ignore);

		if ($result AND ($this->post['postid'] OR $this->existing['postid']))
		{
			// If result is the number (opposed to just TRUE) then use that, or which ever of the others is a number
			$do = (is_bool($result) == true ? (is_numeric($this->existing['postid']) == true ? $this->existing['postid'] : $this->existing['postid']) : $result);

			// Search index maintenance. Use the new cron'd processing;
			require_once DIR  . '/vb/search/indexcontroller/queue.php' ;
			$msgid = intval($this->existing['postid']) > 0 ? $this->existing['postid'] : $this->post['postid'];
			$foruminfo = $this->info['forum'];
			
			// if post was in cms comment forum, index as a cms comment rather than thread post
			if (isset($vbulletin->options['vbcmsforumid']) AND $foruminfo['forumid'] == $vbulletin->options['vbcmsforumid'])
			{
				vb_Search_Indexcontroller_Queue::indexQueue('vBCms', 'CmsComment', 'index', $msgid);
			}
			else
			{
				vb_Search_Indexcontroller_Queue::indexQueue('vBForum', 'Post', 'index', $msgid);
			}
		}

		return $result;
	}