[BETA] Viewforum No Query Join

A place for MOD Authors to post and receive feedback on MODs still in development. No MODs within this forum should be used within a live environment! No new topics are allowed in this forum.
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

IMPORTANT: MOD Development Forum rules

On February 1, 2009 this forum will be set to read only as part of retiring of phpBB2.
User avatar
Dog Cow
Registered User
Posts: 2476
Joined: Fri Jan 28, 2005 12:14 am

Re: [BETA] Viewforum No Query Join

Post by Dog Cow » Tue Jan 29, 2008 10:06 pm

JLA wrote:So lets see if we have an understanding of this.

Big question here - with a forum containing over 11.7 million posts - can this topic update script be a problem? How long should it take to run and what is built in incase it is interrupted?
You understand correctly.

The problem is the update script. The posts don't really matter, but how many topics do you have?
It's just a PHP script that runs through all of your topics, but I can't know ho long it will take without knowing how many topics your forum has.
Moof!
Mac GUI Vault: Retro Apple II & Macintosh computing archive.
Inside Allerton bookLincoln's Tomb at Oak Ridge Cemetery, Springfield

User avatar
JLA
Registered User
Posts: 458
Joined: Tue Nov 16, 2004 5:23 pm
Location: USA
Name: JLA FORUMS
Contact:

Re: [BETA] Viewforum No Query Join

Post by JLA » Tue Jan 29, 2008 10:19 pm

Dog Cow wrote:
JLA wrote:So lets see if we have an understanding of this.

Big question here - with a forum containing over 11.7 million posts - can this topic update script be a problem? How long should it take to run and what is built in incase it is interrupted?
You understand correctly.

The problem is the update script. The posts don't really matter, but how many topics do you have?
It's just a PHP script that runs through all of your topics, but I can't know ho long it will take without knowing how many topics your forum has.

Topics - 2,962,089
Posts - 11 million plus

User avatar
Dog Cow
Registered User
Posts: 2476
Joined: Fri Jan 28, 2005 12:14 am

Re: [BETA] Viewforum No Query Join

Post by Dog Cow » Wed Jan 30, 2008 10:27 pm

JLA wrote: Topics - 2,962,089
Posts - 11 million plus
My advice: don't start indexing your topics with my updater script if you have things that need to get done in your life. Meaning: allot a few hours on a weekend or during some other free time you have.
Moof!
Mac GUI Vault: Retro Apple II & Macintosh computing archive.
Inside Allerton bookLincoln's Tomb at Oak Ridge Cemetery, Springfield

User avatar
JLA
Registered User
Posts: 458
Joined: Tue Nov 16, 2004 5:23 pm
Location: USA
Name: JLA FORUMS
Contact:

Re: [BETA] Viewforum No Query Join

Post by JLA » Wed Jan 30, 2008 10:44 pm

Dog Cow wrote:
JLA wrote: Topics - 2,962,089
Posts - 11 million plus
My advice: don't start indexing your topics with my updater script if you have things that need to get done in your life. Meaning: allot a few hours on a weekend or during some other free time you have.
Thanks - took a more indepth look at your mod and it seems it will work fine for us and yes - getting rid of the join will be great.

The indexing shouldn't be too bad - we have some good ram/cpu to put into it. Need to rewrite one of our mods though to deal with post insertions that will allow compatibility with this. It has been put on the development schedule.

Tried of the topics table for a few days. We lost it the other night (due to a DOH!! by an underling) and fortunately due to good backups and some good duplication of data in phpbb between the posts, post text, attachments and vote tables along with a couple other mod tables - we were able to get it back within a couple hours.

Will let you know how it turns out with our testing of your code

User avatar
JLA
Registered User
Posts: 458
Joined: Tue Nov 16, 2004 5:23 pm
Location: USA
Name: JLA FORUMS
Contact:

Re: [BETA] Viewforum No Query Join

Post by JLA » Sat Oct 11, 2008 1:10 am

Well we have finally adapted all of our mods to your code and are now testing your update script. We have received the following error to report

Could not obtain topic information

DEBUG MODE

SQL Error : 2008 MySQL client run out of memory

SELECT t.*, u.username, u.user_id, u2.username as user2, u2.user_id as id2, p.post_username, p2.post_username AS post_username2, p2.post_time FROM phpbb_topics t, phpbb_users u, phpbb_posts p, phpbb_posts p2, phpbb_users u2 WHERE t.topic_poster = u.user_id AND p.post_id = t.topic_first_post_id AND p2.post_id = t.topic_last_post_id AND u2.user_id = p2.poster_id ORDER BY t.topic_id ASC

Line : 33
File : updatescript.php

Have a feeling this has to do with the HUGE number of topics and post (over 16 million posts now)

Please advise

User avatar
Dog Cow
Registered User
Posts: 2476
Joined: Fri Jan 28, 2005 12:14 am

Re: [BETA] Viewforum No Query Join

Post by Dog Cow » Sun Oct 12, 2008 9:49 pm

JLA wrote:Well we have finally adapted all of our mods to your code and are now testing your update script. We have received the following error to report

Could not obtain topic information

....

Have a feeling this has to do with the HUGE number of topics and post (over 16 million posts now)

Please advise
Yes, that is correct. Here is an altered version of topic_update.php. Just paste the code into a new file.
This is set to do 500 topics per round. To make this higher, like perhaps 5,000 topics per round, there are two 500s which need to be changed, one in the query, and then one near the end of the file.

If you want automatic refreshing, then alter the die() statement to add a meta http refresh tag, that way you can leave this alone and won't have to click each round.

Completely un-tested too, this one is... :o

Code: Select all

<?php
define('IN_PHPBB', true);
$phpbb_root_path = './';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
include($phpbb_root_path . 'includes/functions_admin.'.$phpEx);

//
// Start session management
//
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);
//
// End session management
//

echo('<html><head><title>Topic Updater - v1.1</title></head><body>Hello. This script is going to update your topics table so that the existing topics show the correct data.<br /><br /><a href="topic_update.php?mode=start&start=0">Please click here to start.</a>');

if ( isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']) )
{
	echo('<br /><br />Starting up....<br />');

if(!$start = intval($HTTP_GET_VARS['start']))
{
      $start = 0;
}

	$total_topics = get_db_stat('topics');
	echo('Total topics: ' . number_format($total_topics) . '<br /><br />');

	if ($start < $total_topics)
	{

		$sql = "SELECT t.*, u.username, u.user_id, u2.username as user2, u2.user_id as id2, p.post_username, p2.post_username AS post_username2, p2.post_time 
		FROM " . TOPICS_TABLE . " t, " . USERS_TABLE . " u, " . POSTS_TABLE . " p, " . POSTS_TABLE . " p2, " . USERS_TABLE . " u2
		WHERE t.topic_poster = u.user_id
			AND p.post_id = t.topic_first_post_id
			AND p2.post_id = t.topic_last_post_id
			AND u2.user_id = p2.poster_id
		ORDER BY t.topic_id ASC LIMIT " . $start . ', 500';

	if ( !($result = $db->sql_query($sql)) )
	{
  	 message_die(GENERAL_ERROR, 'Could not obtain topic information', '', __LINE__, __FILE__, $sql);
	}
	echo('<br />' . $sql . '<br /><br />Topics selected');

	$total_topics = 0;
	while( $row = $db->sql_fetchrow($result) )
	{
		$topic_rowset[] = $row;
		$total_topics++;
	}

	$db->sql_freeresult($result);

	if( $total_topics )
	{
		echo('<br /><br />Beginning loop<br />');
		for($i = 0; $i < $total_topics; $i++)
		{

			$topic_id = $topic_rowset[$i]['topic_id'];
			$topic_title =  $topic_rowset[$i]['topic_title'];


			$topic_first_poster_name= ( $topic_rowset[$i]['user_id'] != ANONYMOUS ) ? $topic_rowset[$i]['username'] : ( ( $topic_rowset[$i]['post_username'] != '' ) ? $topic_rowset[$i]['post_username'] : $lang['Guest'] );
			$topic_last_poster_id = $topic_rowset[$i]['id2'];

			$last_poster_name = ( $topic_rowset[$i]['id2'] == ANONYMOUS ) ? ( ($topic_rowset[$i]['post_username2'] != '' ) ? $topic_rowset[$i]['post_username2'] . ' ' : $lang['Guest'] . ' ' ) : $topic_rowset[$i]['user2'];

			$last_post_time = $topic_rowset[$i]['post_time'];

			echo('<br />TOPIC ID: ' . $topic_id . ' - ' . $topic_title);

			$sql = "UPDATE " . TOPICS_TABLE . "
			SET topic_first_poster_name = '$topic_first_poster_name', topic_last_poster_id = '$topic_last_poster_id', topic_last_poster_name = '$last_poster_name', topic_last_post_time = '$last_post_time'
			WHERE topic_id = $topic_id";



			if ( !($result = $db->sql_query($sql)) )
			{
  	 			message_die(GENERAL_ERROR, 'Could not UPDATE topic information', '', __LINE__, __FILE__, $sql);
			}

		}

	}
flush();
// Done with this loop, so go again
die('This loop is done. <a href="./topic_update.php?mode=start&start=' . $start + 500 . '" >Click here</a> to start the next round.<br />'); 

	}
	else
	{
	

	echo('<br /><br />Loop done!');
	echo('<br /><br />Re-synching topic & Forum data....');

	sync('all forums', $id = false);
	echo('<br />Forum sync done');

	sync('all topics', $id = false);
	echo('<br />Topic sync done');

	echo('<br /><br />EVERYTHING IS DONE!!! <a href="index.php" target="_blank">Check your forum</a> to make sure Dog Cow didn\'t screw up, then you can thank him!! :-)');
}}

echo('</body></html>');
//
// Close our DB connection.
//
$db->sql_close();

exit;
?>
Moof!
Mac GUI Vault: Retro Apple II & Macintosh computing archive.
Inside Allerton bookLincoln's Tomb at Oak Ridge Cemetery, Springfield

User avatar
JLA
Registered User
Posts: 458
Joined: Tue Nov 16, 2004 5:23 pm
Location: USA
Name: JLA FORUMS
Contact:

Re: [BETA] Viewforum No Query Join

Post by JLA » Mon Oct 13, 2008 8:29 pm

Thanks for this - will give it a try and report back
Dog Cow wrote:
JLA wrote:Well we have finally adapted all of our mods to your code and are now testing your update script. We have received the following error to report

Could not obtain topic information

....

Have a feeling this has to do with the HUGE number of topics and post (over 16 million posts now)

Please advise
Yes, that is correct. Here is an altered version of topic_update.php. Just paste the code into a new file.
This is set to do 500 topics per round. To make this higher, like perhaps 5,000 topics per round, there are two 500s which need to be changed, one in the query, and then one near the end of the file.

If you want automatic refreshing, then alter the die() statement to add a meta http refresh tag, that way you can leave this alone and won't have to click each round.

Completely un-tested too, this one is... :o

Code: Select all

<?php
define('IN_PHPBB', true);
$phpbb_root_path = './';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
include($phpbb_root_path . 'includes/functions_admin.'.$phpEx);

//
// Start session management
//
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);
//
// End session management
//

echo('<html><head><title>Topic Updater - v1.1</title></head><body>Hello. This script is going to update your topics table so that the existing topics show the correct data.<br /><br /><a href="topic_update.php?mode=start&start=0">Please click here to start.</a>');

if ( isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']) )
{
	echo('<br /><br />Starting up....<br />');

if(!$start = intval($HTTP_GET_VARS['start']))
{
      $start = 0;
}

	$total_topics = get_db_stat('topics');
	echo('Total topics: ' . number_format($total_topics) . '<br /><br />');

	if ($start < $total_topics)
	{

		$sql = "SELECT t.*, u.username, u.user_id, u2.username as user2, u2.user_id as id2, p.post_username, p2.post_username AS post_username2, p2.post_time 
		FROM " . TOPICS_TABLE . " t, " . USERS_TABLE . " u, " . POSTS_TABLE . " p, " . POSTS_TABLE . " p2, " . USERS_TABLE . " u2
		WHERE t.topic_poster = u.user_id
			AND p.post_id = t.topic_first_post_id
			AND p2.post_id = t.topic_last_post_id
			AND u2.user_id = p2.poster_id
		ORDER BY t.topic_id ASC LIMIT " . $start . ', 500';

	if ( !($result = $db->sql_query($sql)) )
	{
  	 message_die(GENERAL_ERROR, 'Could not obtain topic information', '', __LINE__, __FILE__, $sql);
	}
	echo('<br />' . $sql . '<br /><br />Topics selected');

	$total_topics = 0;
	while( $row = $db->sql_fetchrow($result) )
	{
		$topic_rowset[] = $row;
		$total_topics++;
	}

	$db->sql_freeresult($result);

	if( $total_topics )
	{
		echo('<br /><br />Beginning loop<br />');
		for($i = 0; $i < $total_topics; $i++)
		{

			$topic_id = $topic_rowset[$i]['topic_id'];
			$topic_title =  $topic_rowset[$i]['topic_title'];


			$topic_first_poster_name= ( $topic_rowset[$i]['user_id'] != ANONYMOUS ) ? $topic_rowset[$i]['username'] : ( ( $topic_rowset[$i]['post_username'] != '' ) ? $topic_rowset[$i]['post_username'] : $lang['Guest'] );
			$topic_last_poster_id = $topic_rowset[$i]['id2'];

			$last_poster_name = ( $topic_rowset[$i]['id2'] == ANONYMOUS ) ? ( ($topic_rowset[$i]['post_username2'] != '' ) ? $topic_rowset[$i]['post_username2'] . ' ' : $lang['Guest'] . ' ' ) : $topic_rowset[$i]['user2'];

			$last_post_time = $topic_rowset[$i]['post_time'];

			echo('<br />TOPIC ID: ' . $topic_id . ' - ' . $topic_title);

			$sql = "UPDATE " . TOPICS_TABLE . "
			SET topic_first_poster_name = '$topic_first_poster_name', topic_last_poster_id = '$topic_last_poster_id', topic_last_poster_name = '$last_poster_name', topic_last_post_time = '$last_post_time'
			WHERE topic_id = $topic_id";



			if ( !($result = $db->sql_query($sql)) )
			{
  	 			message_die(GENERAL_ERROR, 'Could not UPDATE topic information', '', __LINE__, __FILE__, $sql);
			}

		}

	}
flush();
// Done with this loop, so go again
die('This loop is done. <a href="./topic_update.php?mode=start&start=' . $start + 500 . '" >Click here</a> to start the next round.<br />'); 

	}
	else
	{
	

	echo('<br /><br />Loop done!');
	echo('<br /><br />Re-synching topic & Forum data....');

	sync('all forums', $id = false);
	echo('<br />Forum sync done');

	sync('all topics', $id = false);
	echo('<br />Topic sync done');

	echo('<br /><br />EVERYTHING IS DONE!!! <a href="index.php" target="_blank">Check your forum</a> to make sure Dog Cow didn\'t screw up, then you can thank him!! :-)');
}}

echo('</body></html>');
//
// Close our DB connection.
//
$db->sql_close();

exit;
?>

User avatar
JLA
Registered User
Posts: 458
Joined: Tue Nov 16, 2004 5:23 pm
Location: USA
Name: JLA FORUMS
Contact:

Re: [BETA] Viewforum No Query Join

Post by JLA » Mon Oct 13, 2008 9:28 pm

Well we tried out the script and apparently it is not working. Saw the 1st query running but no updates and nothing refreshed on the screen. Of course no error reported as well. Did a cursory check of the topics and nothing updated except all the new topics people have been posting since we implemented the new db fields and code changed in posting, etc.
JLA wrote:Thanks for this - will give it a try and report back
Dog Cow wrote:
JLA wrote:Well we have finally adapted all of our mods to your code and are now testing your update script. We have received the following error to report

Could not obtain topic information

....

Have a feeling this has to do with the HUGE number of topics and post (over 16 million posts now)

Please advise
Yes, that is correct. Here is an altered version of topic_update.php. Just paste the code into a new file.
This is set to do 500 topics per round. To make this higher, like perhaps 5,000 topics per round, there are two 500s which need to be changed, one in the query, and then one near the end of the file.

If you want automatic refreshing, then alter the die() statement to add a meta http refresh tag, that way you can leave this alone and won't have to click each round.

Completely un-tested too, this one is... :o

Code: Select all

<?php
define('IN_PHPBB', true);
$phpbb_root_path = './';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
include($phpbb_root_path . 'includes/functions_admin.'.$phpEx);

//
// Start session management
//
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);
//
// End session management
//

echo('<html><head><title>Topic Updater - v1.1</title></head><body>Hello. This script is going to update your topics table so that the existing topics show the correct data.<br /><br /><a href="topic_update.php?mode=start&start=0">Please click here to start.</a>');

if ( isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']) )
{
	echo('<br /><br />Starting up....<br />');

if(!$start = intval($HTTP_GET_VARS['start']))
{
      $start = 0;
}

	$total_topics = get_db_stat('topics');
	echo('Total topics: ' . number_format($total_topics) . '<br /><br />');

	if ($start < $total_topics)
	{

		$sql = "SELECT t.*, u.username, u.user_id, u2.username as user2, u2.user_id as id2, p.post_username, p2.post_username AS post_username2, p2.post_time 
		FROM " . TOPICS_TABLE . " t, " . USERS_TABLE . " u, " . POSTS_TABLE . " p, " . POSTS_TABLE . " p2, " . USERS_TABLE . " u2
		WHERE t.topic_poster = u.user_id
			AND p.post_id = t.topic_first_post_id
			AND p2.post_id = t.topic_last_post_id
			AND u2.user_id = p2.poster_id
		ORDER BY t.topic_id ASC LIMIT " . $start . ', 500';

	if ( !($result = $db->sql_query($sql)) )
	{
  	 message_die(GENERAL_ERROR, 'Could not obtain topic information', '', __LINE__, __FILE__, $sql);
	}
	echo('<br />' . $sql . '<br /><br />Topics selected');

	$total_topics = 0;
	while( $row = $db->sql_fetchrow($result) )
	{
		$topic_rowset[] = $row;
		$total_topics++;
	}

	$db->sql_freeresult($result);

	if( $total_topics )
	{
		echo('<br /><br />Beginning loop<br />');
		for($i = 0; $i < $total_topics; $i++)
		{

			$topic_id = $topic_rowset[$i]['topic_id'];
			$topic_title =  $topic_rowset[$i]['topic_title'];


			$topic_first_poster_name= ( $topic_rowset[$i]['user_id'] != ANONYMOUS ) ? $topic_rowset[$i]['username'] : ( ( $topic_rowset[$i]['post_username'] != '' ) ? $topic_rowset[$i]['post_username'] : $lang['Guest'] );
			$topic_last_poster_id = $topic_rowset[$i]['id2'];

			$last_poster_name = ( $topic_rowset[$i]['id2'] == ANONYMOUS ) ? ( ($topic_rowset[$i]['post_username2'] != '' ) ? $topic_rowset[$i]['post_username2'] . ' ' : $lang['Guest'] . ' ' ) : $topic_rowset[$i]['user2'];

			$last_post_time = $topic_rowset[$i]['post_time'];

			echo('<br />TOPIC ID: ' . $topic_id . ' - ' . $topic_title);

			$sql = "UPDATE " . TOPICS_TABLE . "
			SET topic_first_poster_name = '$topic_first_poster_name', topic_last_poster_id = '$topic_last_poster_id', topic_last_poster_name = '$last_poster_name', topic_last_post_time = '$last_post_time'
			WHERE topic_id = $topic_id";



			if ( !($result = $db->sql_query($sql)) )
			{
  	 			message_die(GENERAL_ERROR, 'Could not UPDATE topic information', '', __LINE__, __FILE__, $sql);
			}

		}

	}
flush();
// Done with this loop, so go again
die('This loop is done. <a href="./topic_update.php?mode=start&start=' . $start + 500 . '" >Click here</a> to start the next round.<br />'); 

	}
	else
	{
	

	echo('<br /><br />Loop done!');
	echo('<br /><br />Re-synching topic & Forum data....');

	sync('all forums', $id = false);
	echo('<br />Forum sync done');

	sync('all topics', $id = false);
	echo('<br />Topic sync done');

	echo('<br /><br />EVERYTHING IS DONE!!! <a href="index.php" target="_blank">Check your forum</a> to make sure Dog Cow didn\'t screw up, then you can thank him!! :-)');
}}

echo('</body></html>');
//
// Close our DB connection.
//
$db->sql_close();

exit;
?>

User avatar
Dog Cow
Registered User
Posts: 2476
Joined: Fri Jan 28, 2005 12:14 am

Re: [BETA] Viewforum No Query Join

Post by Dog Cow » Tue Oct 14, 2008 12:59 am

JLA wrote:Well we tried out the script and apparently it is not working. Saw the 1st query running but no updates and nothing refreshed on the screen. Of course no error reported as well. Did a cursory check of the topics and nothing updated except all the new topics people have been posting since we implemented the new db fields and code changed in posting, etc.
Is the code running live on your main site right now? I looked and it doesn't look like it.

Well, anyway, I see at least one error I made. There's a line in the code which is wrong. It's the

Code: Select all

$total_topics = get_db_stat('topics');
it should instead say

Code: Select all

$total_topics = get_db_stat('topiccount');
Or if you happen to know the exact total number of topics, you can just enter it in, instead of running that function. Now that I think about it, you probably should enter it in by hand, because if people are posting new topics, then this updater will run forever (or until they stop posting new topics).

As you said, it doesn't matter if people are posting new topics while this is running, because the altered phpBB posting code will handle them.
Moof!
Mac GUI Vault: Retro Apple II & Macintosh computing archive.
Inside Allerton bookLincoln's Tomb at Oak Ridge Cemetery, Springfield

User avatar
JLA
Registered User
Posts: 458
Joined: Tue Nov 16, 2004 5:23 pm
Location: USA
Name: JLA FORUMS
Contact:

Re: [BETA] Viewforum No Query Join

Post by JLA » Tue Oct 14, 2008 1:40 am

The only portion we have running is adding the data for all new posts made to the site. We will not add the view forum, etc until after the conversion.

Will try your suggestion and report back.


Dog Cow wrote:
JLA wrote:Well we tried out the script and apparently it is not working. Saw the 1st query running but no updates and nothing refreshed on the screen. Of course no error reported as well. Did a cursory check of the topics and nothing updated except all the new topics people have been posting since we implemented the new db fields and code changed in posting, etc.
Is the code running live on your main site right now? I looked and it doesn't look like it.

Well, anyway, I see at least one error I made. There's a line in the code which is wrong. It's the

Code: Select all

$total_topics = get_db_stat('topics');
it should instead say

Code: Select all

$total_topics = get_db_stat('topiccount');
Or if you happen to know the exact total number of topics, you can just enter it in, instead of running that function. Now that I think about it, you probably should enter it in by hand, because if people are posting new topics, then this updater will run forever (or until they stop posting new topics).

As you said, it doesn't matter if people are posting new topics while this is running, because the altered phpBB posting code will handle them.

User avatar
JLA
Registered User
Posts: 458
Joined: Tue Nov 16, 2004 5:23 pm
Location: USA
Name: JLA FORUMS
Contact:

Re: [BETA] Viewforum No Query Join

Post by JLA » Tue Oct 14, 2008 1:49 am

Ok, that seemed to work better. When getting to the end of the loop, apparently there is something wrong for the click here for next round. No link appears just text

User avatar
JLA
Registered User
Posts: 458
Joined: Tue Nov 16, 2004 5:23 pm
Location: USA
Name: JLA FORUMS
Contact:

Re: [BETA] Viewforum No Query Join

Post by JLA » Tue Oct 14, 2008 1:51 am

Also ran into one other error

Could not UPDATE topic information

DEBUG MODE

SQL Error : 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 's News', topic_last_poster_id = '-1', topic_last_poster_name = '

UPDATE phpbb_topics SET topic_first_poster_name = 'Rick's News', topic_last_poster_id = '-1', topic_last_poster_name = 'RicSeyler ', topic_last_post_time = '1109628012' WHERE topic_id = 1267

Line : 84

User avatar
Dog Cow
Registered User
Posts: 2476
Joined: Fri Jan 28, 2005 12:14 am

Re: [BETA] Viewforum No Query Join

Post by Dog Cow » Tue Oct 14, 2008 3:35 pm

Oh, some some bugger has a ' in his name. :?

So, just add slashes to the update query:

Code: Select all

         $sql = "UPDATE " . TOPICS_TABLE . "
         SET topic_first_poster_name = '" . addslashes($topic_first_poster_name) . "', topic_last_poster_id = '$topic_last_poster_id', topic_last_poster_name = '" . addslashes($last_poster_name) . "', topic_last_post_time = '$last_post_time'
         WHERE topic_id = $topic_id";
For the missing link, change that die() statement to this:

Code: Select all

die('This loop is done. <a href="./topic_update.php?mode=start&start=' . ($start + 500) . '">Click here</a> to start the next round.<br />'); 
Needed to have parentheses around the addition.
Moof!
Mac GUI Vault: Retro Apple II & Macintosh computing archive.
Inside Allerton bookLincoln's Tomb at Oak Ridge Cemetery, Springfield

User avatar
JLA
Registered User
Posts: 458
Joined: Tue Nov 16, 2004 5:23 pm
Location: USA
Name: JLA FORUMS
Contact:

Re: [BETA] Viewforum No Query Join

Post by JLA » Thu Oct 16, 2008 12:50 am

Dog Cow wrote:Oh, some some bugger has a ' in his name. :?

So, just add slashes to the update query:

Code: Select all

         $sql = "UPDATE " . TOPICS_TABLE . "
         SET topic_first_poster_name = '" . addslashes($topic_first_poster_name) . "', topic_last_poster_id = '$topic_last_poster_id', topic_last_poster_name = '" . addslashes($last_poster_name) . "', topic_last_post_time = '$last_post_time'
         WHERE topic_id = $topic_id";
For the missing link, change that die() statement to this:

Code: Select all

die('This loop is done. <a href="./topic_update.php?mode=start&start=' . ($start + 500) . '">Click here</a> to start the next round.<br />'); 
Needed to have parentheses around the addition.
Thanks for this - it appears to be working. We have adjusted the script to process 100,000 topics at a time and we are on the 300,000 bunch right now.

On another note, we had to go in and adjust all of our tables as we hit the big 16777215 (Yes 16.7 million) post limit day before yesterday. MedInt(8) sucks.

User avatar
Dog Cow
Registered User
Posts: 2476
Joined: Fri Jan 28, 2005 12:14 am

Re: [BETA] Viewforum No Query Join

Post by Dog Cow » Thu Oct 16, 2008 2:02 am

JLA wrote: On another note, we had to go in and adjust all of our tables as we hit the big 16777215 (Yes 16.7 million) post limit day before yesterday. MedInt(8) sucks.
Congrats, man! Good job. :D I hope this mod helps your forum.
Moof!
Mac GUI Vault: Retro Apple II & Macintosh computing archive.
Inside Allerton bookLincoln's Tomb at Oak Ridge Cemetery, Springfield

Post Reply

Return to “[2.0.x] MODs in Development”

Who is online

Users browsing this forum: No registered users and 3 guests