git-svn-id: file:///svn/phpbb/trunk@5250 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Meik Sievertsen 2005-10-03 15:44:41 +00:00
parent ed9bac63e5
commit 9439a3f49a
7 changed files with 256 additions and 10 deletions

View file

@ -422,7 +422,7 @@ function make_user($username)
}
$sql = "INSERT INTO " . USERS_TABLE . " (user_id, username, user_regdate, user_password, user_email, user_icq, user_website, user_occ, user_from, user_interests, user_sig, user_sig_bbcode_uid, user_avatar, user_viewemail, user_aim, user_yim, user_msnm, user_attachsig, user_allowsmile, user_allowhtml, user_allowbbcode, user_allow_viewonline, user_notify, user_notify_pm, user_timezone, user_dateformat, user_lang, user_style, user_level, user_allow_pm, user_active, user_actkey)
$sql = "INSERT INTO " . USERS_TABLE . " (user_id, username, user_regdate, user_password, user_email, user_icq, user_website, user_occ, user_from, user_interests, user_sig, user_sig_bbcode_uid, user_avatar, user_viewemail, user_aim, user_yim, user_msnm, user_attachsig, user_allowsmilies, user_allowhtml, user_allowbbcode, user_allow_viewonline, user_notify, user_notify_pm, user_timezone, user_dateformat, user_lang, user_style, user_level, user_allow_pm, user_active, user_actkey)
VALUES ($new_user_id, '$username', " . time() . ", '$password', '$email', '$icq', '$website', '$occupation', '$location', '$interests', '$signature', '$signature_bbcode_uid', '$avatar_filename', $viewemail, '$aim', '$yim', '$msn', $attachsig, $allowsmilies, $allowhtml, $allowbbcode, $allowviewonline, $notifyreply, $notifypm, $user_timezone, '$user_dateformat', '$user_lang', $user_style, 0, 1, ";

View file

@ -0,0 +1,62 @@
<?php
/***************************************************************************
* merge_clean_posts.php
* -------------------
* begin : Tuesday, February 25, 2003
* copyright : (C) 2003 The phpBB Group
* email : support@phpbb.com
*
* $Id$
*
***************************************************************************/
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/
//
// Security message:
//
// This script is potentially dangerous.
// Remove or comment the next line (die(".... ) to enable this script.
// Do NOT FORGET to either remove this script or disable it after you have used it.
//
die("Please read the first lines of this script for instructions on how to enable it");
@set_time_limit(2400);
// This script adds missing permissions
$db = $dbhost = $dbuser = $dbpasswd = $dbport = $dbname = '';
define('IN_PHPBB', 1);
define('ANONYMOUS', 1);
$phpEx = substr(strrchr(__FILE__, '.'), 1);
$phpbb_root_path='./../';
include($phpbb_root_path . 'config.'.$phpEx);
require($phpbb_root_path . 'includes/acm/acm_' . $acm_type . '.'.$phpEx);
require($phpbb_root_path . 'includes/db/' . $dbms . '.'.$phpEx);
include($phpbb_root_path . 'includes/functions.'.$phpEx);
$cache = new acm();
$db = new $sql_db();
// Connect to DB
$db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false);
$sql = "SELECT post_id, post_text FROM {$table_prefix}posts WHERE post_text LIKE '%{SMILE_PATH}%'";
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
$db->sql_query("UPDATE {$table_prefix}posts SET post_text = '" . $db->sql_escape(str_replace('{SMILE_PATH}', '{SMILIES_PATH}', $row['post_text'])) . "' WHERE post_id = " . $row['post_id']);
}
$db->sql_freeresult($result);
echo "<p><b>Done</b></p>\n";
?>

176
phpBB/develop/fill.php Normal file
View file

@ -0,0 +1,176 @@
<?php
// -------------------------------------------------------------
//
// $Id$
//
// FILENAME : fill.php
// STARTED : Mon Sep 15, 2003
// COPYRIGHT : © 2001, 2003 phpBB Group
// WWW : http://www.phpbb.com/
// LICENCE : GPL vs2.0 [ see /docs/COPYING ]
//
// -------------------------------------------------------------
define('IN_PHPBB', true);
$phpbb_root_path = './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.'.$phpEx);
include($phpbb_root_path . 'includes/functions_admin.'.$phpEx);
set_time_limit(0);
header('Expires: 0');
ignore_user_abort(true);
// number of topics to create
$num_topics = 5000000;
// number of topics to be generated per call
$batch_size = 100000;
// max number of posts per topic
$posts_per_topic = 500000;
// general vars
$mode = (isset($_REQUEST['mode'])) ? $_REQUEST['mode'] : 'generate';
$start = (isset($_REQUEST['start'])) ? intval($_REQUEST['start']) : 0;
switch ($mode)
{
case 'generate':
$user_ids = $forum_ids = $topic_rows = array();
$sql = 'SELECT user_id FROM ' . USERS_TABLE;
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
$user_ids[] = $row['user_id'];
}
$db->sql_freeresult($result);
$sql = 'SELECT forum_id FROM ' . FORUMS_TABLE . ' WHERE forum_type = ' . FORUM_POST;
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
$forum_ids[$row['forum_id']] = $row['forum_id'];
}
$db->sql_freeresult($result);
if (!$start)
{
$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('LOCK TABLES ' . POSTS_TABLE . ' WRITE, ' . TOPICS_TABLE . ' WRITE');
for ($topic_id = $start + 1; $topic_id < min($start + $batch_size, $num_topics + 1); ++$topic_id)
{
$forum_id = array_rand($forum_ids);
if (count($topic_rows) == 10)
{
$sql = 'INSERT IGNORE INTO ' . TOPICS_TABLE . " (topic_id, forum_id, topic_title, topic_reported)
VALUES " . implode(', ', $topic_rows);
$db->sql_query($sql);
$topic_rows = array();
}
$topic_rows[] = "($topic_id, $forum_id, '$forum_id-$topic_id', " . (($topic_id % 34) ? '0' : '1') . ')';
$sql = 'INSERT IGNORE INTO ' . POSTS_TABLE . ' (topic_id, forum_id, poster_id, post_subject, post_text, post_username, post_approved, post_time, post_reported)
VALUES ';
$rows = array();
$post_time = mt_rand(0, time());
$num_posts = mt_rand(1, $posts_per_topic);
for ($i = 0; $i < $num_posts; ++$i)
{
$poster_id = $user_ids[array_rand($user_ids)];
$poster_name = ($poster_id == ANONYMOUS) ? rndm_username() : '';
$rows[] = "($topic_id, $forum_id, $poster_id, '$forum_id-$topic_id-$i', '$forum_id-$topic_id-$i', '$poster_name', " . (mt_rand(0, 12) ? '1' : '0') . ', ' . ($post_time + $i * 60) . ', ' . (mt_rand(0, 32) ? '0' : '1') . ')';
}
$db->sql_query($sql . implode(', ', $rows));
}
if (count($topic_rows))
{
$sql = 'INSERT IGNORE INTO ' . TOPICS_TABLE . " (topic_id, forum_id, topic_title, topic_reported)
VALUES " . implode(', ', $topic_rows);
$db->sql_query($sql);
}
$db->sql_query('UNLOCK TABLES');
if ($topic_id >= $num_topics)
{
echo '<meta http-equiv="refresh" content="0; url=fill.' . $phpEx . '?mode=sync&amp;' . time() . '">And now for something completely different...';
$db->sql_query('ANALYZE TABLES ' . TOPICS_TABLE . ', ' . POSTS_TABLE);
}
else
{
echo '<meta http-equiv="refresh" content="0; url=fill.' . $phpEx . '?start=' . $topic_id . '&amp;' . time() . '">To the next page... (' . $topic_id . '/' . $num_topics . ')';
}
break;
case 'sync':
error_reporting(E_ALL);
$sync_all = TRUE;
if ($sync_all)
{
$s = explode(' ', microtime());
sync('topic', '', '', TRUE, FALSE);
// sync('forum');
$e = explode(' ', microtime());
echo '<pre><b>' . ($e[0] + $e[1] - $s[0] - $s[1]) . '</b></pre>';
echo '<a href="fill.' . $phpEx . '">Here we go again</a>';
}
else
{
$batch_size = $batch_size * 10;
$end = $start + $batch_size;
$s = explode(' ', microtime());
sync('topic', 'range', "topic_id BETWEEN $start AND $end", TRUE, FALSE);
$e = explode(' ', microtime());
echo '<pre>Time taken: <b>' . ($e[0] + $e[1] - $s[0] - $s[1]) . '</b></pre>';
if ($end < $num_topics)
{
$start += $batch_size;
echo '<meta http-equiv="refresh" content="0; url=fill.' . $phpEx . "?mode=sync&amp;start=$start&amp;" . time() . "\">And now for something completely different... ($start/$num_topics)";
}
else
{
echo '<a href="fill.' . $phpEx . '">Here we go again</a>';
}
}
if (isset($_GET['explain']))
{
trigger_error('Done');
}
}
function rndm_username()
{
static $usernames;
if (!isset($usernames))
{
$usernames = get_defined_functions();
$usernames = $usernames['internal'];
}
return $usernames[array_rand($usernames)];
}
?>

View file

@ -1,7 +1,7 @@
<?php
/**
*
* @package dbal_db2
* @package dbal
* @version $Id$
* @copyright (c) 2005 phpBB Group
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
@ -17,10 +17,10 @@ if(!defined("SQL_LAYER"))
define("SQL_LAYER","db2");
/**
* @package dbal_db2
* DB2 Database Abstraction Layer
* @package dbal
* DB2 Database Abstraction Layer - not finished yet
*/
class sql_db
class dbal_db2 extends dbal
{
var $db_connect_id;

View file

@ -1225,7 +1225,7 @@ if ($stage == 4)
}
$db->sql_freeresult($result);
$user->start();
$user->session_begin();
$auth->login($admin_name, $admin_pass1);
inst_page_header();

View file

@ -353,6 +353,10 @@ $lang += array(
'UCP_PROFILE_REG_DETAILS' => 'Registration details',
'UCP_PROFILE_SIGNATURE' => 'Your signature',
'UCP_USERGROUPS' => 'Usergroups',
'UCP_USERGROUPS_MEMBER' => 'Memberships',
'UCP_USERGROUPS_MANAGE' => 'Manage groups',
'UCP_REGISTER_DISABLE' => 'Creating a new account is currently not possible.',
'UCP_REMIND' => 'Send password',
'UCP_RESEND' => 'Send activation email',

View file

@ -14,9 +14,10 @@ define('IN_PHPBB', true);
$phpbb_root_path = './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.'.$phpEx);
include($phpbb_root_path . 'includes/functions_display.'.$phpEx);
// Start session management
$user->start();
$user->session_begin();
$auth->acl($user->data);
$user->setup('mcp');
@ -380,8 +381,11 @@ function report_notification($notify_user, $report_post, $report_data)
// do not put in reporters outbox
submit_pm('post', $report_data['subject'], '', array(), array(), array(
'address_list' => array('u' => array($user_id => 'to')),
'icon_id' => 0,
'address_list' => array('u' => array($user_id => 'to')),
'from_user_id' => $user->data['user_id'],
'from_user_ip' => $user->ip,
'from_usernae' => $user->data['username'],
'icon_id' => 0,
'enable_bbcode' => 0,
'enable_html' => 0,
'enable_smilies' => 0,