XF 1.1 [vb3.8] Do not import Threads older then XXX days

FloV

Well-known member
Hey,

just a small question. Is it possible to import only threads that were created in last XXX days?

I don't want to import > 6 Million posts everytime i have to test something out. Maybe i can set an option (even a filechange would be ok for me) to give this setting to the importer?

Thanks in advance for your help

Florian
 
I'm importing from a daily copy from a live site and i don't want to "touch" that backup and delete all the older threads every time.

I thought there was an easy way to do it, damn!

But thanks anyway.
 
Not tested but...

library/XenForo/Importer/vBulletin.php

Add the red code:

Rich (BB code):
	public function stepThreads($start, array $options)
	{
		$options = array_merge(array(
			'limit' => 100,
			'postDateStart' => 0,
			'postLimit' => 800,
			'max' => false
		), $options);

		$sDb = $this->_sourceDb;
		$prefix = $this->_prefix;

		/* @var $model XenForo_Model_Import */
		$model = $this->_importModel;

		if ($options['max'] === false)
		{
			$options['max'] = $sDb->fetchOne('
				SELECT MAX(threadid)
				FROM ' . $prefix . 'thread
			');
		}

		// pull threads from things we actually imported as forums
		$threads = $sDb->fetchAll($sDb->limit(
			'
				SELECT thread.*,
					IF(user.username IS NULL, thread.postusername, user.username) AS postusername
				FROM ' . $prefix . 'thread AS thread FORCE INDEX (PRIMARY)
				LEFT JOIN ' . $prefix . 'user AS user ON (thread.postuserid = user.userid)
				INNER JOIN ' . $prefix . 'forum AS forum ON
					(thread.forumid = forum.forumid AND forum.link = \'\' AND forum.options & 4)
				WHERE thread.threadid >= ' . $sDb->quote($start) . '
					AND thread.open <> 10
					AND thread.dateline > UNIX_TIMESTAMP('2012-01-15 00:00:00')
				ORDER BY thread.threadid
			', $options['limit']
		));
		if (!$threads)
		{
			return true;
		}
 
Top Bottom