@@ -27,10 +27,10 @@ discard block |
||
| 27 | 27 | if (DISABLE_TEAMS) error_page("Teams are disabled"); |
| 28 | 28 | |
| 29 | 29 | $border = get_str("border", true); |
| 30 | -if ($border=="no") { |
|
| 31 | - $border=0; |
|
| 30 | +if ($border == "no") { |
|
| 31 | + $border = 0; |
|
| 32 | 32 | } else { |
| 33 | - $border=8; |
|
| 33 | + $border = 8; |
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | // Make sure user_id is in the URL so that share functions work |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | if (!$user_id) { |
| 40 | 40 | $user = get_logged_in_user(); |
| 41 | 41 | Header(sprintf('Location: %s/cert_team.php?user_id=%d%s', |
| 42 | - url_base(), $user->id, $border==0?'&border=no':'' |
|
| 42 | + url_base(), $user->id, $border == 0 ? '&border=no' : '' |
|
| 43 | 43 | )); |
| 44 | 44 | exit; |
| 45 | 45 | } |
@@ -24,10 +24,10 @@ discard block |
||
| 24 | 24 | require_once("../inc/cert.inc"); |
| 25 | 25 | |
| 26 | 26 | $border = get_str("border", true); |
| 27 | -if ($border=="no") { |
|
| 28 | - $border=0; |
|
| 27 | +if ($border == "no") { |
|
| 28 | + $border = 0; |
|
| 29 | 29 | } else { |
| 30 | - $border=8; |
|
| 30 | + $border = 8; |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | // Make sure user_id is in the URL so that share functions work |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | if (!$user_id) { |
| 37 | 37 | $user = get_logged_in_user(); |
| 38 | 38 | Header(sprintf('Location: %s/cert1.php?user_id=%d%s', |
| 39 | - url_base(), $user->id, $border==0?'&border=no':'' |
|
| 39 | + url_base(), $user->id, $border == 0 ? '&border=no' : '' |
|
| 40 | 40 | )); |
| 41 | 41 | exit; |
| 42 | 42 | } |
@@ -25,10 +25,10 @@ discard block |
||
| 25 | 25 | require_once("../inc/user.inc"); |
| 26 | 26 | |
| 27 | 27 | $border = get_str("border", true); |
| 28 | -if ($border=="no") { |
|
| 29 | - $border=0; |
|
| 28 | +if ($border == "no") { |
|
| 29 | + $border = 0; |
|
| 30 | 30 | } else { |
| 31 | - $border=8; |
|
| 31 | + $border = 8; |
|
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | // Make sure user_id is in the URL so that share functions work |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | if (!$user_id) { |
| 38 | 38 | $user = get_logged_in_user(); |
| 39 | 39 | Header(sprintf('Location: %s/cert_all.php?user_id=%d%s', |
| 40 | - url_base(), $user->id, $border==0?'&border=no':'' |
|
| 40 | + url_base(), $user->id, $border == 0 ? '&border=no' : '' |
|
| 41 | 41 | )); |
| 42 | 42 | exit; |
| 43 | 43 | } |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | <tr><th align=left>Project</th><th align=left>Cobblestones</th><th align=left>Joined</th></tr> |
| 92 | 92 | "; |
| 93 | 93 | foreach ($user->projects as $p) { |
| 94 | - if ($p->total_credit<100) continue; |
|
| 94 | + if ($p->total_credit < 100) continue; |
|
| 95 | 95 | show_proj($p); |
| 96 | 96 | } |
| 97 | 97 | echo " |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | if (!defined("DELETE_DELAY")) define("DELETE_DELAY", 2); |
| 43 | 43 | |
| 44 | 44 | function is_delete_account_token_valid($userid, $token) { |
| 45 | - if (!is_valid_token($userid, $token, TOKEN_TYPE_DELETE_ACCOUNT) ) { |
|
| 45 | + if (!is_valid_token($userid, $token, TOKEN_TYPE_DELETE_ACCOUNT)) { |
|
| 46 | 46 | sleep(LOGIN_FAIL_SLEEP_SEC); |
| 47 | 47 | return false; |
| 48 | 48 | } |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | // |
| 127 | 127 | function is_over_but_not_validated($res) { |
| 128 | 128 | if ($res->server_state == RESULT_SERVER_STATE_OVER && $res->outcome == RESULT_OUTCOME_SUCCESS && |
| 129 | - ($res->validate_state == VALIDATE_STATE_INIT || $res->validate_state == VALIDATE_STATE_INCONCLUSIVE) ) { |
|
| 129 | + ($res->validate_state == VALIDATE_STATE_INIT || $res->validate_state == VALIDATE_STATE_INCONCLUSIVE)) { |
|
| 130 | 130 | return true; |
| 131 | 131 | } |
| 132 | 132 | return false; |
@@ -144,8 +144,8 @@ discard block |
||
| 144 | 144 | // |
| 145 | 145 | function cancel_results_for_user($user) { |
| 146 | 146 | $ress = BoincResult::enum("userid = $user->id"); |
| 147 | - $cancel_clause="server_state=".RESULT_SERVER_STATE_OVER.", outcome=".RESULT_OUTCOME_CLIENT_DETACHED.", validate_state=".VALIDATE_STATE_INVALID; |
|
| 148 | - $set_id_clause="hostid=0, userid=0"; |
|
| 147 | + $cancel_clause = "server_state=".RESULT_SERVER_STATE_OVER.", outcome=".RESULT_OUTCOME_CLIENT_DETACHED.", validate_state=".VALIDATE_STATE_INVALID; |
|
| 148 | + $set_id_clause = "hostid=0, userid=0"; |
|
| 149 | 149 | foreach ($ress as $res) { |
| 150 | 150 | if (is_in_progress($res) || is_over_but_not_validated($res)) { |
| 151 | 151 | $res->update($cancel_clause.", ".$set_id_clause); |
@@ -168,12 +168,12 @@ discard block |
||
| 168 | 168 | |
| 169 | 169 | // delete remote submit user |
| 170 | 170 | // |
| 171 | - delete_remote_submit_user($user); // from submit_util.inc |
|
| 171 | + delete_remote_submit_user($user); // from submit_util.inc |
|
| 172 | 172 | |
| 173 | 173 | // remove user's team records |
| 174 | 174 | // |
| 175 | - user_erase_team_owner($user); // from team.inc |
|
| 176 | - user_quit_team($user); // from team.inc |
|
| 175 | + user_erase_team_owner($user); // from team.inc |
|
| 176 | + user_quit_team($user); // from team.inc |
|
| 177 | 177 | user_erase_team_delta($user); // from team.inc |
| 178 | 178 | |
| 179 | 179 | // Items that do not have logic elsewhere |
@@ -200,6 +200,6 @@ discard block |
||
| 200 | 200 | BoincTeamAdmin::delete("userid=$user->id"); |
| 201 | 201 | |
| 202 | 202 | // final action |
| 203 | - delete_user($user); //from user_util.inc |
|
| 203 | + delete_user($user); //from user_util.inc |
|
| 204 | 204 | return 0; |
| 205 | 205 | } |
@@ -42,9 +42,9 @@ discard block |
||
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | abstract class PREF { |
| 45 | - public $desc; // short description |
|
| 46 | - public $tooltip; // longer description, shown as tooltip |
|
| 47 | - public $tag; // the pref's primary XML tag |
|
| 45 | + public $desc; // short description |
|
| 46 | + public $tooltip; // longer description, shown as tooltip |
|
| 47 | + public $tag; // the pref's primary XML tag |
|
| 48 | 48 | function __construct($desc, $tooltip, $tag) { |
| 49 | 49 | $this->desc = $desc; |
| 50 | 50 | $this->tooltip = $tooltip; |
@@ -122,15 +122,15 @@ discard block |
||
| 122 | 122 | |
| 123 | 123 | class PREF_BOOL extends PREF { |
| 124 | 124 | public $default; |
| 125 | - public $invert; // show to user in opposite sense |
|
| 126 | - function __construct($desc, $tooltip, $tag, $default, $invert=false) { |
|
| 125 | + public $invert; // show to user in opposite sense |
|
| 126 | + function __construct($desc, $tooltip, $tag, $default, $invert = false) { |
|
| 127 | 127 | $this->default = $default; |
| 128 | 128 | $this->invert = $invert; |
| 129 | 129 | parent::__construct($desc, $tooltip, $tag); |
| 130 | 130 | } |
| 131 | 131 | function show_value($prefs) { |
| 132 | 132 | $tag = $this->tag; |
| 133 | - $v = $this->invert?!$prefs->$tag:$prefs->$tag; |
|
| 133 | + $v = $this->invert ? !$prefs->$tag : $prefs->$tag; |
|
| 134 | 134 | echo "<td>".readonly_checkbox($v)."</td>"; |
| 135 | 135 | } |
| 136 | 136 | function show_form($prefs, $error) { |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | } |
| 143 | 143 | echo "<td ".VALUE_ATTRS.">" |
| 144 | 144 | ."<input type=checkbox name=$this->tag " |
| 145 | - . ($checked?"checked":"") |
|
| 145 | + . ($checked ? "checked" : "") |
|
| 146 | 146 | ."></td> |
| 147 | 147 | "; |
| 148 | 148 | } |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | function xml_string($prefs) { |
| 156 | 156 | $tag = $this->tag; |
| 157 | 157 | return "<$tag>" |
| 158 | - .($prefs->$tag?"1":"0") |
|
| 158 | + .($prefs->$tag ? "1" : "0") |
|
| 159 | 159 | ."</$tag>\n"; |
| 160 | 160 | } |
| 161 | 161 | function xml_parse(&$prefs, $name, $text) { |
@@ -175,9 +175,9 @@ discard block |
||
| 175 | 175 | public $consent_type_id; // the consent_type_id from the consent_type table |
| 176 | 176 | public $consent_name; // the consent_name to configure |
| 177 | 177 | public $default; |
| 178 | - public $invert; // show to user in opposite sense |
|
| 178 | + public $invert; // show to user in opposite sense |
|
| 179 | 179 | |
| 180 | - function __construct($desc, $tooltip, $tag, $consent_type_id, $consent_name, $default, $invert=false) { |
|
| 180 | + function __construct($desc, $tooltip, $tag, $consent_type_id, $consent_name, $default, $invert = false) { |
|
| 181 | 181 | $this->consent_type_id = $consent_type_id; |
| 182 | 182 | $this->consent_name = $consent_name; |
| 183 | 183 | $this->default = $default; |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | } else { |
| 241 | 241 | $value = false; |
| 242 | 242 | } |
| 243 | - echo "<td>" . readonly_checkbox($value) . "</td>"; |
|
| 243 | + echo "<td>".readonly_checkbox($value)."</td>"; |
|
| 244 | 244 | } |
| 245 | 245 | function show_form($user, $error) { |
| 246 | 246 | $consent_type_id = $this->consent_type_id; |
@@ -257,7 +257,7 @@ discard block |
||
| 257 | 257 | } |
| 258 | 258 | echo "<td ".VALUE_ATTRS.">" |
| 259 | 259 | ."<input type=checkbox name=$this->tag " |
| 260 | - . ($checked?"checked":"") |
|
| 260 | + . ($checked ? "checked" : "") |
|
| 261 | 261 | ."></td> |
| 262 | 262 | "; |
| 263 | 263 | } |
@@ -276,7 +276,7 @@ discard block |
||
| 276 | 276 | "userid=$user->id AND consent_type_id='$consent_type_id$'" |
| 277 | 277 | ); |
| 278 | 278 | |
| 279 | - if ((($cr) and ($cr->consent_flag!=$flag)) or (!$cr)) { |
|
| 279 | + if ((($cr) and ($cr->consent_flag != $flag)) or (!$cr)) { |
|
| 280 | 280 | $rc = consent_to_a_policy( |
| 281 | 281 | $user, $consent_type_id, $flag, 0, 'Webform', time() |
| 282 | 282 | ); |
@@ -316,7 +316,7 @@ discard block |
||
| 316 | 316 | // this is the value if they check the box |
| 317 | 317 | public $scale; |
| 318 | 318 | |
| 319 | - function __construct($suffix, $min, $max, $default, $scale=1, $default2=0) { |
|
| 319 | + function __construct($suffix, $min, $max, $default, $scale = 1, $default2 = 0) { |
|
| 320 | 320 | $this->suffix = " $suffix"; |
| 321 | 321 | $this->min = $min; |
| 322 | 322 | $this->max = $max; |
@@ -335,7 +335,7 @@ discard block |
||
| 335 | 335 | $v .= "$this->suffix "; |
| 336 | 336 | return $v; |
| 337 | 337 | } |
| 338 | - function form_str($tag, $v, $had_error, $disabled=false, $id=null) { |
|
| 338 | + function form_str($tag, $v, $had_error, $disabled = false, $id = null) { |
|
| 339 | 339 | if (is_numeric($v)) { |
| 340 | 340 | $v /= $this->scale; |
| 341 | 341 | if (!$had_error && ($v < $this->min || $v > $this->max)) { |
@@ -343,7 +343,7 @@ discard block |
||
| 343 | 343 | } |
| 344 | 344 | } |
| 345 | 345 | if ($disabled) $v = ""; |
| 346 | - $i = $id?"id=\"$id\"":""; |
|
| 346 | + $i = $id ? "id=\"$id\"" : ""; |
|
| 347 | 347 | return '<input type="text" size="5" class="form-control input-sm" name="'.$tag.'" value="'.$v."\" $disabled $i> $this->suffix "; |
| 348 | 348 | } |
| 349 | 349 | function form_convert($in, &$out, &$error) { |
@@ -466,8 +466,8 @@ discard block |
||
| 466 | 466 | $text_id = $this->tag; |
| 467 | 467 | $default = $this->num_spec->get_default(); |
| 468 | 468 | $val = $prefs->$tag; |
| 469 | - $c = $val?"checked":""; |
|
| 470 | - $d = $val?"":"disabled"; |
|
| 469 | + $c = $val ? "checked" : ""; |
|
| 470 | + $d = $val ? "" : "disabled"; |
|
| 471 | 471 | echo "<td $attrs>" |
| 472 | 472 | ."<input type=checkbox id=$checkbox_id onClick=\"checkbox_clicked('$checkbox_id', '$text_id', $default)\" $c> " |
| 473 | 473 | .$this->num_spec->form_str($tag, $prefs->$tag, $had_error, $d, $text_id) |
@@ -580,8 +580,8 @@ discard block |
||
| 580 | 580 | function hour_select($x, $name, $id, $d) { |
| 581 | 581 | $s = ""; |
| 582 | 582 | $s .= "<select class=\"selectbox form-control input-sm\" name=$name id=$id $d>\n"; |
| 583 | - for ($i=0; $i<24; $i++) { |
|
| 584 | - $sel = ($x == $i)?"selected":""; |
|
| 583 | + for ($i = 0; $i < 24; $i++) { |
|
| 584 | + $sel = ($x == $i) ? "selected" : ""; |
|
| 585 | 585 | $s .= "<option value=$i $sel> $i:00"; |
| 586 | 586 | } |
| 587 | 587 | $s .= "</select>\n"; |
@@ -682,7 +682,7 @@ discard block |
||
| 682 | 682 | |
| 683 | 683 | // row_defs - Display a value for all 4 venues in one row |
| 684 | 684 | // |
| 685 | -function row_defs($pre, $item, $post, $type, $prefs, $tooltip=null) { |
|
| 685 | +function row_defs($pre, $item, $post, $type, $prefs, $tooltip = null) { |
|
| 686 | 686 | $gen = $prefs->$item; |
| 687 | 687 | $hom = (isset($prefs->home) && isset($prefs->home->$item)) ? $prefs->home->$item : "--"; |
| 688 | 688 | $schl = (isset($prefs->school) && isset($prefs->school->$item)) ? $prefs->school->$item : "--"; |
@@ -694,10 +694,10 @@ discard block |
||
| 694 | 694 | echo "<tr>"; |
| 695 | 695 | } |
| 696 | 696 | echo "<td ".NAME_ATTRS.">$pre</td>"; |
| 697 | - row_field($gen, $type); |
|
| 698 | - row_field($hom, $type); |
|
| 697 | + row_field($gen, $type); |
|
| 698 | + row_field($hom, $type); |
|
| 699 | 699 | row_field($schl, $type); |
| 700 | - row_field($wrk, $type); |
|
| 700 | + row_field($wrk, $type); |
|
| 701 | 701 | echo "<td align=left>$post</td></tr>\n"; |
| 702 | 702 | } |
| 703 | 703 | |
@@ -707,16 +707,16 @@ discard block |
||
| 707 | 707 | function row_field($value, $type) { |
| 708 | 708 | echo "<td>"; |
| 709 | 709 | $type = $value === "--" ? "--" : $type; |
| 710 | - switch($type) { |
|
| 710 | + switch ($type) { |
|
| 711 | 711 | case "yesno": |
| 712 | - echo $value ?tra("yes"):tra("no"); |
|
| 712 | + echo $value ?tra("yes") : tra("no"); |
|
| 713 | 713 | break; |
| 714 | 714 | case "noyes": |
| 715 | - echo $value ?tra("no"):tra("yes"); |
|
| 715 | + echo $value ?tra("no") : tra("yes"); |
|
| 716 | 716 | break; |
| 717 | 717 | case "limit": |
| 718 | 718 | $x = max_bytes_display_mode($value); |
| 719 | - $y = "$x " . BYTE_ABBR; |
|
| 719 | + $y = "$x ".BYTE_ABBR; |
|
| 720 | 720 | echo $x ? "$y" : tra("no limit"); |
| 721 | 721 | break; |
| 722 | 722 | case "minutes": |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | |
| 42 | 42 | |
| 43 | 43 | // returns formatted data size |
| 44 | -function size_format($size){ |
|
| 44 | +function size_format($size) { |
|
| 45 | 45 | $retval = 0; |
| 46 | 46 | |
| 47 | 47 | $KB = 1024; |
@@ -52,13 +52,13 @@ discard block |
||
| 52 | 52 | if ($size < $KB) { |
| 53 | 53 | $retval = $size; |
| 54 | 54 | } elseif (($size > $KB) && ($size < $MB)) { |
| 55 | - $retval = sprintf("%.0fK", ($size / $KB)); |
|
| 56 | - } elseif ( ($size >= $MB) && ($size < $GB)) { |
|
| 57 | - $retval = sprintf("%.2fMB", ($size / $MB)); |
|
| 58 | - } elseif ( ($size >= $GB) && ($size < $TB)) { |
|
| 59 | - $retval = sprintf("%.2fGB", ($size / $GB)); |
|
| 60 | - } elseif ( $size >= $TB ) { |
|
| 61 | - $retval = sprintf("%.2fTB", ($size / $TB)); |
|
| 55 | + $retval = sprintf("%.0fK", ($size/$KB)); |
|
| 56 | + } elseif (($size >= $MB) && ($size < $GB)) { |
|
| 57 | + $retval = sprintf("%.2fMB", ($size/$MB)); |
|
| 58 | + } elseif (($size >= $GB) && ($size < $TB)) { |
|
| 59 | + $retval = sprintf("%.2fGB", ($size/$GB)); |
|
| 60 | + } elseif ($size >= $TB) { |
|
| 61 | + $retval = sprintf("%.2fTB", ($size/$TB)); |
|
| 62 | 62 | } |
| 63 | 63 | return $retval; |
| 64 | 64 | } |
@@ -89,9 +89,9 @@ discard block |
||
| 89 | 89 | if ($myarr['Comment'] == 'VIEW') continue; |
| 90 | 90 | |
| 91 | 91 | // sum grand totals |
| 92 | - $total = $myarr["Data_length"] + $myarr["Index_length"]; |
|
| 92 | + $total = $myarr["Data_length"] + $myarr["Index_length"]; |
|
| 93 | 93 | $gindex += $myarr["Index_length"]; |
| 94 | - $gdata += $myarr["Data_length"]; |
|
| 94 | + $gdata += $myarr["Data_length"]; |
|
| 95 | 95 | $grows += $myarr["Rows"]; |
| 96 | 96 | $gtotal += $total; |
| 97 | 97 | |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | ); |
| 106 | 106 | $i++; |
| 107 | 107 | } |
| 108 | - $db_rec[$i] = new DB_REC ("Total", $gdata, $gindex, $gtotal, $grows, "" ); |
|
| 108 | + $db_rec[$i] = new DB_REC("Total", $gdata, $gindex, $gtotal, $grows, ""); |
|
| 109 | 109 | return $db_rec; |
| 110 | 110 | } |
| 111 | 111 | |
@@ -126,25 +126,25 @@ discard block |
||
| 126 | 126 | echo "<th>Avg. Size per Row</th>"; |
| 127 | 127 | echo "</tr>"; |
| 128 | 128 | |
| 129 | - for ($i = 0; $i < sizeof($db_rec)-1; $i++){ |
|
| 129 | + for ($i = 0; $i < sizeof($db_rec) - 1; $i++) { |
|
| 130 | 130 | echo "<tr>"; |
| 131 | - echo "<td align=left valign=top class=fieldname>" . $db_rec[$i]->name . "</td>"; |
|
| 132 | - echo "<td align=left valign=top class=fieldname>" . size_format($db_rec[$i]->data_size) . "</td>"; |
|
| 133 | - echo "<td align=left valign=top class=fieldname>" . size_format($db_rec[$i]->index_size) . "</td>"; |
|
| 134 | - echo "<td align=left valign=top class=fieldname>" . size_format($db_rec[$i]->total_size) . "</td>"; |
|
| 135 | - echo "<td align=left valign=top class=fieldname>" . number_format($db_rec[$i]->rows) . "</td>"; |
|
| 136 | - echo "<td align=left valign=top class=fieldname>" . size_format($db_rec[$i]->size_per_row) . "</td>"; |
|
| 131 | + echo "<td align=left valign=top class=fieldname>".$db_rec[$i]->name."</td>"; |
|
| 132 | + echo "<td align=left valign=top class=fieldname>".size_format($db_rec[$i]->data_size)."</td>"; |
|
| 133 | + echo "<td align=left valign=top class=fieldname>".size_format($db_rec[$i]->index_size)."</td>"; |
|
| 134 | + echo "<td align=left valign=top class=fieldname>".size_format($db_rec[$i]->total_size)."</td>"; |
|
| 135 | + echo "<td align=left valign=top class=fieldname>".number_format($db_rec[$i]->rows)."</td>"; |
|
| 136 | + echo "<td align=left valign=top class=fieldname>".size_format($db_rec[$i]->size_per_row)."</td>"; |
|
| 137 | 137 | echo "</tr>"; |
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | // Last record is just a summary |
| 141 | - $i = sizeof($db_rec)-1; |
|
| 141 | + $i = sizeof($db_rec) - 1; |
|
| 142 | 142 | echo "<tr>"; |
| 143 | - echo "<th align=left>" . $db_rec[$i]->name . "</th>"; |
|
| 144 | - echo "<th align=left>" . size_format($db_rec[$i]->data_size) . "</th>"; |
|
| 145 | - echo "<th align=left>" . size_format($db_rec[$i]->index_size) . "</th>"; |
|
| 146 | - echo "<th align=left>" . size_format($db_rec[$i]->total_size) . "</th>"; |
|
| 147 | - echo "<th align=left>" . number_format($db_rec[$i]->rows) . "</th>"; |
|
| 143 | + echo "<th align=left>".$db_rec[$i]->name."</th>"; |
|
| 144 | + echo "<th align=left>".size_format($db_rec[$i]->data_size)."</th>"; |
|
| 145 | + echo "<th align=left>".size_format($db_rec[$i]->index_size)."</th>"; |
|
| 146 | + echo "<th align=left>".size_format($db_rec[$i]->total_size)."</th>"; |
|
| 147 | + echo "<th align=left>".number_format($db_rec[$i]->rows)."</th>"; |
|
| 148 | 148 | echo "<th align=left></th>"; |
| 149 | 149 | echo "</tr>"; |
| 150 | 150 | echo "</table>"; |
@@ -156,28 +156,28 @@ discard block |
||
| 156 | 156 | $file_list = array(); |
| 157 | 157 | $file_sort = array(); |
| 158 | 158 | |
| 159 | - $sort = get_str("sort", true); |
|
| 159 | + $sort = get_str("sort", true); |
|
| 160 | 160 | $r = get_str("r", true); |
| 161 | 161 | |
| 162 | 162 | if (empty($sort)) $sort = "name"; |
| 163 | 163 | // check for allowed keys |
| 164 | - if ((strcmp($sort, "name")!=0) && |
|
| 165 | - (strcmp($sort, "data_size")!=0) && |
|
| 166 | - (strcmp($sort, "index_size")!=0) && |
|
| 167 | - (strcmp($sort, "total_size")!=0) && |
|
| 168 | - (strcmp($sort, "rows")!=0) && |
|
| 169 | - (strcmp($sort, "size_per_row")!=0) |
|
| 164 | + if ((strcmp($sort, "name") != 0) && |
|
| 165 | + (strcmp($sort, "data_size") != 0) && |
|
| 166 | + (strcmp($sort, "index_size") != 0) && |
|
| 167 | + (strcmp($sort, "total_size") != 0) && |
|
| 168 | + (strcmp($sort, "rows") != 0) && |
|
| 169 | + (strcmp($sort, "size_per_row") != 0) |
|
| 170 | 170 | ) { |
| 171 | 171 | $sort = "name"; |
| 172 | 172 | } |
| 173 | - if (empty($r)) $r=0; |
|
| 173 | + if (empty($r)) $r = 0; |
|
| 174 | 174 | |
| 175 | - for ($i=0; $i < sizeof($db_rec)-1; $i++){ |
|
| 175 | + for ($i = 0; $i < sizeof($db_rec) - 1; $i++) { |
|
| 176 | 176 | $file_details["name"] = $db_rec[$i]->name; |
| 177 | 177 | $file_details["data_size"] = $db_rec[$i]->data_size; |
| 178 | 178 | $file_details["index_size"] = $db_rec[$i]->index_size; |
| 179 | 179 | $file_details["total_size"] = $db_rec[$i]->total_size; |
| 180 | - $file_details["rows"] = $db_rec[$i]->rows; |
|
| 180 | + $file_details["rows"] = $db_rec[$i]->rows; |
|
| 181 | 181 | $file_details["size_per_row"] = $db_rec[$i]->size_per_row; |
| 182 | 182 | |
| 183 | 183 | $file_list[$i] = $file_details; |
@@ -197,35 +197,35 @@ discard block |
||
| 197 | 197 | echo "</tr>"; |
| 198 | 198 | |
| 199 | 199 | echo "<tr>"; |
| 200 | - echo "<th><a href='dbinfo.php?sort=name&r=" . (!$r) . "'>Table </a></th>"; |
|
| 201 | - echo "<th><a href='dbinfo.php?sort=data_size&r=" . (!$r) . "'>Data Size</a></th>"; |
|
| 202 | - echo "<th><a href='dbinfo.php?sort=index_size&r=" . (!$r) . "'>Index Size</a></th>"; |
|
| 203 | - echo "<th><a href='dbinfo.php?sort=total_size&r=" . (!$r) . "'>Total Size</a></th>"; |
|
| 204 | - echo "<th><a href='dbinfo.php?sort=rows&r=" . (!$r) . "'>Total Rows</a></th>"; |
|
| 205 | - echo "<th><a href='dbinfo.php?sort=size_per_row&r=" . (!$r) . "'>Avg. Size per Row</a></th>"; |
|
| 200 | + echo "<th><a href='dbinfo.php?sort=name&r=".(!$r)."'>Table </a></th>"; |
|
| 201 | + echo "<th><a href='dbinfo.php?sort=data_size&r=".(!$r)."'>Data Size</a></th>"; |
|
| 202 | + echo "<th><a href='dbinfo.php?sort=index_size&r=".(!$r)."'>Index Size</a></th>"; |
|
| 203 | + echo "<th><a href='dbinfo.php?sort=total_size&r=".(!$r)."'>Total Size</a></th>"; |
|
| 204 | + echo "<th><a href='dbinfo.php?sort=rows&r=".(!$r)."'>Total Rows</a></th>"; |
|
| 205 | + echo "<th><a href='dbinfo.php?sort=size_per_row&r=".(!$r)."'>Avg. Size per Row</a></th>"; |
|
| 206 | 206 | echo "</tr>"; |
| 207 | 207 | |
| 208 | 208 | foreach ($file_sort as $key=>$value) { |
| 209 | 209 | $value = $file_list[$key]; |
| 210 | 210 | |
| 211 | 211 | echo "<tr>"; |
| 212 | - echo "<td align=left valign=top class=fieldname>" . $value["name"] . "</td>"; |
|
| 213 | - echo "<td align=left valign=top class=fieldname>" . size_format($value["data_size"]) . "</td>"; |
|
| 214 | - echo "<td align=left valign=top class=fieldname>" . size_format($value["index_size"]) . "</td>"; |
|
| 215 | - echo "<td align=left valign=top class=fieldname>" . size_format($value["total_size"]) . "</td>"; |
|
| 216 | - echo "<td align=left valign=top class=fieldname>" . number_format($value["rows"]) . "</td>"; |
|
| 217 | - echo "<td align=left valign=top class=fieldname>" . size_format($value["size_per_row"]) . "</td>"; |
|
| 212 | + echo "<td align=left valign=top class=fieldname>".$value["name"]."</td>"; |
|
| 213 | + echo "<td align=left valign=top class=fieldname>".size_format($value["data_size"])."</td>"; |
|
| 214 | + echo "<td align=left valign=top class=fieldname>".size_format($value["index_size"])."</td>"; |
|
| 215 | + echo "<td align=left valign=top class=fieldname>".size_format($value["total_size"])."</td>"; |
|
| 216 | + echo "<td align=left valign=top class=fieldname>".number_format($value["rows"])."</td>"; |
|
| 217 | + echo "<td align=left valign=top class=fieldname>".size_format($value["size_per_row"])."</td>"; |
|
| 218 | 218 | echo "</tr>"; |
| 219 | 219 | } |
| 220 | 220 | |
| 221 | 221 | // Last record is a summary |
| 222 | - $i = sizeof($db_rec)-1; |
|
| 222 | + $i = sizeof($db_rec) - 1; |
|
| 223 | 223 | echo "<tr>"; |
| 224 | - echo "<th align=left>" . $db_rec[$i]->name . "</th>"; |
|
| 225 | - echo "<th align=left>" . size_format($db_rec[$i]->data_size) . "</th>"; |
|
| 226 | - echo "<th align=left>" . size_format($db_rec[$i]->index_size) . "</th>"; |
|
| 227 | - echo "<th align=left>" . size_format($db_rec[$i]->total_size) . "</th>"; |
|
| 228 | - echo "<th align=left>" . number_format($db_rec[$i]->rows) . "</th>"; |
|
| 224 | + echo "<th align=left>".$db_rec[$i]->name."</th>"; |
|
| 225 | + echo "<th align=left>".size_format($db_rec[$i]->data_size)."</th>"; |
|
| 226 | + echo "<th align=left>".size_format($db_rec[$i]->index_size)."</th>"; |
|
| 227 | + echo "<th align=left>".size_format($db_rec[$i]->total_size)."</th>"; |
|
| 228 | + echo "<th align=left>".number_format($db_rec[$i]->rows)."</th>"; |
|
| 229 | 229 | echo "<th align=left></th>"; |
| 230 | 230 | echo "</tr>"; |
| 231 | 231 | |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | |
| 18 | 18 | display_errors(); |
| 19 | 19 | |
| 20 | -$debug=0; |
|
| 20 | +$debug = 0; |
|
| 21 | 21 | |
| 22 | 22 | // test a LAMMPS job |
| 23 | 23 | // |
@@ -30,17 +30,17 @@ discard block |
||
| 30 | 30 | // output: success flag, CPU time per step, est. disk usage per job |
| 31 | 31 | // |
| 32 | 32 | function terminate_job($p) { |
| 33 | - $pstatus=proc_get_status($p); |
|
| 34 | - $ppid=$pstatus['pid']; |
|
| 35 | - $ret=`ps -o pid --no-heading --ppid $ppid`; |
|
| 33 | + $pstatus = proc_get_status($p); |
|
| 34 | + $ppid = $pstatus['pid']; |
|
| 35 | + $ret = `ps -o pid --no-heading --ppid $ppid`; |
|
| 36 | 36 | //echo "parent pid is $ppid\nterninate it\n"; |
| 37 | 37 | proc_terminate($p); |
| 38 | 38 | // echo "child process is $ret\n"; |
| 39 | - $pids=preg_split('/\s+/',$ret); |
|
| 40 | - foreach($pids as $pid){ |
|
| 41 | - if(is_numeric($pid)){ |
|
| 42 | - if($GLOBALS["debug"])echo "killing child process $pid\n"; |
|
| 43 | - posix_kill($pid,9); |
|
| 39 | + $pids = preg_split('/\s+/', $ret); |
|
| 40 | + foreach ($pids as $pid) { |
|
| 41 | + if (is_numeric($pid)) { |
|
| 42 | + if ($GLOBALS["debug"])echo "killing child process $pid\n"; |
|
| 43 | + posix_kill($pid, 9); |
|
| 44 | 44 | } |
| 45 | 45 | } |
| 46 | 46 | } |
@@ -51,23 +51,23 @@ discard block |
||
| 51 | 51 | $descs = array(); |
| 52 | 52 | $pipes = array(); |
| 53 | 53 | $options = file("cmd_variables"); |
| 54 | - $options[0] = chop($options[0],"\n"); |
|
| 54 | + $options[0] = chop($options[0], "\n"); |
|
| 55 | 55 | $cmd = "../lmp_linux ".$options[0]."&>output"; |
| 56 | 56 | if ($GLOBALS["debug"]) echo $cmd."<br>"; |
| 57 | 57 | system("unzip pot_files >/dev/null"); |
| 58 | 58 | $stime = time(); |
| 59 | 59 | $p = proc_open("$cmd", $descs, $pipes); |
| 60 | 60 | while (1) { |
| 61 | - $ctime=time(); |
|
| 62 | - if($ctime-$stime >=2 and ! file_exists("log.1")){ |
|
| 63 | - if($GLOBALS["debug"]) echo "time out "."<br>"; |
|
| 61 | + $ctime = time(); |
|
| 62 | + if ($ctime - $stime >= 2 and !file_exists("log.1")) { |
|
| 63 | + if ($GLOBALS["debug"]) echo "time out "."<br>"; |
|
| 64 | 64 | terminate_job($p); |
| 65 | 65 | break; |
| 66 | 66 | } |
| 67 | 67 | if (file_exists("log.1")) { |
| 68 | 68 | list($avg_cpu, $test_steps) = calc_step_cpu("log.1"); |
| 69 | 69 | if ($avg_cpu != 0) { |
| 70 | - if($GLOBALS["debug"])echo "avg_cpu is ".$avg_cpu."<br>"; |
|
| 70 | + if ($GLOBALS["debug"])echo "avg_cpu is ".$avg_cpu."<br>"; |
|
| 71 | 71 | terminate_job($p); |
| 72 | 72 | $test_result = 1; |
| 73 | 73 | break; |
@@ -86,32 +86,32 @@ discard block |
||
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | function get_total_steps($cmd_file) { |
| 89 | - $fd = fopen($cmd_file,"r"); |
|
| 89 | + $fd = fopen($cmd_file, "r"); |
|
| 90 | 90 | if (!$fd) { |
| 91 | 91 | echo "can not open file $cmd_file\n"; |
| 92 | 92 | exit(-1); |
| 93 | 93 | } |
| 94 | 94 | $this_loopno = 1; |
| 95 | 95 | $this_looprun = 1; |
| 96 | - $total_steps=1; |
|
| 96 | + $total_steps = 1; |
|
| 97 | 97 | while (!feof($fd)) { |
| 98 | - $line = fgets($fd,4096); |
|
| 98 | + $line = fgets($fd, 4096); |
|
| 99 | 99 | if (preg_match("/loopnumber\s+\d+/", $line, $matches) |
| 100 | 100 | && preg_match("/\d+/", $matches[0], $no) |
| 101 | 101 | ) { |
| 102 | - $this_loopno=$no[0]; |
|
| 102 | + $this_loopno = $no[0]; |
|
| 103 | 103 | } |
| 104 | 104 | if (preg_match("/looprun\s+\d+/", $line, $matches) |
| 105 | 105 | and preg_match("/\d+/", $matches[0], $no) |
| 106 | 106 | ) { |
| 107 | - $this_looprun=$no[0]; |
|
| 108 | - if($this_loopno*$this_looprun>$total_steps)$total_steps=$this_loopno*$this_looprun; |
|
| 107 | + $this_looprun = $no[0]; |
|
| 108 | + if ($this_loopno*$this_looprun > $total_steps)$total_steps = $this_loopno*$this_looprun; |
|
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | } |
| 112 | 112 | fclose($fd); |
| 113 | 113 | //$total_steps = $loopno*$looprun; |
| 114 | - if($GLOBALS["debug"])print "total_steps = ".$total_steps."<br>"; |
|
| 114 | + if ($GLOBALS["debug"])print "total_steps = ".$total_steps."<br>"; |
|
| 115 | 115 | return $total_steps; |
| 116 | 116 | } |
| 117 | 117 | |
@@ -129,8 +129,8 @@ discard block |
||
| 129 | 129 | } |
| 130 | 130 | $count = 0; |
| 131 | 131 | while (!feof($fd)) { |
| 132 | - $line = fgets($fd,4096); |
|
| 133 | - if (preg_match('/^Step\s+CPU/',$line)) { |
|
| 132 | + $line = fgets($fd, 4096); |
|
| 133 | + if (preg_match('/^Step\s+CPU/', $line)) { |
|
| 134 | 134 | //echo $line."\n"; |
| 135 | 135 | $start = 1; |
| 136 | 136 | continue; |
@@ -139,24 +139,24 @@ discard block |
||
| 139 | 139 | $arr = preg_split("/\s+/", $line); |
| 140 | 140 | //print_r($arr); |
| 141 | 141 | |
| 142 | - if (count($arr) <=6 || !is_numeric($arr[1])) { |
|
| 142 | + if (count($arr) <= 6 || !is_numeric($arr[1])) { |
|
| 143 | 143 | continue; |
| 144 | 144 | } |
| 145 | 145 | $step = (int)$arr[1]; |
| 146 | 146 | $cpu = (float)$arr[2]; |
| 147 | 147 | //echo "step=".$step." cpu=".$cpu."\n"; |
| 148 | - if ($cpu==0) { |
|
| 149 | - $count=0; |
|
| 148 | + if ($cpu == 0) { |
|
| 149 | + $count = 0; |
|
| 150 | 150 | $start_step = $step; |
| 151 | 151 | } else { |
| 152 | - $count+=1; |
|
| 153 | - if($GLOBALS["debug"])echo "step=".$step." cpu=".$cpu."count=".$count."<br>"; |
|
| 154 | - if($count >= 10) { |
|
| 152 | + $count += 1; |
|
| 153 | + if ($GLOBALS["debug"])echo "step=".$step." cpu=".$cpu."count=".$count."<br>"; |
|
| 154 | + if ($count >= 10) { |
|
| 155 | 155 | $end_step = $step; |
| 156 | - $steps = $end_step-$start_step; |
|
| 156 | + $steps = $end_step - $start_step; |
|
| 157 | 157 | $avg_cpu = $cpu/$steps; |
| 158 | 158 | #$avg_cpu = $cpu/$count; |
| 159 | - if ($GLOBALS["debug"]){ |
|
| 159 | + if ($GLOBALS["debug"]) { |
|
| 160 | 160 | echo "test steps is ".$steps."<br>"; |
| 161 | 161 | echo "avg_cpu is ".$avg_cpu."<br>"; |
| 162 | 162 | } |
@@ -165,56 +165,56 @@ discard block |
||
| 165 | 165 | } |
| 166 | 166 | } |
| 167 | 167 | } |
| 168 | - return array($avg_cpu,$test_steps); |
|
| 168 | + return array($avg_cpu, $test_steps); |
|
| 169 | 169 | } |
| 170 | 170 | |
| 171 | -function calc_est_size($lammps_script, $structure_file, $cmd_file,$test_steps){ |
|
| 171 | +function calc_est_size($lammps_script, $structure_file, $cmd_file, $test_steps) { |
|
| 172 | 172 | $dump_types = 0; |
| 173 | - $fd = fopen($lammps_script,"r"); |
|
| 174 | - if (!$fd){ |
|
| 173 | + $fd = fopen($lammps_script, "r"); |
|
| 174 | + if (!$fd) { |
|
| 175 | 175 | echo "can not open file $lammps_script\n"; |
| 176 | 176 | exit(-1); |
| 177 | 177 | } |
| 178 | - while (!feof($fd)){ |
|
| 178 | + while (!feof($fd)) { |
|
| 179 | 179 | $line = fgets($fd, 4096); |
| 180 | 180 | //if (preg_match("/^\s*dump/", $line) |
| 181 | 181 | // and preg_match_all("/dump\S+\.\w{3}/", $line, $matches, PREG_PATTERN_ORDER)) |
| 182 | 182 | |
| 183 | - if(preg_match("/^\s*dump\s+(\d)\s+/", $line,$matches)) |
|
| 183 | + if (preg_match("/^\s*dump\s+(\d)\s+/", $line, $matches)) |
|
| 184 | 184 | { |
| 185 | - if($GLOBALS["debug"]){print "matches=";print_r($matches);} |
|
| 185 | + if ($GLOBALS["debug"]) {print "matches="; print_r($matches); } |
|
| 186 | 186 | |
| 187 | - $dump_types=(int)$matches[1]; |
|
| 187 | + $dump_types = (int)$matches[1]; |
|
| 188 | 188 | break; |
| 189 | 189 | } |
| 190 | 190 | } |
| 191 | 191 | fclose($fd); |
| 192 | - if($GLOBALS["debug"])print "dump_types= ".$dump_types."<br>"; |
|
| 192 | + if ($GLOBALS["debug"])print "dump_types= ".$dump_types."<br>"; |
|
| 193 | 193 | |
| 194 | 194 | $structure_file_size = filesize($structure_file); |
| 195 | - $fd = fopen($cmd_file,"r"); |
|
| 196 | - if (!$fd){ |
|
| 195 | + $fd = fopen($cmd_file, "r"); |
|
| 196 | + if (!$fd) { |
|
| 197 | 197 | echo "can not open file $cmd_file\n"; |
| 198 | 198 | exit(-1); |
| 199 | 199 | } |
| 200 | - if($GLOBALS["debug"]) print "structure_file_size=".$structure_file_size."<br>"; |
|
| 201 | - |
|
| 202 | - $loopno=1; |
|
| 203 | - $looprun=1; |
|
| 204 | - while (!feof($fd)){ |
|
| 205 | - $line = fgets($fd,4096); |
|
| 206 | - if(preg_match("/loopnumber\s+\d+/", $line, $matches)){ |
|
| 207 | - if(preg_match("/\d+/", $matches[0], $no)){ |
|
| 200 | + if ($GLOBALS["debug"]) print "structure_file_size=".$structure_file_size."<br>"; |
|
| 201 | + |
|
| 202 | + $loopno = 1; |
|
| 203 | + $looprun = 1; |
|
| 204 | + while (!feof($fd)) { |
|
| 205 | + $line = fgets($fd, 4096); |
|
| 206 | + if (preg_match("/loopnumber\s+\d+/", $line, $matches)) { |
|
| 207 | + if (preg_match("/\d+/", $matches[0], $no)) { |
|
| 208 | 208 | //$loopno=$no[0]; |
| 209 | - if($no[0]>$loopno)$loopno=$no[0]; |
|
| 209 | + if ($no[0] > $loopno)$loopno = $no[0]; |
|
| 210 | 210 | } |
| 211 | 211 | } |
| 212 | 212 | if (preg_match("/looprun\s+\d+/", $line, $matches) and preg_match("/\d+/", $matches[0], $no)) { |
| 213 | - if($no[0]>$looprun)$looprun=$no[0]; |
|
| 213 | + if ($no[0] > $looprun)$looprun = $no[0]; |
|
| 214 | 214 | } |
| 215 | 215 | } |
| 216 | 216 | fclose($fd); |
| 217 | - if($GLOBALS["debug"]){ |
|
| 217 | + if ($GLOBALS["debug"]) { |
|
| 218 | 218 | print "max loopno(number of loops to run)=".$loopno."<br>"; |
| 219 | 219 | print "max looprun(steps for each loop)=".$looprun."<br>"; |
| 220 | 220 | } |
@@ -225,12 +225,12 @@ discard block |
||
| 225 | 225 | $dump_files = glob("dump1*"); |
| 226 | 226 | $test_dump_file = $dump_files[0]; |
| 227 | 227 | $test_dump_size = filesize($test_dump_file); |
| 228 | - $dump_size1 = $test_dump_size+0.5*$test_dump_size*ceil(($looprun-$test_steps)/$test_steps); |
|
| 228 | + $dump_size1 = $test_dump_size + 0.5*$test_dump_size*ceil(($looprun - $test_steps)/$test_steps); |
|
| 229 | 229 | $dump_size = $loopno*$dump_size1*$dump_types; |
| 230 | 230 | $app_fixed_size = 5e7; |
| 231 | - $est_size = $log_size+$dump_size+$app_fixed_size; |
|
| 231 | + $est_size = $log_size + $dump_size + $app_fixed_size; |
|
| 232 | 232 | |
| 233 | - if($GLOBALS["debug"]){ |
|
| 233 | + if ($GLOBALS["debug"]) { |
|
| 234 | 234 | print "test_steps=".$test_steps."<br>"; |
| 235 | 235 | print "test_log_size=".$test_log_size."<br>"; |
| 236 | 236 | print "log_size1=".$log_size1."<br>"; |
@@ -321,7 +321,7 @@ discard block |
||
| 321 | 321 | if ($njobs < $nhosts) { |
| 322 | 322 | return $flops_per_job/$median_flops; |
| 323 | 323 | } else { |
| 324 | - $k = (int)(($njobs+$nhosts-1)/$nhosts); |
|
| 324 | + $k = (int)(($njobs + $nhosts - 1)/$nhosts); |
|
| 325 | 325 | return $k*$flops_per_job/$median_flops; |
| 326 | 326 | } |
| 327 | 327 | } |
@@ -361,27 +361,27 @@ discard block |
||
| 361 | 361 | if ($GLOBALS["debug"]) { |
| 362 | 362 | print "est_cpu_time is ".$est_cpu_time."<br>"; |
| 363 | 363 | } |
| 364 | - if ($error==0) { |
|
| 365 | - $err_msgs=file("output"); |
|
| 366 | - $err="Your test job <strong>failed</strong> |
|
| 364 | + if ($error == 0) { |
|
| 365 | + $err_msgs = file("output"); |
|
| 366 | + $err = "Your test job <strong>failed</strong> |
|
| 367 | 367 | <br>Please refer to the following Error Message:<br><p> |
| 368 | 368 | "; |
| 369 | - foreach($err_msgs as $line){ |
|
| 370 | - $err=$err.$line."<br>"; |
|
| 369 | + foreach ($err_msgs as $line) { |
|
| 370 | + $err = $err.$line."<br>"; |
|
| 371 | 371 | } |
| 372 | - $err=$err." <p> |
|
| 372 | + $err = $err." <p> |
|
| 373 | 373 | <a href=sandbox.php><strong> File_Sandbox </strong></a> |
| 374 | 374 | "; |
| 375 | 375 | error_page($err); |
| 376 | 376 | } |
| 377 | 377 | |
| 378 | 378 | system("rm *"); |
| 379 | - $info->rsc_fpops_est = $est_cpu_time * 1.5e9; |
|
| 380 | - $info->rsc_fpops_bound = $info->rsc_fpops_est * 20; |
|
| 379 | + $info->rsc_fpops_est = $est_cpu_time*1.5e9; |
|
| 380 | + $info->rsc_fpops_bound = $info->rsc_fpops_est*20; |
|
| 381 | 381 | |
| 382 | - if ($disk==0){ |
|
| 383 | - $info->rsc_disk_bound=1000000; |
|
| 384 | - } else{ |
|
| 382 | + if ($disk == 0) { |
|
| 383 | + $info->rsc_disk_bound = 1000000; |
|
| 384 | + } else { |
|
| 385 | 385 | $info->rsc_disk_bound = $disk; |
| 386 | 386 | } |
| 387 | 387 | |
@@ -392,7 +392,7 @@ discard block |
||
| 392 | 392 | // |
| 393 | 393 | $njobs = count(file($cmdline_file_path)); |
| 394 | 394 | $secs_est = estimated_makespan($njobs, $info->rsc_fpops_est); |
| 395 | - if($GLOBALS["debug"])echo "secs_est is $secs_est\n"; |
|
| 395 | + if ($GLOBALS["debug"])echo "secs_est is $secs_est\n"; |
|
| 396 | 396 | //assume the server's flops is 1.5G and the average client's flops is 1G |
| 397 | 397 | $hrs_est = number_format($secs_est*1.5/60, 2); |
| 398 | 398 | //$hrs_est = number_format($secs_est, 2); |
@@ -416,8 +416,8 @@ discard block |
||
| 416 | 416 | } |
| 417 | 417 | |
| 418 | 418 | function submit_job($app, $batch_id, $info, $cmdline, $i) { |
| 419 | - $client_disk=$info->rsc_disk_bound*2; |
|
| 420 | - if($client_disk<500000000) $client_disk=500000000; |
|
| 419 | + $client_disk = $info->rsc_disk_bound*2; |
|
| 420 | + if ($client_disk < 500000000) $client_disk = 500000000; |
|
| 421 | 421 | $cmd = "cd ../..; ./bin/create_work --appname $app->name --batch $batch_id --rsc_fpops_est $info->rsc_fpops_est --rsc_fpops_bound $info->rsc_fpops_bound --rsc_disk_bound $client_disk"; |
| 422 | 422 | if ($cmdline) { |
| 423 | 423 | $cmd .= " --command_line \"$cmdline\""; |
@@ -441,9 +441,9 @@ discard block |
||
| 441 | 441 | $x = file_get_contents("$tmpfile"); |
| 442 | 442 | $info = unserialize($x); |
| 443 | 443 | |
| 444 | - $njobs=0; |
|
| 444 | + $njobs = 0; |
|
| 445 | 445 | $cmdlines = file($info->cmdline_file_path); |
| 446 | - foreach ($cmdlines as $cmdline){ |
|
| 446 | + foreach ($cmdlines as $cmdline) { |
|
| 447 | 447 | if (preg_match("/^\s*-var/", $cmdline)) { |
| 448 | 448 | $njobs++; |
| 449 | 449 | } |
@@ -459,7 +459,7 @@ discard block |
||
| 459 | 459 | |
| 460 | 460 | $i = 0; |
| 461 | 461 | foreach ($cmdlines as $cmdline) { |
| 462 | - if (preg_match("/^\s*-var/", $cmdline)){ |
|
| 462 | + if (preg_match("/^\s*-var/", $cmdline)) { |
|
| 463 | 463 | submit_job($app, $batch_id, $info, $cmdline, $i); |
| 464 | 464 | $i++; |
| 465 | 465 | } |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | display_errors(); |
| 19 | 19 | |
| 20 | 20 | $app_name = "treeThreader"; |
| 21 | -$log = fopen("/tmp/tt_job.log","a+"); |
|
| 21 | +$log = fopen("/tmp/tt_job.log", "a+"); |
|
| 22 | 22 | |
| 23 | 23 | function error($s) { |
| 24 | 24 | echo "<error>\n<message>$s</message>\n</error>\n"; |
@@ -26,14 +26,14 @@ discard block |
||
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | function handle_submit($r, $user, $app) { |
| 29 | - global $app_name,$log; |
|
| 29 | + global $app_name, $log; |
|
| 30 | 30 | |
| 31 | - $timestamp = date("Y-m-d H:i",time()); |
|
| 31 | + $timestamp = date("Y-m-d H:i", time()); |
|
| 32 | 32 | // read the list of template filenames |
| 33 | 33 | // |
| 34 | 34 | $files = file("../../tree_threader_template_files"); |
| 35 | 35 | if ($files === false) { |
| 36 | - fwrite($log,"$timestamp\ttemplate file tree_threader_template_files\n"); |
|
| 36 | + fwrite($log, "$timestamp\ttemplate file tree_threader_template_files\n"); |
|
| 37 | 37 | error("no templates file"); |
| 38 | 38 | |
| 39 | 39 | } |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | // |
| 91 | 91 | function handle_get_output($r, $batch) { |
| 92 | 92 | global $log; |
| 93 | - $timestamp = date("Y-m-d H:i",time()); |
|
| 93 | + $timestamp = date("Y-m-d H:i", time()); |
|
| 94 | 94 | $wus = BoincWorkUnit::enum("batch=$batch->id"); |
| 95 | 95 | $outdir = "/tmp/treeThreader_result_".$batch->id; |
| 96 | 96 | @mkdir($outdir); |
@@ -129,14 +129,14 @@ discard block |
||
| 129 | 129 | error("can't zip output files"); |
| 130 | 130 | } |
| 131 | 131 | $fname = "treeThreader_result_".$batch->id.".zip"; |
| 132 | - $treeThreader_dir="treeThreaderResult"; |
|
| 133 | - if(!is_dir("../../download/$treeThreader_dir"))mkdir("../../download/$treeThreader_dir"); |
|
| 132 | + $treeThreader_dir = "treeThreaderResult"; |
|
| 133 | + if (!is_dir("../../download/$treeThreader_dir"))mkdir("../../download/$treeThreader_dir"); |
|
| 134 | 134 | @symlink("/tmp/$fname", "../../download/$treeThreader_dir/$fname"); |
| 135 | 135 | system("rm -fr $outdir"); |
| 136 | 136 | $config = simplexml_load_string(file_get_contents("../../config.xml")); |
| 137 | 137 | $download_url = trim((string)$config->config->download_url); |
| 138 | 138 | echo "<tt_reply>\n<url>$download_url/$treeThreader_dir/$fname</url>\n</tt_reply>\n"; |
| 139 | - $log_msg="$timestamp\tuser $batch->user_id downloads results for batch $batch->id : $download_url/$treeThreader_dir/$fname\n"; |
|
| 139 | + $log_msg = "$timestamp\tuser $batch->user_id downloads results for batch $batch->id : $download_url/$treeThreader_dir/$fname\n"; |
|
| 140 | 140 | fwrite($log, $log_msg); |
| 141 | 141 | } |
| 142 | 142 | |
@@ -27,74 +27,74 @@ |
||
| 27 | 27 | define('BATCH_STATE_RETIRED', 4); |
| 28 | 28 | |
| 29 | 29 | define('ANON_PLATFORM_UNKNOWN', -1); |
| 30 | -define('ANON_PLATFORM_CPU', -2); |
|
| 31 | -define('ANON_PLATFORM_NVIDIA', -3); |
|
| 32 | -define('ANON_PLATFORM_ATI', -4); |
|
| 33 | -define('ANON_PLATFORM_INTEL_GPU', -5); |
|
| 34 | -define('ANON_PLATFORM_APPLE_GPU', -6); |
|
| 30 | +define('ANON_PLATFORM_CPU', -2); |
|
| 31 | +define('ANON_PLATFORM_NVIDIA', -3); |
|
| 32 | +define('ANON_PLATFORM_ATI', -4); |
|
| 33 | +define('ANON_PLATFORM_INTEL_GPU', -5); |
|
| 34 | +define('ANON_PLATFORM_APPLE_GPU', -6); |
|
| 35 | 35 | |
| 36 | -define('RESULT_SERVER_STATE_INACTIVE', 1); |
|
| 37 | -define('RESULT_SERVER_STATE_UNSENT', 2); |
|
| 38 | -define('RESULT_SERVER_STATE_IN_PROGRESS', 4); |
|
| 39 | -define('RESULT_SERVER_STATE_OVER', 5); |
|
| 36 | +define('RESULT_SERVER_STATE_INACTIVE', 1); |
|
| 37 | +define('RESULT_SERVER_STATE_UNSENT', 2); |
|
| 38 | +define('RESULT_SERVER_STATE_IN_PROGRESS', 4); |
|
| 39 | +define('RESULT_SERVER_STATE_OVER', 5); |
|
| 40 | 40 | |
| 41 | -define('RESULT_OUTCOME_INIT', 0); |
|
| 42 | -define('RESULT_OUTCOME_SUCCESS', 1); |
|
| 43 | -define('RESULT_OUTCOME_COULDNT_SEND', 2); |
|
| 44 | -define('RESULT_OUTCOME_CLIENT_ERROR', 3); |
|
| 45 | -define('RESULT_OUTCOME_NO_REPLY', 4); |
|
| 46 | -define('RESULT_OUTCOME_DIDNT_NEED', 5); |
|
| 47 | -define('RESULT_OUTCOME_VALIDATE_ERROR', 6); |
|
| 48 | -define('RESULT_OUTCOME_CLIENT_DETACHED', 7); |
|
| 41 | +define('RESULT_OUTCOME_INIT', 0); |
|
| 42 | +define('RESULT_OUTCOME_SUCCESS', 1); |
|
| 43 | +define('RESULT_OUTCOME_COULDNT_SEND', 2); |
|
| 44 | +define('RESULT_OUTCOME_CLIENT_ERROR', 3); |
|
| 45 | +define('RESULT_OUTCOME_NO_REPLY', 4); |
|
| 46 | +define('RESULT_OUTCOME_DIDNT_NEED', 5); |
|
| 47 | +define('RESULT_OUTCOME_VALIDATE_ERROR', 6); |
|
| 48 | +define('RESULT_OUTCOME_CLIENT_DETACHED', 7); |
|
| 49 | 49 | |
| 50 | -define('VALIDATE_STATE_INIT', 0); |
|
| 51 | -define('VALIDATE_STATE_VALID', 1); |
|
| 52 | -define('VALIDATE_STATE_INVALID', 2); |
|
| 53 | -define('VALIDATE_STATE_NO_CHECK', 3); |
|
| 54 | -define('VALIDATE_STATE_INCONCLUSIVE',4); |
|
| 55 | -define('VALIDATE_STATE_TOO_LATE', 5); |
|
| 50 | +define('VALIDATE_STATE_INIT', 0); |
|
| 51 | +define('VALIDATE_STATE_VALID', 1); |
|
| 52 | +define('VALIDATE_STATE_INVALID', 2); |
|
| 53 | +define('VALIDATE_STATE_NO_CHECK', 3); |
|
| 54 | +define('VALIDATE_STATE_INCONCLUSIVE', 4); |
|
| 55 | +define('VALIDATE_STATE_TOO_LATE', 5); |
|
| 56 | 56 | |
| 57 | -define('WU_ERROR_COULDNT_SEND_RESULT', 1); |
|
| 58 | -define('WU_ERROR_TOO_MANY_ERROR_RESULTS', 2); |
|
| 59 | -define('WU_ERROR_TOO_MANY_SUCCESS_RESULTS', 4); |
|
| 60 | -define('WU_ERROR_TOO_MANY_TOTAL_RESULTS', 8); |
|
| 61 | -define('WU_ERROR_CANCELLED', 16); |
|
| 62 | -define('WU_ERROR_NO_CANONICAL_RESULT', 32); |
|
| 57 | +define('WU_ERROR_COULDNT_SEND_RESULT', 1); |
|
| 58 | +define('WU_ERROR_TOO_MANY_ERROR_RESULTS', 2); |
|
| 59 | +define('WU_ERROR_TOO_MANY_SUCCESS_RESULTS', 4); |
|
| 60 | +define('WU_ERROR_TOO_MANY_TOTAL_RESULTS', 8); |
|
| 61 | +define('WU_ERROR_CANCELLED', 16); |
|
| 62 | +define('WU_ERROR_NO_CANONICAL_RESULT', 32); |
|
| 63 | 63 | |
| 64 | -define('FILE_DELETE_INIT', 0); |
|
| 65 | -define('FILE_DELETE_READY', 1); |
|
| 66 | -define('FILE_DELETE_DONE', 2); |
|
| 67 | -define('FILE_DELETE_ERROR', 3); |
|
| 64 | +define('FILE_DELETE_INIT', 0); |
|
| 65 | +define('FILE_DELETE_READY', 1); |
|
| 66 | +define('FILE_DELETE_DONE', 2); |
|
| 67 | +define('FILE_DELETE_ERROR', 3); |
|
| 68 | 68 | |
| 69 | -define('ASSIMILATE_INIT', 0); |
|
| 70 | -define('ASSIMILATE_READY', 1); |
|
| 71 | -define('ASSIMILATE_DONE', 2); |
|
| 69 | +define('ASSIMILATE_INIT', 0); |
|
| 70 | +define('ASSIMILATE_READY', 1); |
|
| 71 | +define('ASSIMILATE_DONE', 2); |
|
| 72 | 72 | |
| 73 | 73 | // from lib/common_defs.h |
| 74 | 74 | // |
| 75 | -define('RESULT_NEW', 0); |
|
| 76 | -define('RESULT_FILES_DOWNLOADING', 1); |
|
| 77 | -define('RESULT_FILES_DOWNLOADED', 2); |
|
| 78 | -define('RESULT_COMPUTE_ERROR', 3); |
|
| 79 | -define('RESULT_FILES_UPLOADING', 4); |
|
| 80 | -define('RESULT_FILES_UPLOADED', 5); |
|
| 81 | -define('RESULT_ABORTED', 6); |
|
| 82 | -define('RESULT_UPLOAD_FAILED', 7); |
|
| 75 | +define('RESULT_NEW', 0); |
|
| 76 | +define('RESULT_FILES_DOWNLOADING', 1); |
|
| 77 | +define('RESULT_FILES_DOWNLOADED', 2); |
|
| 78 | +define('RESULT_COMPUTE_ERROR', 3); |
|
| 79 | +define('RESULT_FILES_UPLOADING', 4); |
|
| 80 | +define('RESULT_FILES_UPLOADED', 5); |
|
| 81 | +define('RESULT_ABORTED', 6); |
|
| 82 | +define('RESULT_UPLOAD_FAILED', 7); |
|
| 83 | 83 | |
| 84 | 84 | // from lib/error_numbers.h |
| 85 | 85 | // returned by some web RPCs |
| 86 | 86 | // |
| 87 | -define('ERR_XML_PARSE', -112); |
|
| 88 | -define('ERR_DB_NOT_FOUND', -136); |
|
| 89 | -define('ERR_DB_NOT_UNIQUE', -137); |
|
| 90 | -define('ERR_DB_CANT_CONNECT', -138); |
|
| 91 | -define('ERR_PROJECT_DOWN', -183); |
|
| 92 | -define('ERR_BAD_USER_NAME', -188); |
|
| 93 | -define('ERR_NO_OPTION', -191); |
|
| 94 | -define('ERR_BAD_EMAIL_ADDR', -205); |
|
| 95 | -define('ERR_BAD_PASSWD', -206); |
|
| 96 | -define('ERR_ACCT_CREATION_DISABLED', -208); |
|
| 97 | -define('ERR_ATTACH_FAIL_INIT', -209); |
|
| 98 | -define('ERR_ATTACH_FAIL_DOWNLOAD', -210); |
|
| 99 | -define('ERR_ACCT_REQUIRE_CONSENT', -242); |
|
| 87 | +define('ERR_XML_PARSE', -112); |
|
| 88 | +define('ERR_DB_NOT_FOUND', -136); |
|
| 89 | +define('ERR_DB_NOT_UNIQUE', -137); |
|
| 90 | +define('ERR_DB_CANT_CONNECT', -138); |
|
| 91 | +define('ERR_PROJECT_DOWN', -183); |
|
| 92 | +define('ERR_BAD_USER_NAME', -188); |
|
| 93 | +define('ERR_NO_OPTION', -191); |
|
| 94 | +define('ERR_BAD_EMAIL_ADDR', -205); |
|
| 95 | +define('ERR_BAD_PASSWD', -206); |
|
| 96 | +define('ERR_ACCT_CREATION_DISABLED', -208); |
|
| 97 | +define('ERR_ATTACH_FAIL_INIT', -209); |
|
| 98 | +define('ERR_ATTACH_FAIL_DOWNLOAD', -210); |
|
| 99 | +define('ERR_ACCT_REQUIRE_CONSENT', -242); |
|
| 100 | 100 | ?> |