Make_fake_tables generates flat files of fake users for testing migrate_tables. Migrate tables has had a few bugs fixed.

svn path=/trunk/boinc/; revision=2189
This commit is contained in:
David Anderson 2003-08-23 01:18:27 +00:00
parent 367477d774
commit 6214011910
2 changed files with 50 additions and 4 deletions

41
html/ops/make_fake_tables.php Executable file
View File

@ -0,0 +1,41 @@
#!/usr/local/bin/php
<?php
define('NUM_USERS', 200);
define('NUM_TEAMS', 24);
define('BASE_UID', 1000001);
define('BASE_TID', 300);
// Users
$fd = fopen("test_user_flat", "w");
for ($i = 0; $i < NUM_USERS; $i++) {
$line = "" . (BASE_UID + $i)."|"."1234"."|"."user$i@$i.com|Johhny #$i|0|".(2451405.039016203+$i)."|2|3|4|5|6|7|1|United States|".(94704 + $i)."|1|2|3|".(BASE_TID + ($i%NUM_TEAMS))."|password|www.jb.org|0|0|\n";
fwrite($fd, $line);
shell_exec("cp 1000001.jpg ".(BASE_UID+$i).".jpg");
shell_exec("cp 1000001.jpg sm_".(BASE_UID+$i).".jpg");
}
fclose($fd);
// Every other user will have a profile.
$fd = fopen("test_feedback_flat", "w");
for ($i = 0; $i < (NUM_USERS / 2); $i++) {
$line = "".$i."|".(BASE_UID + ($i*2))."|0|0.00|0.00|JBK||||||||".(BASE_UID + $i*2).".jpg|Hello, I'm user ID# ".(BASE_UID + $i*2)."|I have no opinions|1|1|1|1|something|\n";
fwrite($fd, $line);
}
fclose($fd);
// Teams
$fd = fopen("test_teams_flat", "w");
for ($i = 0; $i < NUM_TEAMS ; $i++) {
$line = "".(BASE_TID + ($i%NUM_TEAMS))."|".(BASE_UID + $i)."|Team #$i|Name LC|A test team.|jb$i.teams.org|12|23|12345.11|".($i*10)."|1|<h1> Team $i! </h1>|\n";
fwrite($fd, $line);
}
fclose($fd);
?>

View File

@ -5,8 +5,13 @@
// isn't stored in the SETI@Home database. Should we just set them all to
// the date of migration?
define('SETI_IMAGE_PATH', '/disks/kosh/a/inet_services/www/share/htdocs/SetiAtHome/images/user_profile/');
//define('SETI_IMAGE_PATH', '/disks/kosh/a/inet_services/www/share/htdocs/SetiAtHome/images/user_profile/');
//define('BOINC_IMAGE_PATH','/disks/koloth/a/inet_services/www/share/projects/AstroPulse_Beta/html_user/user_profile/images/');
// NOTE: These are only test values! The commented values above are closer
// to the real thing.
define('SETI_IMAGE_PATH', '/disks/kodos/a/inet_services/boinc_www/share/projects/tah/html_ops/');
define('BOINC_IMAGE_PATH', '/disks/kodos/a/inet_services/boinc_www/share/projects/tah/html_user/user_profile/images/');
define('USER_FILE', 'test_user_flat');
@ -305,8 +310,8 @@ function move_user_pic($img_name, $userid) {
$ext = strrchr($img_name, ".");
if ($ext == '.jpg' || $ext == '.jpeg') {
shell_exec("mv $filename " . BOINC_IMAGE_PATH . $userid . ".jpg");
shell_exec("mv $filename_sm " . BOINC_IMAGE_PATH . "$userid . "_sm.jpg");
shell_exec("cp $filename " . BOINC_IMAGE_PATH . $userid . ".jpg");
shell_exec("cp $filename_sm " . BOINC_IMAGE_PATH . $userid . "_sm.jpg");
return true;
} else if ($ext == '.png' || $ext == '.gif') {
shell_exec("convert $filename jpg:" . BOINC_IMAGE_PATH . $userid . ".jpg");