- New user database email-lowercasing script more efficient, handles case

where user.id is not contiguous.

svn path=/trunk/boinc/; revision=4607
This commit is contained in:
Bruce Allen 2004-11-19 14:12:13 +00:00
parent 2ad2c8233f
commit 0fdde906b5
2 changed files with 19 additions and 16 deletions

View File

@ -19874,15 +19874,19 @@ Rom 19 Nov 2004
lib/
gui_rpc_client.C
Bruce 19 Nov 2004 UTC (from Reinhard Prix)
Bruce 19 Nov 2004 UTC
- Added nice macro (wxWidgets.m4) to CVS for detection of wxWidgets.
Now switch off clientgui build (with nice warning) if wxWidgets is
not found.
not found. (thanks Reinhard Prix)
- Use outcome of pthread tests and corresponding flags to set pthreads
CFLAGS correctly.
- New user database email-lowercasing script more efficient, handles case
where user.id is not contiguous.
configure.ac
Makefile.am
m4/
wxWidgets.m4
html/ops/
make_emails_lowercase.php

View File

@ -20,23 +20,22 @@ if (!($result = mysql_query($query))) {
echo "No rows found in USER database table";
exit();
}
$users_array = mysql_fetch_array($result);
mysql_free_result($result);
$number_of_users=$users_array[0];
echo "Found $number_of_users users<br/>";
for ($id=1; $id<=$number_of_users; $id++) {
$query = "select email_addr,cross_project_id from user where id=$id";
if (!($result = mysql_query($query))) {
echo "Entry with id=$id was not found in USER database table";
exit(); // change to continue; if missing rows!
}
$user = mysql_fetch_object($result);
mysql_free_result($result);
$query = "select id, email_addr,cross_project_id from user";
$result = mysql_query($query);
// loop over all users
while ($user = mysql_fetch_object($result)) {
$id=$user->id;
$email_addr=$user->email_addr;
$cpid=$user->cross_project_id;
$new_email=strtolower(trim($email_addr));
if (strcmp($email_addr, $new_email))
@ -49,18 +48,18 @@ for ($id=1; $id<=$number_of_users; $id++) {
else
$newcpid=$cpid;
if (strcmp($email_addr, $new_email) || strcmp($newcpid,$cpid)) {
$query="update user set email_addr='$new_email', cross_project_id='$newcpid' where id=$id";
$update="update user set email_addr='$new_email', cross_project_id='$newcpid' where id='$id'";
// modify line that follows to enable changes to user database: change (1) to (0)
if (1)
echo "QUERY WOULD BE [$id] $query <br/>[Modify html/ops/make_emails_lowercase.php to enable changes]<br/>";
else {
$result = mysql_query($query);
echo "Doing $query<br/>";
mysql_query($update);
echo "Doing $update<br/>\n";
}
}
}
mysql_free_result($result);
echo "
</BODY></HTML>\n