Jump to content
DevFuse Forums

Update forum last info


Adriano

Recommended Posts

Hi guys!

 

I'm using:

 

		if ( $this->topic['topic_move_time'] <= time() )
	{
		$this->DB->update( 'topics', array( 'forum_id' => $this->topic['topic_move_forum'] ), 'tid = '.$this->topic['tid'], true );

		require_once( IPSLib::getAppDir('forums') . '/sources/classes/moderate.php' );
		$moderatorLibrary	= new moderatorLibrary( $this->registry );

		$moderatorLibrary->rebuildTopic( $this->topic['tid'], false );
		$moderatorLibrary->forumRecount( $this->topic['forum_id'] );
		$moderatorLibrary->forumRecount( $this->topic['topic_move_forum'] );
		$moderatorLibrary->statsRecount();

		$this->DB->update( 'topics ', array( 'topic_move_time' => 0 ), 'tid = '.$this->topic['tid'], true );
	}

It's working. A topic is 'moved' to another forum in specif time.

 

The only problem is that the source forum keeps showing last post info of that topic, which is in other forum now.

 

SOS-1270690725-U1.png

 

The topic now is inside 'New Forum'. But it shows on last info of 'A Test Forum'. When I go to 'A Test Forum', the topic it's not there:

 

SOS-1270690803-U1.png

 

 

StatsRecount:

 

 /**
* Recount total topics and replies for site statistics
*
* @access	public
* @return	boolean
*/
public function statsRecount()
{
	$this->cache->rebuildCache( 'stats', 'global' );

	return true;
}

For its definition, it won't update forum cache.

 

When you empty a forum on Admin CP, it updates the cache. They use:

 

 	//-----------------------------------------
	// Rebuild forum cache
	//-----------------------------------------

	$this->recacheForums();

But this function is uselless:

 

	/**
* Recache the forums
*
* @access	public
* @return	void
* @deprecated	We're moving away from forum cache
**/	
public function recacheForums()
{
	//$this->registry->class_forums->updateForumCache(); 	
}

:huh:

 

How to update that cache/last post info properly, since what I'm doing seems not to work ?

 

:huh:

Link to comment
Share on other sites

  • Management

The statsRecount function should only be rebuilding the total posts/topics that appear on the board index. It won't touch the last post info. The forumRecount function should be sufficient. Without seeing your entire code, I can only assume the forumRecount is not getting the forum ids to rebuild. Perhaps you can add a print test line in the forumRecount function to make sure it's getting the correct forum ids.

Link to comment
Share on other sites

Geez, you're right! After update, those two values has the same value:

 

 $moderatorLibrary->forumRecount( $this->topic['forum_id'] );
$moderatorLibrary->forumRecount( $this->topic['topic_move_forum'] );

Tks, solved!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...