From 4afaca12dc55b076293e9ef8ac28332d22730df0 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Sat, 14 Oct 2006 14:56:46 +0000 Subject: - store sql_layer directly within the layer itself - new method sql_multi_insert to circumvent db-specific hacks (hopefully not introduced any parsing errors) git-svn-id: file:///svn/phpbb/trunk@6497 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/develop/fill.php | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) (limited to 'phpBB/develop/fill.php') diff --git a/phpBB/develop/fill.php b/phpBB/develop/fill.php index 3d01b2478e..2aee3d333f 100644 --- a/phpBB/develop/fill.php +++ b/phpBB/develop/fill.php @@ -12,7 +12,7 @@ // ------------------------------------------------------------- define('IN_PHPBB', true); -$phpbb_root_path = './'; +$phpbb_root_path = './../'; $phpEx = substr(strrchr(__FILE__, '.'), 1); include($phpbb_root_path . 'common.'.$phpEx); include($phpbb_root_path . 'includes/functions_admin.'.$phpEx); @@ -22,13 +22,13 @@ header('Expires: 0'); ignore_user_abort(true); // number of topics to create -$num_topics = 5000000; +$num_topics = 10000; // number of topics to be generated per call -$batch_size = 100000; +$batch_size = 2000; // max number of posts per topic -$posts_per_topic = 500000; +$posts_per_topic = 500; // general vars @@ -40,7 +40,7 @@ switch ($mode) case 'generate': $user_ids = $forum_ids = $topic_rows = array(); - $sql = 'SELECT user_id FROM ' . USERS_TABLE; + $sql = 'SELECT user_id FROM ' . USERS_TABLE . ' WHERE user_type IN (' . USER_NORMAL . ', ' . USER_FOUNDER . ') OR user_id = ' . ANONYMOUS; $result = $db->sql_query($sql); while ($row = $db->sql_fetchrow($result)) { @@ -60,7 +60,7 @@ switch ($mode) { $db->sql_query('TRUNCATE TABLE ' . POSTS_TABLE); $db->sql_query('TRUNCATE TABLE ' . TOPICS_TABLE); - $db->sql_query('TRUNCATE TABLE ' . TOPICS_TABLE . '_prefetch'); +// $db->sql_query('TRUNCATE TABLE ' . TOPICS_TABLE . '_prefetch'); } $db->sql_query('LOCK TABLES ' . POSTS_TABLE . ' WRITE, ' . TOPICS_TABLE . ' WRITE'); @@ -86,7 +86,7 @@ switch ($mode) $rows = array(); $post_time = mt_rand(0, time()); - $num_posts = mt_rand(1, $posts_per_topic); + $num_posts = $posts_per_topic; //mt_rand(1, $posts_per_topic); for ($i = 0; $i < $num_posts; ++$i) { $poster_id = $user_ids[array_rand($user_ids)]; @@ -108,18 +108,20 @@ switch ($mode) if ($topic_id >= $num_topics) { - echo 'And now for something completely different...'; + echo 'And now for something completely different...'; $db->sql_query('ANALYZE TABLES ' . TOPICS_TABLE . ', ' . POSTS_TABLE); + flush(); } else { - echo 'To the next page... (' . $topic_id . '/' . $num_topics . ')'; + echo 'To the next page... (' . $topic_id . '/' . $num_topics . ')'; + flush(); } break; case 'sync': - error_reporting(E_ALL); +/* error_reporting(E_ALL); $sync_all = TRUE; if ($sync_all) @@ -158,8 +160,11 @@ switch ($mode) { trigger_error('Done'); } + */ } +$db->sql_close(); + function rndm_username() { static $usernames; -- cgit v1.2.1