Passed
Pull Request — master (#6645)
by
unknown
14:22 queued 05:20
created
html/user/manage_project.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
             $app = BoincApp::lookup_id($ua->app_id);
39 39
             $names[] = $app->name;
40 40
         }
41
-        $sub = $names?implode(', ', $names):'---';
41
+        $sub = $names ?implode(', ', $names) : '---';
42 42
     }
43 43
     if ($u->manage_all) {
44 44
         $admin = 'All applications';
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
             $app = BoincApp::lookup_id($ua->app_id);
50 50
             $names[] = $app->name;
51 51
         }
52
-        $admin = $names?implode(', ', $names):'---';
52
+        $admin = $names ?implode(', ', $names) : '---';
53 53
     }
54 54
     [$yes, $no] = read_kw_prefs($user);
55 55
     global $job_keywords;
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
         implode('<br>', $kws),
70 70
         $u->quota,
71 71
         $u->max_jobs_in_progress,
72
-        ($u->logical_start_time > time())?local_time_str($u->logical_start_time):'---'
72
+        ($u->logical_start_time > time()) ?local_time_str($u->logical_start_time) : '---'
73 73
     );
74 74
 }
75 75
 
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
         'max_jobs_in_progress', $usub->max_jobs_in_progress
149 149
     );
150 150
     form_general('Run jobs only on own computers?',
151
-        $user->seti_id?'yes':'no'
151
+        $user->seti_id ? 'yes' : 'no'
152 152
     );
153 153
     form_submit('Update');
154 154
     form_end();
@@ -204,18 +204,18 @@  discard block
 block discarded – undo
204 204
     $manage_apps = array_map('intval', $manage_apps);
205 205
     foreach ($apps as $app) {
206 206
         $s = in_array($app->id, $submit_apps);
207
-        $m = in_array($app->id, $manage_apps)?1:0;
207
+        $m = in_array($app->id, $manage_apps) ? 1 : 0;
208 208
         if ($s || $m) {
209 209
             BoincUserSubmitApp::insert(
210 210
                 "(user_id, app_id, manage) values ($user_id, $app->id, $m)"
211 211
             );
212 212
         }
213 213
     }
214
-    $quota = (double) get_str('quota');
214
+    $quota = (double)get_str('quota');
215 215
     if ($quota != $us->quota) {
216 216
         $us->update("quota=$quota");
217 217
     }
218
-    $mj = (int) get_str('max_jobs_in_progress');
218
+    $mj = (int)get_str('max_jobs_in_progress');
219 219
     if ($mj != $us->max_jobs_in_progress) {
220 220
         $us->update("max_jobs_in_progress=$mj");
221 221
     }
Please login to merge, or discard this patch.
html/user/submit.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -674,7 +674,7 @@  discard block
 block discarded – undo
674 674
         );
675 675
     }
676 676
     row2("Submitted", time_str($batch->create_time));
677
-    row2("Application", $app?$app->name:'---');
677
+    row2("Application", $app ? $app->name : '---');
678 678
     row2("State", batch_state_string($batch->state));
679 679
     //row2("# jobs", $batch->njobs);
680 680
     //row2("# error jobs", $batch->nerror_jobs);
@@ -764,11 +764,11 @@  discard block
 block discarded – undo
764 764
         "GFLOPS-hours"
765 765
     ];
766 766
     row_heading_array($x);
767
-    foreach($wus as $wu) {
767
+    foreach ($wus as $wu) {
768 768
         if ($status && $wu->status != $status) continue;
769 769
         $y = '';
770 770
         $c = '---';
771
-        switch($wu->status) {
771
+        switch ($wu->status) {
772 772
         case WU_SUCCESS:
773 773
             $resultid = $wu->canonical_resultid;
774 774
             $y = sprintf('<font color="%s">completed</font>', COLOR_SUCCESS);
@@ -859,7 +859,7 @@  discard block
 block discarded – undo
859 859
             if ($result->id == $wu->canonical_resultid) {
860 860
                 $log_names = get_outfile_log_names($result);
861 861
                 $nfiles = count($log_names);
862
-                for ($i=0; $i<$nfiles; $i++) {
862
+                for ($i = 0; $i < $nfiles; $i++) {
863 863
                     $name = $log_names[$i];
864 864
                     // don't show 'view' link if it's a .zip
865 865
                     $y = "$name: ";
@@ -883,7 +883,7 @@  discard block
 block discarded – undo
883 883
                 $phys_names = get_outfile_phys_names($result);
884 884
                 $log_names = get_outfile_log_names($result);
885 885
                 $nfiles = count($log_names);
886
-                for ($i=0; $i<$nfiles; $i++) {
886
+                for ($i = 0; $i < $nfiles; $i++) {
887 887
                     $path = dir_hier_path(
888 888
                         $phys_names[$i], $upload_dir, $fanout
889 889
                     );
Please login to merge, or discard this patch.
Upper-Lower-Casing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -661,7 +661,7 @@  discard block
 block discarded – undo
661 661
 
662 662
     $is_assim_move = is_assim_move($app);
663 663
 
664
-    page_head("Batch $batch_id");
664
+    page_head("batch $batch_id");
665 665
     text_start(800);
666 666
     start_table();
667 667
     row2("Batch name", $batch->name);
@@ -963,7 +963,7 @@  discard block
 block discarded – undo
963 963
 
964 964
     if (get_int('confirmed', true)) {
965 965
         abort_batch($batch);
966
-        page_head("Batch $batch_id aborted");
966
+        page_head("batch $batch_id aborted");
967 967
         return_link();
968 968
         page_tail();
969 969
     } else {
@@ -993,7 +993,7 @@  discard block
 block discarded – undo
993 993
 
994 994
     if (get_int('confirmed', true)) {
995 995
         retire_batch($batch);
996
-        page_head("Batch $batch_id retired");
996
+        page_head("batch $batch_id retired");
997 997
         return_link();
998 998
         page_tail();
999 999
     } else {
Please login to merge, or discard this patch.
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_accel.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
                         break;
63 63
                     }
64 64
                     $age = $now - $r->sent_time;
65
-                    if ($age<$batch->expire_time) {
65
+                    if ($age < $batch->expire_time) {
66 66
                         $make_another_result = false;
67 67
                         break;
68 68
                     }
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
             if ($make_another_result) {
73 73
                 echo "creating another instance for WU $wu->id\n";
74 74
                 $query[] = sprintf(
75
-                    'target_nresults=%d', $wu->target_nresults+1
75
+                    'target_nresults=%d', $wu->target_nresults + 1
76 76
                 );
77 77
                 $query[] = sprintf(
78 78
                     'transition_time=%f', $now
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.