mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-30 21:40:43 +02:00
Merge branch '3.3.x'
This commit is contained in:
@@ -1,74 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* This file is part of the phpBB Forum Software package.
|
||||
*
|
||||
* @copyright (c) phpBB Limited <https://www.phpbb.com>
|
||||
* @license GNU General Public License, version 2 (GPL-2.0)
|
||||
*
|
||||
* For full copyright and license information, please see
|
||||
* the docs/CREDITS.txt file.
|
||||
*
|
||||
*/
|
||||
|
||||
//
|
||||
// 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(300);
|
||||
|
||||
$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);
|
||||
|
||||
$start = 0;
|
||||
do
|
||||
{
|
||||
// Batch query for group members, call group_user_del
|
||||
$sql = "SELECT user_id, user_email
|
||||
FROM {$table_prefix}users
|
||||
LIMIT $start, 100";
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
if ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
do
|
||||
{
|
||||
$sql = "UPDATE {$table_prefix}users
|
||||
SET user_email_hash = " . (crc32(strtolower($row['user_email'])) . strlen($row['user_email'])) . '
|
||||
WHERE user_id = ' . $row['user_id'];
|
||||
$db->sql_query($sql);
|
||||
|
||||
$start++;
|
||||
}
|
||||
while ($row = $db->sql_fetchrow($result));
|
||||
|
||||
echo "<br />Batch -> $start\n";
|
||||
flush();
|
||||
}
|
||||
else
|
||||
{
|
||||
$start = 0;
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
}
|
||||
while ($start);
|
||||
|
||||
echo "<p><b>Done</b></p>\n";
|
@@ -1,56 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Corrects user_email_hash values if DB moved from 32-bit system to 64-bit system or vice versa.
|
||||
* The CRC32 function in PHP generates different results for both systems.
|
||||
* @PHP dev team: no, a hexdec() applied to it does not solve the issue. And please document it.
|
||||
*
|
||||
*/
|
||||
die("Please read the first lines of this script for instructions on how to enable it");
|
||||
|
||||
set_time_limit(0);
|
||||
|
||||
define('IN_PHPBB', true);
|
||||
$phpbb_root_path = './../';
|
||||
$phpEx = substr(strrchr(__FILE__, '.'), 1);
|
||||
include($phpbb_root_path . 'common.' . $phpEx);
|
||||
|
||||
// Start session management
|
||||
$user->session_begin();
|
||||
$auth->acl($user->data);
|
||||
$user->setup();
|
||||
|
||||
$start = $request->variable('start', 0);
|
||||
$num_items = 1000;
|
||||
|
||||
echo '<br />Updating user email hashes' . "\n";
|
||||
|
||||
$sql = 'SELECT user_id, user_email
|
||||
FROM ' . USERS_TABLE . '
|
||||
ORDER BY user_id ASC';
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
$echos = 0;
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$echos++;
|
||||
|
||||
$sql = 'UPDATE ' . USERS_TABLE . "
|
||||
SET user_email_hash = '" . $db->sql_escape(phpbb_email_hash($row['user_email'])) . "'
|
||||
WHERE user_id = " . (int) $row['user_id'];
|
||||
$db->sql_query($sql);
|
||||
|
||||
if ($echos == 200)
|
||||
{
|
||||
echo '<br />';
|
||||
$echos = 0;
|
||||
}
|
||||
|
||||
echo '.';
|
||||
flush();
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
echo 'FINISHED';
|
||||
|
||||
// Done
|
||||
$db->sql_close();
|
Reference in New Issue
Block a user