Completed
Push — master ( d02cee...f4af36 )
by Vitalii
46s queued 15s
created
html/ops/submit_retire.php 1 patch
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -166,7 +166,7 @@
 block discarded – undo
166 166
     foreach ($batches as $batch) {
167 167
         $n = BoincWorkunit::count("batch=$batch->id");
168 168
         if ($n == 0) {
169
-            echo "Batch $batch->id has no jobs\n";
169
+            echo "batch $batch->id has no jobs\n";
170 170
             retire_batch($batch);
171 171
         }
172 172
     }
Please login to merge, or discard this patch.
html/user/buda_submit.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 //
97 97
 function unzip_batch_file($user, $batch_file) {
98 98
     @mkdir("../../buda_batches");
99
-    for ($i=0; $i<1000; $i++) {
99
+    for ($i = 0; $i < 1000; $i++) {
100 100
         $batch_dir = "../../buda_batches/$i";
101 101
         $batch_dir_name = $i;
102 102
         $ret = @mkdir($batch_dir);
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
         }
148 148
         $job_files = [];
149 149
         $cmdline = '';
150
-        foreach(scandir("$batch_dir/$fname") as $f2) {
150
+        foreach (scandir("$batch_dir/$fname") as $f2) {
151 151
             if ($f2[0] == '.') continue;
152 152
             if ($f2 == 'cmdline') {
153 153
                 $cmdline = trim(file_get_contents("$batch_dir/$fname/cmdline"));
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
 function stage_input_files($batch_dir, $batch_desc, $batch_id) {
202 202
     $n = count($batch_desc->shared_files);
203 203
     $batch_desc->shared_files_phys_names = [];
204
-    for ($i=0; $i<$n; $i++) {
204
+    for ($i = 0; $i < $n; $i++) {
205 205
         $path = sprintf('%s/%s', $batch_dir, $batch_desc->shared_files[$i]);
206 206
         [$md5, $size] = $batch_desc->shared_file_infos[$i];
207 207
         $phys_name = sprintf('batch_%d_%s', $batch_id, $md5);
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
     foreach ($batch_desc->jobs as $job) {
212 212
         $n = count($batch_desc->unshared_files);
213 213
         $job->phys_names = [];
214
-        for ($i=0; $i<$n; $i++) {
214
+        for ($i = 0; $i < $n; $i++) {
215 215
             $path = sprintf('%s/%s/%s',
216 216
                 $batch_dir, $job->dir, $batch_desc->unshared_files[$i]
217 217
             );
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
         $job_cmds .= "$job_cmd\n";
251 251
     }
252 252
     $wrapper_cmdline = sprintf('"%s %s"',
253
-        $wrapper_verbose?'--verbose':'',
253
+        $wrapper_verbose ? '--verbose' : '',
254 254
         $cmdline
255 255
     );
256 256
     $cmd = sprintf(
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
     if ($max_runtime_days <= 0) error_page('bad runtime limit');
302 302
     if ($max_runtime_days > 100) error_page('bad runtime limit');
303 303
 
304
-    $max_fpops = $max_runtime_days * AVG_CPU_FPOPS * 86400;
304
+    $max_fpops = $max_runtime_days*AVG_CPU_FPOPS*86400;
305 305
 
306 306
     $exp_runtime_days = get_str('exp_runtime_days');
307 307
     if (!is_numeric($exp_runtime_days)) error_page('bad expected runtime');
@@ -311,7 +311,7 @@  discard block
 block discarded – undo
311 311
     if ($exp_runtime_days > $max_runtime_days) {
312 312
         error_page('exp must be < max runtime');
313 313
     }
314
-    $exp_fpops = $exp_runtime_days * AVG_CPU_FPOPS * 86400;
314
+    $exp_fpops = $exp_runtime_days*AVG_CPU_FPOPS*86400;
315 315
 
316 316
     $app_desc = get_buda_app_desc($app);
317 317
 
Please login to merge, or discard this patch.
html/ops/batch_stats.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
     BoincHost::update_aux("error_rate=0");
127 127
     $ltts = [];
128 128
     foreach ($hosts as $id=>$x) {
129
-        $avg = $x->ntt_sum / $x->ntt_n;
129
+        $avg = $x->ntt_sum/$x->ntt_n;
130 130
         if ($avg < 1) {
131 131
             $ltts[] = $id;
132 132
         }
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
             $nfast = 0;
151 151
             foreach ($hlist as $id=>$count) {
152 152
                 $x = $hosts[$id];
153
-                $avg = $x->ntt_sum / $x->ntt_n;
153
+                $avg = $x->ntt_sum/$x->ntt_n;
154 154
                 if ($avg < 1) {
155 155
                     $nfast++;
156 156
                 }
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
         }
166 166
 
167 167
         $app->update(
168
-            sprintf('n_size_classes=%d', $accel?1:0)
168
+            sprintf('n_size_classes=%d', $accel ? 1 : 0)
169 169
         );
170 170
     }
171 171
 }
@@ -186,14 +186,14 @@  discard block
 block discarded – undo
186 186
     foreach ($as as $a) {
187 187
         $apps[$a->id] = [];
188 188
     }
189
-    $start = time()-30*86400;
189
+    $start = time() - 30*86400;
190 190
     $batches = BoincBatch::enum(
191 191
         sprintf(
192 192
             'create_time>%d and state in (%d, %d)',
193 193
             $start, BATCH_STATE_IN_PROGRESS, BATCH_STATE_COMPLETE
194 194
         )
195 195
     );
196
-    foreach($batches as $batch) {
196
+    foreach ($batches as $batch) {
197 197
         do_batch($batch);
198 198
     }
199 199
     update_db();
Please login to merge, or discard this patch.
html/user/submit_stats.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -238,18 +238,18 @@  discard block
 block discarded – undo
238 238
     }
239 239
     $n = 100;
240 240
     $count = [];
241
-    for ($i=0; $i<$n; $i++) {
241
+    for ($i = 0; $i < $n; $i++) {
242 242
         $count[$i] = 0;
243 243
     }
244 244
     $range = $max - $min;
245 245
     foreach ($x as $f) {
246
-        $d = intval($n*($f-$min)/$range);
247
-        if ($d >= $n) $d = $n-1;
246
+        $d = intval($n*($f - $min)/$range);
247
+        if ($d >= $n) $d = $n - 1;
248 248
         $count[$d] += 1;
249 249
     }
250 250
     $data = [];
251
-    for ($i=0; $i<$n; $i++) {
252
-        $data[] = [$min+($i*$range)/$n, $count[$i]];
251
+    for ($i = 0; $i < $n; $i++) {
252
+        $data[] = [$min + ($i*$range)/$n, $count[$i]];
253 253
     }
254 254
     if ($flops) {
255 255
         graph($data, 'runtime', 'Job runtime (hours)', 'job count');
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
 
315 315
 $batch = BoincBatch::lookup_id(get_int('batch_id'));
316 316
 if (!$batch) error_page('no batch');
317
-switch(get_str('action')) {
317
+switch (get_str('action')) {
318 318
 case 'err_host':
319 319
     err_host($batch);
320 320
     break;
Please login to merge, or discard this patch.
Upper-Lower-Casing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
             )
218 218
         );
219 219
     } else {
220
-        page_head("Batch $batch->id turnaround times");
220
+        page_head("batch $batch->id turnaround times");
221 221
         echo "<p>Turnaround times of completed jobs.<p>";
222 222
         $results = BoincResult::enum_fields(
223 223
             '(received_time-sent_time)/3600 as val',
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
 }
266 266
 
267 267
 function batch_graphs($batch) {
268
-    page_head("Batch $batch->id job times");
268
+    page_head("batch $batch->id job times");
269 269
     echo "
270 270
         <script type=\"text/javascript\" src=\"https://www.gstatic.com/charts/loader.js\"></script>
271 271
     ";
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
         }
296 296
     }
297 297
     arsort($x);
298
-    page_head("Batch $batch->id: completed jobs grouped by host");
298
+    page_head("batch $batch->id: completed jobs grouped by host");
299 299
     text_start();
300 300
     start_table();
301 301
     table_header('Host', 'OS', '# jobs');
Please login to merge, or discard this patch.
html/inc/db_conn.inc 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -22,12 +22,12 @@  discard block
 block discarded – undo
22 22
 // Intended to be subclassed (e.g., BoincDb, BossaDb)
23 23
 //
24 24
 class DbConn {
25
-    var $db_conn;       // a mysqli object
26
-    var $db_name;       // the DB name
25
+    var $db_conn; // a mysqli object
26
+    var $db_name; // the DB name
27 27
 
28 28
     function init_conn($user, $passwd, $host, $name) {
29 29
         $x = explode(":", $host);
30
-        if (sizeof($x)>1) {
30
+        if (sizeof($x) > 1) {
31 31
             $host = $x[0];
32 32
             $port = $x[1];
33 33
         } else {
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
         }
36 36
         try {
37 37
             $this->db_conn = @new mysqli($host, $user, $passwd, $name, $port);
38
-        } catch(Exception $e) {
38
+        } catch (Exception $e) {
39 39
             return false;
40 40
         }
41 41
         if (mysqli_connect_error()) {
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
         return $this->enum_general($classname, $query);
137 137
     }
138 138
 
139
-    function enum($table, $classname, $where_clause=null, $order_clause=null) {
139
+    function enum($table, $classname, $where_clause = null, $order_clause = null) {
140 140
         return self::enum_fields(
141 141
             $table, $classname, '*', $where_clause, $order_clause
142 142
         );
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
         $query = "update DBNAME.$table set $clause where id=$obj->id";
147 147
         return $this->do_query($query);
148 148
     }
149
-    function update_aux($table, $clause, $where='') {
149
+    function update_aux($table, $clause, $where = '') {
150 150
         if ($where) $where = " where $where";
151 151
         $query = "update DBNAME.$table set $clause $where";
152 152
         return $this->do_query($query);
@@ -182,15 +182,15 @@  discard block
 block discarded – undo
182 182
         if ($x) return (double)$x->$field;
183 183
         return false;
184 184
     }
185
-    function count($table, $clause="TRUE") {
185
+    function count($table, $clause = "TRUE") {
186 186
         $query = "select count(*) as total from DBNAME.$table where $clause";
187 187
         return $this->get_int($query, 'total');
188 188
     }
189
-    function sum($table, $field, $clause="") {
189
+    function sum($table, $field, $clause = "") {
190 190
         $query = "select sum($field) as total from DBNAME.$table $clause";
191 191
         return $this->get_double($query, 'total');
192 192
     }
193
-    function max($table, $field, $clause="") {
193
+    function max($table, $field, $clause = "") {
194 194
         $query = "select max($field) as total from DBNAME.$table $clause";
195 195
         return $this->get_double($query, 'total');
196 196
     }
Please login to merge, or discard this patch.
html/inc/util_basic.inc 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -56,10 +56,10 @@  discard block
 block discarded – undo
56 56
     return file_exists("$d/stop_sched");
57 57
 }
58 58
 
59
-function xml_error($num=-1, $msg=null, $file=null, $line=null) {
59
+function xml_error($num = -1, $msg = null, $file = null, $line = null) {
60 60
     global $xml_outer_tag;
61 61
     if (!$msg) {
62
-        switch($num) {
62
+        switch ($num) {
63 63
         case -112: $msg = "Invalid XML"; break;
64 64
         case -136: $msg = "Not found"; break;
65 65
         case -137: $msg = "Name or email address is not unique"; break;
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 // If it's a single-tag element, and it's present, just return the tag
105 105
 //
106 106
 function parse_element($xml, $tag) {
107
-    $closetag = "</" . substr($tag,1);
107
+    $closetag = "</".substr($tag, 1);
108 108
     $x = strstr($xml, $tag);
109 109
     if ($x) {
110 110
         if (strstr($tag, "/>")) return $tag;
@@ -120,8 +120,8 @@  discard block
 block discarded – undo
120 120
 
121 121
 function parse_next_element($xml, $tag, &$cursor) {
122 122
     $element = null;
123
-    $closetag = "</" . substr($tag,1);
124
-    $pos = substr($xml,$cursor);
123
+    $closetag = "</".substr($tag, 1);
124
+    $pos = substr($xml, $cursor);
125 125
     $x = strstr($pos, $tag);
126 126
     if ($x) {
127 127
         if (strstr($tag, "/>")) return $tag;
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
 
204 204
 function time_str($x) {
205 205
     if ($x == 0) return "---";
206
-    return gmdate('j M Y, G:i:s', (int)$x) . " UTC";
206
+    return gmdate('j M Y, G:i:s', (int)$x)." UTC";
207 207
 }
208 208
 
209 209
 function local_time_str($x) {
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
 // ALSO: allow spaces.
242 242
 //
243 243
 function is_valid_filename($x) {
244
-    if (strlen($x)>255) return false;
244
+    if (strlen($x) > 255) return false;
245 245
     // \w means A-Za-z0-9_
246 246
     return preg_match('/^[\w\-. ]+$/', $x);
247 247
 }
Please login to merge, or discard this patch.
html/inc/host.inc 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -32,12 +32,12 @@  discard block
 block discarded – undo
32 32
 
33 33
 function sched_log_name($x) {
34 34
     if ($x == 0) return "NO_SUCH_LOG";
35
-    return gmdate('Y-m-d_H/Y-m-d_H:i', $x) . ".txt";
35
+    return gmdate('Y-m-d_H/Y-m-d_H:i', $x).".txt";
36 36
 }
37 37
 
38 38
 function sched_log_link($x) {
39 39
     if (file_exists("sched_logs")) {
40
-        return "<a href=\"../sched_logs/" . sched_log_name($x) . "\">" . time_str($x) . "</a>";
40
+        return "<a href=\"../sched_logs/".sched_log_name($x)."\">".time_str($x)."</a>";
41 41
     } else {
42 42
         return time_str($x);
43 43
     }
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 
46 46
 function location_form($host) {
47 47
     $none = "selected";
48
-    $h=$w=$s=$m="";
48
+    $h = $w = $s = $m = "";
49 49
     if ($host->venue == "home") $h = "selected";
50 50
     if ($host->venue == "work") $w = "selected";
51 51
     if ($host->venue == "school") $s = "selected";
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
             row2(tra("Product name"), $host->product_name);
100 100
         }
101 101
         $x = $host->timezone/3600;
102
-        if ($x >= 0) $x="+$x";
102
+        if ($x >= 0) $x = "+$x";
103 103
         row2(tra("Local Standard Time"), tra("UTC %1 hours", $x));
104 104
     } else {
105 105
         $owner = BoincUser::lookup_id($host->userid);
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
         }
186 186
         if (defined('BATCH_ACCEL') && BATCH_ACCEL) {
187 187
             row2('Low turnaround time?',
188
-                $host->error_rate?'yes':'no'
188
+                $host->error_rate ? 'yes' : 'no'
189 189
             );
190 190
         }
191 191
     }
@@ -261,8 +261,8 @@  discard block
 block discarded – undo
261 261
     return sprintf(
262 262
         'Virtualbox %s<br>HW acceleration: %s<br>Enabled: %s',
263 263
         $v->version,
264
-        $v->hw_accel?'yes':'no',
265
-        $v->hw_accel_enabled?'yes':'no'
264
+        $v->hw_accel ? 'yes' : 'no',
265
+        $v->hw_accel_enabled ? 'yes' : 'no'
266 266
     );
267 267
 }
268 268
 
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
     if (empty($misc->docker)) return '---';
271 271
     $d = $misc->docker;
272 272
     $x = sprintf('%s version %s',
273
-        $d->type==1?"Docker":"Podman",
273
+        $d->type == 1 ? "Docker" : "Podman",
274 274
         $d->version
275 275
     );
276 276
     if (!empty($d->wsl_distro)) {
@@ -471,14 +471,14 @@  discard block
 block discarded – undo
471 471
     if ($pos1 === false) return $x;
472 472
     $pos2 = strpos($model, ']');
473 473
     if ($pos2 === false) return $x;
474
-    $a = substr($model, $pos1+1, $pos2-$pos1-1);
474
+    $a = substr($model, $pos1 + 1, $pos2 - $pos1 - 1);
475 475
     $y = explode(" ", $a);
476 476
     if (count($y) == 0) return $x;
477 477
     if ($y[0] == "Family") {
478 478
         $x->info = $a;
479 479
     } else {
480 480
         $x->arch = $y[0];
481
-        $x->info = substr($a, strlen($y[0])+1);
481
+        $x->info = substr($a, strlen($y[0]) + 1);
482 482
     }
483 483
     return $x;
484 484
 }
@@ -567,7 +567,7 @@  discard block
 block discarded – undo
567 567
     $avg_time = 0;
568 568
 
569 569
     $results = BoincResult::enum("hostid=$hostid order by received_time");
570
-    foreach($results as $result) {
570
+    foreach ($results as $result) {
571 571
         if ($result->granted_credit <= 0) continue;
572 572
         $total += $result->granted_credit;
573 573
 
@@ -660,7 +660,7 @@  discard block
 block discarded – undo
660 660
 
661 661
 function link_url($sort, $rev, $show_all) {
662 662
     global $userid;
663
-    $x = $userid ? "&userid=$userid":"";
663
+    $x = $userid ? "&userid=$userid" : "";
664 664
     return "hosts_user.php?sort=$sort&rev=$rev&show_all=$show_all$x";
665 665
 }
666 666
 
@@ -734,7 +734,7 @@  discard block
 block discarded – undo
734 734
 }
735 735
 
736 736
 function show_user_hosts($userid, $private, $show_all, $sort, $rev) {
737
-    $desc = false;  // whether the sort order's default is decreasing
737
+    $desc = false; // whether the sort order's default is decreasing
738 738
     switch ($sort) {
739 739
     case "total_credit": $sort_clause = "total_credit"; $desc = true; break;
740 740
     case "expavg_credit": $sort_clause = "expavg_credit"; $desc = true; break;
@@ -756,7 +756,7 @@  discard block
 block discarded – undo
756 756
     more_or_less($sort, $rev, $show_all);
757 757
 
758 758
     $now = time();
759
-    $old_hosts=0;
759
+    $old_hosts = 0;
760 760
     $i = 1;
761 761
     $hosts = BoincHost::enum("userid=$userid order by $sort_clause limit 100");
762 762
     $any_product_name = false;
@@ -768,9 +768,9 @@  discard block
 block discarded – undo
768 768
     }
769 769
     user_host_table_start($private, $sort, $rev, $show_all, $any_product_name);
770 770
     foreach ($hosts as $host) {
771
-        $is_old=false;
771
+        $is_old = false;
772 772
         if (($now - $host->rpc_time) > 30*86400) {
773
-            $is_old=true;
773
+            $is_old = true;
774 774
             $old_hosts++;
775 775
         }
776 776
         if (!$show_all && $is_old) continue;
@@ -779,7 +779,7 @@  discard block
 block discarded – undo
779 779
     }
780 780
     end_table();
781 781
 
782
-    if ($old_hosts>0) {
782
+    if ($old_hosts > 0) {
783 783
         more_or_less($sort, $rev, $show_all);
784 784
     }
785 785
 
Please login to merge, or discard this patch.
html/ops/hostinfo.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -45,8 +45,8 @@
 block discarded – undo
45 45
     $v = new StdClass;
46 46
     $v->version = $x[1];
47 47
     if (count($x) >= 4) {
48
-        $v->hw_accel = $x[2]?true:false;
49
-        $v->hw_accel_enabled = $x[3]?true:false;
48
+        $v->hw_accel = $x[2] ?true:false;
49
+        $v->hw_accel_enabled = $x[3] ?true:false;
50 50
     }
51 51
     return $v;
52 52
 }
Please login to merge, or discard this patch.
html/ops/batch_accel.php 2 patches
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@
 block discarded – undo
29 29
 // accelerate batches if at least this frac done
30 30
 // can be set in project.inc
31 31
 //
32
-if (!defined('BATCH_ACCEL_MIN_FRAC_DONE')){
32
+if (!defined('BATCH_ACCEL_MIN_FRAC_DONE')) {
33 33
     define('BATCH_ACCEL_MIN_FRAC_DONE', .85);
34 34
 }
35 35
 
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 // accelerate batches if at least this frac done
30 30
 // can be set in project.inc
31 31
 //
32
-if (!defined('BATCH_ACCEL_MIN_FRAC_DONE')){
32
+if (!defined('BATCH_ACCEL_MIN_FRAC_DONE')) {
33 33
     define('BATCH_ACCEL_MIN_FRAC_DONE', .85);
34 34
 }
35 35
 
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
                         break;
74 74
                     case RESULT_SERVER_STATE_IN_PROGRESS:
75 75
                         $age = $now - $r->sent_time;
76
-                        if ($age<$batch->expire_time) {
76
+                        if ($age < $batch->expire_time) {
77 77
                             echo "   have recent in-progress result\n";
78 78
                             $make_another_result = false;
79 79
                         }
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
             if ($make_another_result) {
86 86
                 echo "   creating another instance\n";
87 87
                 $query[] = sprintf(
88
-                    'target_nresults=%d', $wu->target_nresults+1
88
+                    'target_nresults=%d', $wu->target_nresults + 1
89 89
                 );
90 90
                 $query[] = sprintf(
91 91
                     'transition_time=%f', $now
Please login to merge, or discard this patch.