Passed
Pull Request — master (#6635)
by Vitalii
14:21 queued 05:48
created
html/user/buda.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 // show list of BUDA apps and variants,
37 37
 // w/ buttons for adding and deleting
38 38
 //
39
-function app_list($notice=null) {
39
+function app_list($notice = null) {
40 40
     global $buda_root;
41 41
     if (!is_dir($buda_root)) {
42 42
         mkdir($buda_root);
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
     //
225 225
     $x = "<input_template>\n";
226 226
     $ninfiles = count($desc->input_file_names);
227
-    for ($i=0; $i<$ninfiles; $i++) {
227
+    for ($i = 0; $i < $ninfiles; $i++) {
228 228
         $x .= "   <file_info>\n      <sticky/>\n      <no_delete/>\n      <executable/>\n   </file_info>\n";
229 229
     }
230 230
     $x .= "   <workunit>\n";
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
     );
246 246
 
247 247
     $x .= sprintf("      <max_delay>%f</max_delay>\n",
248
-        $desc->max_delay_days * 86400.
248
+        $desc->max_delay_days*86400.
249 249
     );
250 250
 
251 251
     $x .= "      <buda_app_name>$app</buda_app_name>\n";
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
     } else {
319 319
         $creating = true;
320 320
     }
321
-    $variant = sprintf('%s_%s', $cpu_type, $plan_class?$plan_class:'cpu');
321
+    $variant = sprintf('%s_%s', $cpu_type, $plan_class ? $plan_class : 'cpu');
322 322
     if (!is_valid_filename($variant)) {
323 323
         error_page(filename_rules());
324 324
     }
@@ -463,8 +463,8 @@  discard block
 block discarded – undo
463 463
     }
464 464
 }
465 465
 
466
-function app_form($desc=null) {
467
-    page_head_select2($desc?"Edit BUDA app $desc->name":'Create BUDA app');
466
+function app_form($desc = null) {
467
+    page_head_select2($desc ? "Edit BUDA app $desc->name" : 'Create BUDA app');
468 468
     form_start('buda.php');
469 469
     form_input_hidden('action', 'app_action');
470 470
     if ($desc) {
Please login to merge, or discard this patch.
Upper-Lower-Casing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
         );
196 196
     }
197 197
     form_input_text("Plan class$pc", 'plan_class', $variant_desc->plan_class);
198
-    form_select("Dockerfile$sb", 'dockerfile', $sbitems, $variant_desc->dockerfile);
198
+    form_select("dockerfile$sb", 'dockerfile', $sbitems, $variant_desc->dockerfile);
199 199
     form_select2_multi("Application files$sb", 'app_files', $sbitems, $variant_desc->app_files);
200 200
     form_submit('OK');
201 201
     form_end();
@@ -393,7 +393,7 @@  discard block
 block discarded – undo
393 393
     // Note: we don't currently allow indirect file access.
394 394
     // If we did, we'd need to create job.toml to mount project dir
395 395
 
396
-    app_list("Variant $variant added for app $app.");
396
+    app_list("variant $variant added for app $app.");
397 397
 }
398 398
 
399 399
 function variant_delete() {
@@ -420,7 +420,7 @@  discard block
 block discarded – undo
420 420
         if ($ret) {
421 421
             error_page("delete failed");
422 422
         }
423
-        $notice = "Variant $variant of app $app removed.";
423
+        $notice = "variant $variant of app $app removed.";
424 424
         app_list($notice);
425 425
     } else {
426 426
         page_head("Confirm");
@@ -450,7 +450,7 @@  discard block
 block discarded – undo
450 450
         if ($ret) {
451 451
             error_page('delete failed');
452 452
         }
453
-        $notice = "App $app removed.";
453
+        $notice = "app $app removed.";
454 454
         app_list($notice);
455 455
     } else {
456 456
         page_head('Confirm');
@@ -547,7 +547,7 @@  discard block
 block discarded – undo
547 547
         }
548 548
         $dir = "$buda_root/$app_name";
549 549
         if (file_exists($dir)) {
550
-            error_page("App $app_name already exists.");
550
+            error_page("app $app_name already exists.");
551 551
         }
552 552
         mkdir($dir);
553 553
         $desc->user_id = $user->id;
Please login to merge, or discard this patch.
html/user/download_software.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -346,7 +346,7 @@
 block discarded – undo
346 346
     handle_get_info();
347 347
 } else {
348 348
     $dev = get_str("dev", true);
349
-    $user_agent = get_str("user_agent", true);      // for debugging
349
+    $user_agent = get_str("user_agent", true); // for debugging
350 350
     if (!$user_agent) {
351 351
         $user_agent = $_SERVER['HTTP_USER_AGENT'];
352 352
     }
Please login to merge, or discard this patch.
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/inc/util_basic.inc 1 patch
Spacing   +6 added lines, -6 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;
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
 // ALSO: allow spaces.
223 223
 //
224 224
 function is_valid_filename($x) {
225
-    if (strlen($x)>255) return false;
225
+    if (strlen($x) > 255) return false;
226 226
     // \w means A-Za-z0-9_
227 227
     return preg_match('/^[\w\-. ]+$/', $x);
228 228
 }
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.