mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-31 22:10:45 +02:00
- 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
This commit is contained in:
@@ -371,7 +371,7 @@ function mass_auth($ug_type, $forum_id, $ug_id, $acl_list, $setting)
|
||||
switch ($sql_type)
|
||||
{
|
||||
case 'insert':
|
||||
switch (SQL_LAYER)
|
||||
switch ($db->sql_layer)
|
||||
{
|
||||
case 'mysql':
|
||||
case 'mysql4':
|
||||
|
@@ -313,7 +313,7 @@ function make_post($new_topic_id, $forum_id, $user_id, $post_username, $text, $m
|
||||
else
|
||||
{
|
||||
// Rollback
|
||||
if(SQL_LAYER == "mysql")
|
||||
if($db->sql_layer == "mysql")
|
||||
{
|
||||
$sql = "DELETE FROM " . POSTS_TABLE . "
|
||||
WHERE post_id = $new_post_id";
|
||||
|
@@ -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 '<meta http-equiv="refresh" content="0; url=fill.' . $phpEx . '?mode=sync&' . time() . '">And now for something completely different...';
|
||||
echo '<meta http-equiv="refresh" content="10; url=fill.' . $phpEx . '?mode=sync&' . time() . '">And now for something completely different...';
|
||||
|
||||
$db->sql_query('ANALYZE TABLES ' . TOPICS_TABLE . ', ' . POSTS_TABLE);
|
||||
flush();
|
||||
}
|
||||
else
|
||||
{
|
||||
echo '<meta http-equiv="refresh" content="0; url=fill.' . $phpEx . '?start=' . $topic_id . '&' . time() . '">To the next page... (' . $topic_id . '/' . $num_topics . ')';
|
||||
echo '<meta http-equiv="refresh" content="10; url=fill.' . $phpEx . '?start=' . $topic_id . '&' . time() . '">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;
|
||||
|
@@ -48,7 +48,7 @@ $sql = "CREATE TABLE {$table_prefix}attachments
|
||||
AND a.post_id = p.post_id";
|
||||
$db->sql_query($sql);
|
||||
|
||||
switch (SQL_LAYER)
|
||||
switch ($db->sql_layer)
|
||||
{
|
||||
case 'mysql':
|
||||
case 'mysql4':
|
||||
|
@@ -54,7 +54,7 @@ $sql = "CREATE TABLE {$table_prefix}posts
|
||||
WHERE pt.post_id = p.post_id";
|
||||
$db->sql_query($sql);
|
||||
|
||||
switch (SQL_LAYER)
|
||||
switch ($db->sql_layer)
|
||||
{
|
||||
case 'mysql':
|
||||
case 'mysql4':
|
||||
@@ -150,7 +150,7 @@ while ($row = $db->sql_fetchrow($result))
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
switch (SQL_LAYER)
|
||||
switch ($db->sql_layer)
|
||||
{
|
||||
case 'oracle':
|
||||
$sql = "SELECT f.*, p.post_time, p.post_username, u.username, u.user_id
|
||||
|
Reference in New Issue
Block a user