aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMeik Sievertsen <acydburn@phpbb.com>2009-08-30 11:10:12 +0000
committerMeik Sievertsen <acydburn@phpbb.com>2009-08-30 11:10:12 +0000
commit36b8b94ea647930eb14edaf2e4b4d27ab56a05c9 (patch)
tree859f5079b24ed7bf03ce8b77ebee51dacf28e5ee
parent175d708b1de4000291fc1916ccd164993b602547 (diff)
downloadforums-36b8b94ea647930eb14edaf2e4b4d27ab56a05c9.tar
forums-36b8b94ea647930eb14edaf2e4b4d27ab56a05c9.tar.gz
forums-36b8b94ea647930eb14edaf2e4b4d27ab56a05c9.tar.bz2
forums-36b8b94ea647930eb14edaf2e4b4d27ab56a05c9.tar.xz
forums-36b8b94ea647930eb14edaf2e4b4d27ab56a05c9.zip
script to update email hashes (they are not strings btw, but BINT)
git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10063 89ea8834-ac86-4346-8a33-228a782c2dd0
-rw-r--r--phpBB/develop/update_email_hash.php57
1 files changed, 57 insertions, 0 deletions
diff --git a/phpBB/develop/update_email_hash.php b/phpBB/develop/update_email_hash.php
new file mode 100644
index 0000000000..80fd4bbc17
--- /dev/null
+++ b/phpBB/develop/update_email_hash.php
@@ -0,0 +1,57 @@
+<?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_var('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();
+?> \ No newline at end of file