aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/develop
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/develop')
-rw-r--r--phpBB/develop/adjust_usernames.php52
-rw-r--r--phpBB/develop/create_schema_files.php4
2 files changed, 54 insertions, 2 deletions
diff --git a/phpBB/develop/adjust_usernames.php b/phpBB/develop/adjust_usernames.php
new file mode 100644
index 0000000000..1afa77af16
--- /dev/null
+++ b/phpBB/develop/adjust_usernames.php
@@ -0,0 +1,52 @@
+<?php
+/**
+* Adjust username_clean column.
+*
+* You should make a backup from your users table in case something goes wrong
+*/
+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();
+
+$echos = 0;
+
+$sql = 'SELECT user_id, username
+ FROM ' . USERS_TABLE;
+$result = $db->sql_query($sql);
+
+while ($row = $db->sql_fetchrow($result))
+{
+ $sql = 'UPDATE ' . USERS_TABLE . "
+ SET username_clean = '" . $db->sql_escape(utf8_clean_string($row['username'])) . "'
+ WHERE user_id = " . $row['user_id'];
+ $db->sql_query($sql);
+
+ if ($echos > 200)
+ {
+ echo '<br />' . "\n";
+ $echos = 0;
+ }
+
+ echo '.';
+ $echos++;
+
+ flush();
+}
+$db->sql_freeresult($result);
+
+echo 'FINISHED';
+
+// Done
+$db->sql_close();
+
+?> \ No newline at end of file
diff --git a/phpBB/develop/create_schema_files.php b/phpBB/develop/create_schema_files.php
index f4a4f80e60..b6fe49ced1 100644
--- a/phpBB/develop/create_schema_files.php
+++ b/phpBB/develop/create_schema_files.php
@@ -12,7 +12,7 @@
* If you overwrite the original schema files please make sure you save the file with UNIX linefeeds.
*/
-//die("Please read the first lines of this script for instructions on how to enable it");
+die("Please read the first lines of this script for instructions on how to enable it");
set_time_limit(0);
@@ -1899,7 +1899,7 @@ function get_schema_struct()
'user_birthday' => array('INDEX', 'user_birthday'),
'user_email_hash' => array('INDEX', 'user_email_hash'),
'user_type' => array('INDEX', 'user_type'),
- 'username_clean' => array('INDEX', 'username_clean'),
+ 'username_clean' => array('INDEX', 'username_clean'),
),
);