@@ -66,6 +66,9 @@ |
||
66 | 66 | // $x is an array of result/host objects; |
67 | 67 | // return the variance among claimed credits given an FP weight |
68 | 68 | // |
69 | +/** |
|
70 | + * @param double $fpw |
|
71 | + */ |
|
69 | 72 | function fpw_var($results, $fpw) { |
70 | 73 | $cc = array(); |
71 | 74 | foreach ($results as $r) { |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | function mean($x) { |
33 | 33 | $sum = 0; |
34 | 34 | $n = count($x); |
35 | - for ($i=0; $i<$n; $i++) { |
|
35 | + for ($i = 0; $i < $n; $i++) { |
|
36 | 36 | $sum += $x[$i]; |
37 | 37 | } |
38 | 38 | return $sum/$n; |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | $sum = 0; |
43 | 43 | $n = count($x); |
44 | 44 | $m = mean($x); |
45 | - for ($i=0; $i<$n; $i++) { |
|
45 | + for ($i = 0; $i < $n; $i++) { |
|
46 | 46 | $d = $x[$i] - $m; |
47 | 47 | $sum += $d*$d; |
48 | 48 | //echo "$x[$i] "; |
@@ -56,10 +56,10 @@ discard block |
||
56 | 56 | // returns the claimed credit for a given result/host and FP weight |
57 | 57 | // |
58 | 58 | function cc($x, $fpw) { |
59 | - $cps = $x->p_fpops*$fpw + $x->p_iops*(1-$fpw); |
|
59 | + $cps = $x->p_fpops*$fpw + $x->p_iops*(1 - $fpw); |
|
60 | 60 | $cps /= 1e9; |
61 | 61 | $cps /= 864; |
62 | - $cc = $x->cpu_time * $cps; |
|
62 | + $cc = $x->cpu_time*$cps; |
|
63 | 63 | return $cc; |
64 | 64 | } |
65 | 65 | |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | $nwus = 4000; |
85 | 85 | |
86 | 86 | $sum = array(); |
87 | - for ($i=0; $i<=10; $i++) { |
|
87 | + for ($i = 0; $i <= 10; $i++) { |
|
88 | 88 | $sum[] = 0; |
89 | 89 | } |
90 | 90 | $r1 = _mysql_query( |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | $r2 = _mysql_query("select * from result where workunitid=$wu->id"); |
97 | 97 | $found_zero = false; |
98 | 98 | while ($result = _mysql_fetch_object($r2)) { |
99 | - if ($result->granted_credit==0) continue; // skip invalid |
|
99 | + if ($result->granted_credit == 0) continue; // skip invalid |
|
100 | 100 | $host = BoincHost::lookup_id($result->hostid); |
101 | 101 | $r = new StdClass; |
102 | 102 | $r->cpu_time = $result->cpu_time; |
@@ -105,8 +105,8 @@ discard block |
||
105 | 105 | $results[] = $r; |
106 | 106 | } |
107 | 107 | //echo "Wu $wu->id -------------\n"; |
108 | - if (count($results)<2) continue; |
|
109 | - for ($i=0; $i<=10; $i++) { |
|
108 | + if (count($results) < 2) continue; |
|
109 | + for ($i = 0; $i <= 10; $i++) { |
|
110 | 110 | $fpw = $i/10.; |
111 | 111 | $sum[$i] += fpw_var($results, $fpw); |
112 | 112 | } |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | Number of workunits analyzed: $n |
121 | 121 | |
122 | 122 | "; |
123 | - for ($i=0; $i<=10; $i++) { |
|
123 | + for ($i = 0; $i <= 10; $i++) { |
|
124 | 124 | $fpw = $i/10.; |
125 | 125 | $r = $sum[$i]/$n; |
126 | 126 | echo "FP weight $fpw: variance is $r\n"; |
@@ -96,7 +96,10 @@ discard block |
||
96 | 96 | $r2 = _mysql_query("select * from result where workunitid=$wu->id"); |
97 | 97 | $found_zero = false; |
98 | 98 | while ($result = _mysql_fetch_object($r2)) { |
99 | - if ($result->granted_credit==0) continue; // skip invalid |
|
99 | + if ($result->granted_credit==0) { |
|
100 | + continue; |
|
101 | + } |
|
102 | + // skip invalid |
|
100 | 103 | $host = BoincHost::lookup_id($result->hostid); |
101 | 104 | $r = new StdClass; |
102 | 105 | $r->cpu_time = $result->cpu_time; |
@@ -105,7 +108,9 @@ discard block |
||
105 | 108 | $results[] = $r; |
106 | 109 | } |
107 | 110 | //echo "Wu $wu->id -------------\n"; |
108 | - if (count($results)<2) continue; |
|
111 | + if (count($results)<2) { |
|
112 | + continue; |
|
113 | + } |
|
109 | 114 | for ($i=0; $i<=10; $i++) { |
110 | 115 | $fpw = $i/10.; |
111 | 116 | $sum[$i] += fpw_var($results, $fpw); |
@@ -65,6 +65,9 @@ |
||
65 | 65 | return $running; |
66 | 66 | } |
67 | 67 | |
68 | +/** |
|
69 | + * @param boolean $running |
|
70 | + */ |
|
68 | 71 | function show_status($host, $function, $running) { |
69 | 72 | echo "<tr><td>$function</td><td>$host</td>"; |
70 | 73 | if ($running) { |
@@ -41,9 +41,9 @@ |
||
41 | 41 | } |
42 | 42 | |
43 | 43 | function find_oldest() { |
44 | - $result=_mysql_query("select name,create_time from result where server_state=2 order by create_time limit 1"); |
|
45 | - $x = _mysql_fetch_object($result); |
|
46 | - return $x->create_time; |
|
44 | + $result=_mysql_query("select name,create_time from result where server_state=2 order by create_time limit 1"); |
|
45 | + $x = _mysql_fetch_object($result); |
|
46 | + return $x->create_time; |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | function daemon_status($host, $pidname) { |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | } |
42 | 42 | |
43 | 43 | function find_oldest() { |
44 | - $result=_mysql_query("select name,create_time from result where server_state=2 order by create_time limit 1"); |
|
44 | + $result = _mysql_query("select name,create_time from result where server_state=2 order by create_time limit 1"); |
|
45 | 45 | $x = _mysql_fetch_object($result); |
46 | 46 | return $x->create_time; |
47 | 47 | } |
@@ -88,25 +88,25 @@ discard block |
||
88 | 88 | |
89 | 89 | |
90 | 90 | |
91 | -$dbrc = db_init(1); // 1=soft, remember that DB might be down |
|
91 | +$dbrc = db_init(1); // 1=soft, remember that DB might be down |
|
92 | 92 | |
93 | -page_head(PROJECT . " - Server Status"); |
|
93 | +page_head(PROJECT." - Server Status"); |
|
94 | 94 | |
95 | 95 | |
96 | 96 | // Date stamp |
97 | 97 | |
98 | 98 | |
99 | -echo "<br ALIGN=RIGHT> ".PROJECT. " server status as of ". |
|
100 | - date("g:i A T"). " on ". date("l, j F Y ") . |
|
99 | +echo "<br ALIGN=RIGHT> ".PROJECT." server status as of ". |
|
100 | + date("g:i A T")." on ".date("l, j F Y "). |
|
101 | 101 | " (updated every $Nmin minutes).\n"; |
102 | 102 | |
103 | -$proc_uptime=exec("cat /proc/uptime | cut -d\" \" -f-1"); |
|
103 | +$proc_uptime = exec("cat /proc/uptime | cut -d\" \" -f-1"); |
|
104 | 104 | $days = (int)($proc_uptime/86400); |
105 | -$hours=(int)($proc_uptime/3600); |
|
106 | -$hours=$hours % 24; |
|
107 | -$minutes=(int)($proc_uptime/60); |
|
108 | -$minutes=$minutes % 60; |
|
109 | -echo "<br ALIGN=RIGHT>The ".PROJECT. " main server has been continuously up for ". "$days"." days "."$hours"." hours "."$minutes"." minutes.\n<P>"; |
|
105 | +$hours = (int)($proc_uptime/3600); |
|
106 | +$hours = $hours%24; |
|
107 | +$minutes = (int)($proc_uptime/60); |
|
108 | +$minutes = $minutes%60; |
|
109 | +echo "<br ALIGN=RIGHT>The ".PROJECT." main server has been continuously up for "."$days"." days "."$hours"." hours "."$minutes"." minutes.\n<P>"; |
|
110 | 110 | |
111 | 111 | // tables side by side |
112 | 112 | echo "<TABLE><TR><TD align=center> \n"; |
@@ -152,11 +152,11 @@ discard block |
||
152 | 152 | if ($dbrc) { |
153 | 153 | echo "The database server is not accessable"; |
154 | 154 | } else { |
155 | - $now=time(0); |
|
156 | - $s_day=24*3600; |
|
157 | - $d_ago=$now-$s_day; |
|
158 | - $s_week=7*$s_day; |
|
159 | - $w_ago=$now-$s_week; |
|
155 | + $now = time(0); |
|
156 | + $s_day = 24*3600; |
|
157 | + $d_ago = $now - $s_day; |
|
158 | + $s_week = 7*$s_day; |
|
159 | + $w_ago = $now - $s_week; |
|
160 | 160 | |
161 | 161 | echo " |
162 | 162 | <table border=2 cellpadding=6> |
@@ -276,12 +276,12 @@ discard block |
||
276 | 276 | <tr><td>invalid</td><td>".number_format($n)."</td></tr> |
277 | 277 | "; |
278 | 278 | |
279 | - $n = time(0)-find_oldest(); |
|
279 | + $n = time(0) - find_oldest(); |
|
280 | 280 | $days = (int)($n/86400); |
281 | - $hours=(int)($n/3600); |
|
282 | - $hours=$hours % 24; |
|
283 | - $minutes=(int)($n/60); |
|
284 | - $minutes=$minutes % 60; |
|
281 | + $hours = (int)($n/3600); |
|
282 | + $hours = $hours%24; |
|
283 | + $minutes = (int)($n/60); |
|
284 | + $minutes = $minutes%60; |
|
285 | 285 | echo " |
286 | 286 | <tr><td>Oldest Unsent Result</td><td>".$days." d ".$hours." h ".$minutes." m</td></tr> |
287 | 287 | "; |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | |
298 | 298 | // Display cgi-bin restriction status |
299 | 299 | |
300 | -if ( file_exists("../../cgi-bin/.htaccess") ) { |
|
300 | +if (file_exists("../../cgi-bin/.htaccess")) { |
|
301 | 301 | echo "<P><font color=RED> |
302 | 302 | <b>The ".PROJECT." scheduler is currently restricted |
303 | 303 | to uwm.edu and a few other domains. |
@@ -12,6 +12,9 @@ |
||
12 | 12 | // insert "\n</venue>\n" before "</global_preferences>" |
13 | 13 | // This fixes an XML error introduced at some point in the past |
14 | 14 | // |
15 | +/** |
|
16 | + * @return string |
|
17 | + */ |
|
15 | 18 | function repair_prefs($prefs) { |
16 | 19 | if (strstr($prefs, '\"')) { |
17 | 20 | return str_replace('\"', '"', $prefs); |
@@ -17,7 +17,9 @@ discard block |
||
17 | 17 | return str_replace('\"', '"', $prefs); |
18 | 18 | } |
19 | 19 | $x = strstr($prefs, "</global_preferences>", true); |
20 | - if (!$x) return null; |
|
20 | + if (!$x) { |
|
21 | + return null; |
|
22 | + } |
|
21 | 23 | return "$x\n </venue>\n</global_preferences>\n"; |
22 | 24 | } |
23 | 25 | |
@@ -60,7 +62,9 @@ discard block |
||
60 | 62 | $m = $n + 1000; |
61 | 63 | $users = BoincUser::enum("id >= $n and id < $m"); |
62 | 64 | //echo "processing from $n\n"; |
63 | - if (!$users) break; |
|
65 | + if (!$users) { |
|
66 | + break; |
|
67 | + } |
|
64 | 68 | process_set($users); |
65 | 69 | $n = $m; |
66 | 70 | } |
@@ -24,12 +24,18 @@ |
||
24 | 24 | |
25 | 25 | db_init(); |
26 | 26 | |
27 | +/** |
|
28 | + * @param string $tag |
|
29 | + */ |
|
27 | 30 | function parse_num($xml, $tag) { |
28 | 31 | $x = parse_element($xml, $tag); |
29 | 32 | if (!$x) return 0; |
30 | 33 | return $x; |
31 | 34 | } |
32 | 35 | |
36 | +/** |
|
37 | + * @param string $tag |
|
38 | + */ |
|
33 | 39 | function parse_boolint($xml, $tag) { |
34 | 40 | $x = parse_bool($xml, $tag); |
35 | 41 | if ($x) return 1; |
@@ -26,13 +26,17 @@ |
||
26 | 26 | |
27 | 27 | function parse_num($xml, $tag) { |
28 | 28 | $x = parse_element($xml, $tag); |
29 | - if (!$x) return 0; |
|
29 | + if (!$x) { |
|
30 | + return 0; |
|
31 | + } |
|
30 | 32 | return $x; |
31 | 33 | } |
32 | 34 | |
33 | 35 | function parse_boolint($xml, $tag) { |
34 | 36 | $x = parse_bool($xml, $tag); |
35 | - if ($x) return 1; |
|
37 | + if ($x) { |
|
38 | + return 1; |
|
39 | + } |
|
36 | 40 | return 0; |
37 | 41 | } |
38 | 42 |
@@ -231,6 +231,9 @@ discard block |
||
231 | 231 | } |
232 | 232 | } |
233 | 233 | |
234 | +/** |
|
235 | + * @param resource $log |
|
236 | + */ |
|
234 | 237 | function do_batch($startid, $n, $log) { |
235 | 238 | $result = _mysql_query( |
236 | 239 | "select * from user where id>$startid order by id limit $n" |
@@ -245,6 +248,9 @@ discard block |
||
245 | 248 | return $startid; |
246 | 249 | } |
247 | 250 | |
251 | +/** |
|
252 | + * @param resource $log |
|
253 | + */ |
|
248 | 254 | function do_one($thisid, $log) { |
249 | 255 | $result = _mysql_query( |
250 | 256 | "select * from user where id=$thisid" |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | $globals->batch = 1000; |
56 | 56 | $globals->lapsed_interval = 60*86400; |
57 | 57 | |
58 | -for ($i=1; $i<$argc; $i++) { |
|
58 | +for ($i = 1; $i < $argc; $i++) { |
|
59 | 59 | if ($argv[$i] == "--batch") { |
60 | 60 | $i++; |
61 | 61 | $globals->batch = $argv[$i]; |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | gmdate('d F Y', $user->create_time), |
170 | 170 | number_format($user->total_credit, 0), |
171 | 171 | opt_out_url($user), |
172 | - floor((time() - $user->last_rpc_time) / 86400), |
|
172 | + floor((time() - $user->last_rpc_time)/86400), |
|
173 | 173 | ); |
174 | 174 | return preg_replace($pat, $rep, $template); |
175 | 175 | } |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | while ($user = _mysql_fetch_object($result)) { |
239 | 239 | handle_user($user); |
240 | 240 | $startid = $user->id; |
241 | - fputs($log, $user->id . "\n"); |
|
241 | + fputs($log, $user->id."\n"); |
|
242 | 242 | fflush($log); |
243 | 243 | } |
244 | 244 | _mysql_free_result($result); |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | $user = _mysql_fetch_object($result); |
253 | 253 | if ($user) { |
254 | 254 | handle_user($user); |
255 | - fputs($log, $user->id . "\n"); |
|
255 | + fputs($log, $user->id."\n"); |
|
256 | 256 | fflush($log); |
257 | 257 | } |
258 | 258 | _mysql_free_result($result); |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | } else { |
290 | 290 | $fid = fopen($id_file, 'r'); |
291 | 291 | if (!$fid) { |
292 | - echo $id_file . ' not found - create ID list and run again\n'; |
|
292 | + echo $id_file.' not found - create ID list and run again\n'; |
|
293 | 293 | exit(); |
294 | 294 | } |
295 | 295 | $thisid = 0; |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | } |
301 | 301 | fclose($fid); |
302 | 302 | } |
303 | - echo 'All done!' . "\n"; |
|
303 | + echo 'All done!'."\n"; |
|
304 | 304 | } |
305 | 305 | |
306 | 306 | if (!function_exists('make_php_mailer')) { |
@@ -150,7 +150,9 @@ discard block |
||
150 | 150 | $x = 0; |
151 | 151 | $result = _mysql_query("select rpc_time from host where userid=$user->id"); |
152 | 152 | while ($host = _mysql_fetch_object($result)) { |
153 | - if ($host->rpc_time > $x) $x = $host->rpc_time; |
|
153 | + if ($host->rpc_time > $x) { |
|
154 | + $x = $host->rpc_time; |
|
155 | + } |
|
154 | 156 | } |
155 | 157 | _mysql_free_result($result); |
156 | 158 | return $x; |
@@ -283,7 +285,9 @@ discard block |
||
283 | 285 | if ($id_file == "") { |
284 | 286 | while (1) { |
285 | 287 | $new_startid = do_batch($startid, $globals->batch, $f); |
286 | - if ($new_startid == $startid) break; |
|
288 | + if ($new_startid == $startid) { |
|
289 | + break; |
|
290 | + } |
|
287 | 291 | $startid = $new_startid; |
288 | 292 | } |
289 | 293 | } else { |
@@ -39,6 +39,9 @@ |
||
39 | 39 | BoincNotify::delete_aux("create_time < $t"); |
40 | 40 | } |
41 | 41 | |
42 | +/** |
|
43 | + * @param string $message |
|
44 | + */ |
|
42 | 45 | function send_notify_email($userid, $message) { |
43 | 46 | $user = BoincUser::lookup_id($userid); |
44 | 47 | $subject = "Daily notification summary from ".PROJECT; |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | // delete notifications older than 90 days |
36 | 36 | // |
37 | 37 | function delete_old_notifies() { |
38 | - $t = time()-90*86400; |
|
38 | + $t = time() - 90*86400; |
|
39 | 39 | BoincNotify::delete_aux("create_time < $t"); |
40 | 40 | } |
41 | 41 | |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | function send_notify_emails() { |
62 | 62 | $db = BoincDb::get(); |
63 | 63 | |
64 | - $t = time() - (86400 + 3600); // 1-hour slop factor |
|
64 | + $t = time() - (86400 + 3600); // 1-hour slop factor |
|
65 | 65 | $query = "select notify.* from ".$db->db_name.".notify, ".$db->db_name.".forum_preferences where forum_preferences.pm_notification=2 and notify.userid = forum_preferences.userid and notify.create_time > $t"; |
66 | 66 | |
67 | 67 | $notifies = BoincNotify::enum_general($query); |
@@ -41,6 +41,9 @@ discard block |
||
41 | 41 | |
42 | 42 | // see if a web server is running at the given URL |
43 | 43 | // |
44 | +/** |
|
45 | + * @param string $url |
|
46 | + */ |
|
44 | 47 | function web_server_running($url) { |
45 | 48 | $u = parse_url($url); |
46 | 49 | $url = $u['scheme']."://".$u['host']; |
@@ -56,6 +59,9 @@ discard block |
||
56 | 59 | |
57 | 60 | // see if the given daemon is running on the host by checking its PID |
58 | 61 | // |
62 | +/** |
|
63 | + * @param string $host |
|
64 | + */ |
|
59 | 65 | function is_daemon_running($host, $d) { |
60 | 66 | if ($d->pid_file) { |
61 | 67 | $path = "../../pid_$host/".(string)$d->pid_file; |
@@ -80,41 +80,41 @@ |
||
80 | 80 | die("can't parse config file\n"); |
81 | 81 | } |
82 | 82 | $config = $c->config; |
83 | - $master_url = (string) $config->master_url; |
|
83 | + $master_url = (string)$config->master_url; |
|
84 | 84 | $u = parse_url($master_url); |
85 | 85 | $master_host = $u["host"]; |
86 | 86 | |
87 | - $url = (string) $config->download_url; |
|
87 | + $url = (string)$config->download_url; |
|
88 | 88 | $u = parse_url($url); |
89 | 89 | $h = $u["host"]; |
90 | 90 | if ($h != $master_host) { |
91 | 91 | $y = new StdClass; |
92 | 92 | $y->cmd = 'Download server'; |
93 | 93 | $y->host = $h; |
94 | - $y->status = web_server_running($url)?1:0; |
|
94 | + $y->status = web_server_running($url) ? 1 : 0; |
|
95 | 95 | $x[] = $y; |
96 | 96 | } |
97 | - $url = (string) $config->upload_url; |
|
97 | + $url = (string)$config->upload_url; |
|
98 | 98 | $u = parse_url($url); |
99 | 99 | $h = $u["host"]; |
100 | 100 | if ($h != $master_host) { |
101 | 101 | $y = new StdClass; |
102 | 102 | $y->cmd = 'Upload server'; |
103 | 103 | $y->host = $h; |
104 | - $y->status = web_server_running($url)?1:0; |
|
104 | + $y->status = web_server_running($url) ? 1 : 0; |
|
105 | 105 | $x[] = $y; |
106 | 106 | } |
107 | 107 | |
108 | 108 | $main_host = (string)$c->config->host; |
109 | 109 | if ($c->config->www_host) { |
110 | - $web_host = (string) $c->config->www_host; |
|
110 | + $web_host = (string)$c->config->www_host; |
|
111 | 111 | } else { |
112 | 112 | $web_host = $main_host; |
113 | 113 | } |
114 | 114 | $daemons = $c->daemons; |
115 | 115 | foreach ($daemons->daemon as $d) { |
116 | 116 | if ((int)$d->disabled != 0) continue; |
117 | - $host = $d->host?(string)$d->host:$main_host; |
|
117 | + $host = $d->host ? (string)$d->host : $main_host; |
|
118 | 118 | if ($host != $web_host) { |
119 | 119 | $y = new StdClass; |
120 | 120 | $y->cmd = (string)$d->cmd; |
@@ -65,10 +65,14 @@ discard block |
||
65 | 65 | $path = "../../pid_$host/$prog".".pid"; |
66 | 66 | } |
67 | 67 | $pid = trim(@file_get_contents($path)); |
68 | - if ($pid === false) return false; |
|
68 | + if ($pid === false) { |
|
69 | + return false; |
|
70 | + } |
|
69 | 71 | $cmd = "ssh $host 'ps $pid'"; |
70 | 72 | $out = exec($cmd); |
71 | - if (strstr($out, $pid)) return true; |
|
73 | + if (strstr($out, $pid)) { |
|
74 | + return true; |
|
75 | + } |
|
72 | 76 | return false; |
73 | 77 | } |
74 | 78 | |
@@ -113,7 +117,9 @@ discard block |
||
113 | 117 | } |
114 | 118 | $daemons = $c->daemons; |
115 | 119 | foreach ($daemons->daemon as $d) { |
116 | - if ((int)$d->disabled != 0) continue; |
|
120 | + if ((int)$d->disabled != 0) { |
|
121 | + continue; |
|
122 | + } |
|
117 | 123 | $host = $d->host?(string)$d->host:$main_host; |
118 | 124 | if ($host != $web_host) { |
119 | 125 | $y = new StdClass; |
@@ -107,10 +107,18 @@ |
||
107 | 107 | } |
108 | 108 | } |
109 | 109 | |
110 | +/** |
|
111 | + * @param integer $i |
|
112 | + * |
|
113 | + * @return string |
|
114 | + */ |
|
110 | 115 | function app_version_dir($app_name, $i, $platform) { |
111 | 116 | return "apps/$app_name/1.$i/$platform"; |
112 | 117 | } |
113 | 118 | |
119 | +/** |
|
120 | + * @param integer $i |
|
121 | + */ |
|
114 | 122 | function make_app_version_dir($app_name, $i, $platform) { |
115 | 123 | @mkdir("apps/$app_name"); |
116 | 124 | @mkdir("apps/$app_name/1.$i"); |
@@ -132,7 +132,9 @@ discard block |
||
132 | 132 | $have_latest_wrapper = false; |
133 | 133 | while (1) { |
134 | 134 | $app_dir = app_version_dir($app_name, $i, $platform); |
135 | - if (!file_exists($app_dir)) break; |
|
135 | + if (!file_exists($app_dir)) { |
|
136 | + break; |
|
137 | + } |
|
136 | 138 | $latest_i = $i; |
137 | 139 | $i++; |
138 | 140 | } |
@@ -200,7 +202,9 @@ discard block |
||
200 | 202 | } |
201 | 203 | } |
202 | 204 | |
203 | -if ($argc != 2) usage(); |
|
205 | +if ($argc != 2) { |
|
206 | + usage(); |
|
207 | +} |
|
204 | 208 | $boinc_samples_dir = $argv[1]; |
205 | 209 | check_wrapper_exists(); |
206 | 210 | get_includes(); |
@@ -58,6 +58,9 @@ |
||
58 | 58 | return $x; |
59 | 59 | } |
60 | 60 | |
61 | +/** |
|
62 | + * @param resource $f |
|
63 | + */ |
|
61 | 64 | function handle_team($team, $f) { |
62 | 65 | echo "Team: $team->name\n"; |
63 | 66 | $user = BoincUser::lookup_id($team->userid); |
@@ -100,7 +100,7 @@ |
||
100 | 100 | $f = fopen("temp.xml", "w"); |
101 | 101 | $teams = BoincTeam::enum(null); |
102 | 102 | fwrite($f, "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<teams>\n"); |
103 | - foreach($teams as $team) { |
|
103 | + foreach ($teams as $team) { |
|
104 | 104 | handle_team($team, $f); |
105 | 105 | } |
106 | 106 | fwrite($f, "</teams>\n"); |