Completed
Push — master ( 47fbc6...d36692 )
by Vitalii
59s queued 24s
created
html/user/submit.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -477,7 +477,7 @@  discard block
 block discarded – undo
477 477
     if ($owner) {
478 478
         row2('submitter', $owner->name);
479 479
     }
480
-    row2("application", $app?$app->name:'---');
480
+    row2("application", $app ? $app->name : '---');
481 481
     row2("state", batch_state_string($batch->state));
482 482
     //row2("# jobs", $batch->njobs);
483 483
     //row2("# error jobs", $batch->nerror_jobs);
@@ -536,9 +536,9 @@  discard block
 block discarded – undo
536 536
         "status"
537 537
     ];
538 538
     row_heading_array($x);
539
-    foreach($wus as $wu) {
539
+    foreach ($wus as $wu) {
540 540
         $y = '';
541
-        switch($wu->status) {
541
+        switch ($wu->status) {
542 542
         case WU_SUCCESS:
543 543
             $resultid = $wu->canonical_resultid;
544 544
             $y = '<font color="green">completed</font>';
@@ -611,7 +611,7 @@  discard block
 block discarded – undo
611 611
     $results = BoincResult::enum("workunitid=$wuid");
612 612
     $upload_dir = parse_config(get_config(), "<upload_dir>");
613 613
     $fanout = parse_config(get_config(), "<uldl_dir_fanout>");
614
-    foreach($results as $result) {
614
+    foreach ($results as $result) {
615 615
         $x = [
616 616
             "<a href=result.php?resultid=$result->id>$result->id</a>",
617 617
             state_string($result)
@@ -620,7 +620,7 @@  discard block
 block discarded – undo
620 620
         if ($result->server_state == RESULT_SERVER_STATE_OVER) {
621 621
             $phys_names = get_outfile_phys_names($result);
622 622
             $log_names = get_outfile_log_names($result);
623
-            for ($i=0; $i<count($phys_names); $i++) {
623
+            for ($i = 0; $i < count($phys_names); $i++) {
624 624
                 if ($is_assim_move) {
625 625
                     // file is in
626 626
                     // project/results/<batchid>/<wu_name>__file_<log_name>
Please login to merge, or discard this patch.
html/user/buda_submit.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 //
65 65
 function unzip_batch_file($user, $batch_file) {
66 66
     @mkdir("../../buda_batches");
67
-    for ($i=0; $i<1000; $i++) {
67
+    for ($i = 0; $i < 1000; $i++) {
68 68
         $batch_dir = "../../buda_batches/$i";
69 69
         $batch_dir_name = $i;
70 70
         $ret = @mkdir($batch_dir);
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
         }
116 116
         $job_files = [];
117 117
         $cmdline = '';
118
-        foreach(scandir("$batch_dir/$fname") as $f2) {
118
+        foreach (scandir("$batch_dir/$fname") as $f2) {
119 119
             if ($f2[0] == '.') continue;
120 120
             if ($f2 == 'cmdline') {
121 121
                 $cmdline = trim(file_get_contents("$batch_dir/$fname/cmdline"));
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 function stage_input_files($batch_dir, $batch_desc, $batch_id) {
166 166
     $n = count($batch_desc->shared_files);
167 167
     $batch_desc->shared_files_phys_names = [];
168
-    for ($i=0; $i<$n; $i++) {
168
+    for ($i = 0; $i < $n; $i++) {
169 169
         $path = sprintf('%s/%s', $batch_dir, $batch_desc->shared_files[$i]);
170 170
         [$md5, $size] = $batch_desc->shared_file_infos[$i];
171 171
         $phys_name = sprintf('batch_%d_%s', $batch_id, $md5);
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
     foreach ($batch_desc->jobs as $job) {
176 176
         $n = count($batch_desc->unshared_files);
177 177
         $job->phys_names = [];
178
-        for ($i=0; $i<$n; $i++) {
178
+        for ($i = 0; $i < $n; $i++) {
179 179
             $path = sprintf('%s/%s/%s',
180 180
                 $batch_dir, $job->dir, $batch_desc->unshared_files[$i]
181 181
             );
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
     }
224 224
     $wrapper_cmdline = sprintf('"--dockerfile %s %s %s"',
225 225
         $variant_desc->dockerfile,
226
-        $wrapper_verbose?'--verbose':'',
226
+        $wrapper_verbose ? '--verbose' : '',
227 227
         $cmdline
228 228
     );
229 229
     $cmd = sprintf(
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
 
305 305
 // show list of BUDA apps and variants, with submission buttons
306 306
 //
307
-function app_list($notice=null) {
307
+function app_list($notice = null) {
308 308
     global $buda_root;
309 309
     page_head('Submit BUDA jobs');
310 310
     text_start();
Please login to merge, or discard this patch.
html/user/manage_project.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
             $app = BoincApp::lookup_id($ua->app_id);
37 37
             $names[] = $app->name;
38 38
         }
39
-        $sub = $names?implode(', ', $names):'---';
39
+        $sub = $names ?implode(', ', $names) : '---';
40 40
     }
41 41
     if ($u->manage_all) {
42 42
         $admin = 'All applications';
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
             $app = BoincApp::lookup_id($ua->app_id);
48 48
             $names[] = $app->name;
49 49
         }
50
-        $admin = $names?implode(', ', $names):'---';
50
+        $admin = $names ?implode(', ', $names) : '---';
51 51
     }
52 52
 
53 53
     table_row(
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
         $admin,
60 60
         $u->quota,
61 61
         $u->max_jobs_in_progress,
62
-        ($u->logical_start_time > time())?local_time_str($u->logical_start_time):'---'
62
+        ($u->logical_start_time > time()) ?local_time_str($u->logical_start_time) : '---'
63 63
     );
64 64
 }
65 65
 
@@ -184,18 +184,18 @@  discard block
 block discarded – undo
184 184
     $manage_apps = array_map('intval', $manage_apps);
185 185
     foreach ($apps as $app) {
186 186
         $s = in_array($app->id, $submit_apps);
187
-        $m = in_array($app->id, $manage_apps)?1:0;
187
+        $m = in_array($app->id, $manage_apps) ? 1 : 0;
188 188
         if ($s || $m) {
189 189
             BoincUserSubmitApp::insert(
190 190
                 "(user_id, app_id, manage) values ($user_id, $app->id, $m)"
191 191
             );
192 192
         }
193 193
     }
194
-    $quota = (double) get_str('quota');
194
+    $quota = (double)get_str('quota');
195 195
     if ($quota != $us->quota) {
196 196
         $us->update("quota=$quota");
197 197
     }
198
-    $mj = (int) get_str('max_jobs_in_progress');
198
+    $mj = (int)get_str('max_jobs_in_progress');
199 199
     if ($mj != $us->max_jobs_in_progress) {
200 200
         $us->update("max_jobs_in_progress=$mj");
201 201
     }
Please login to merge, or discard this patch.
html/user/buda.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 // show list of BUDA apps and variants,
55 55
 // w/ buttons for adding and deleting
56 56
 //
57
-function app_list($notice=null) {
57
+function app_list($notice = null) {
58 58
     global $buda_root;
59 59
     if (!is_dir($buda_root)) {
60 60
         mkdir($buda_root);
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
     //
257 257
     $x = "<input_template>\n";
258 258
     $ninfiles = 1 + count($variant_desc->input_file_names) + count($variant_desc->app_files);
259
-    for ($i=0; $i<$ninfiles; $i++) {
259
+    for ($i = 0; $i < $ninfiles; $i++) {
260 260
         $x .= "   <file_info>\n      <sticky/>\n      <no_delete/>\n      <executable/>\n   </file_info>\n";
261 261
     }
262 262
     $x .= "   <workunit>\n";
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
     );
287 287
 
288 288
     $x .= sprintf("      <max_delay>%f</max_delay>\n",
289
-        $variant_desc->max_delay * 86400.
289
+        $variant_desc->max_delay*86400.
290 290
     );
291 291
 
292 292
     $x .= "   </workunit>\n<input_template>\n";
@@ -467,8 +467,8 @@  discard block
 block discarded – undo
467 467
     }
468 468
 }
469 469
 
470
-function app_form($desc=null) {
471
-    page_head_select2($desc?"Edit BUDA app $desc->name":'Create BUDA app');
470
+function app_form($desc = null) {
471
+    page_head_select2($desc ? "Edit BUDA app $desc->name" : 'Create BUDA app');
472 472
     form_start('buda.php');
473 473
     form_input_hidden('action', 'app_action');
474 474
     if ($desc) {
@@ -479,22 +479,22 @@  discard block
 block discarded – undo
479 479
         form_input_text('Internal name<br><small>No spaces</small>', 'name');
480 480
     }
481 481
     form_input_text('User-visible name', 'long_name',
482
-        $desc?$desc->long_name:null
482
+        $desc ? $desc->long_name : null
483 483
     );
484 484
     form_input_textarea(
485 485
         'Description<br><small>... of what the app does and of the research goals</small>',
486 486
         'description',
487
-        $desc?$desc->description:null
487
+        $desc ? $desc->description : null
488 488
     );
489 489
     form_select2_multi('Science keywords',
490 490
         'sci_kw',
491 491
         keyword_select_options(KW_CATEGORY_SCIENCE),
492
-        $desc?$desc->sci_kw:null
492
+        $desc ? $desc->sci_kw : null
493 493
     );
494 494
     form_input_text(
495 495
         'URL of web page describing app',
496 496
         'url',
497
-        $desc?$desc->url:''
497
+        $desc ? $desc->url : ''
498 498
     );
499 499
     // don't include location keywords;
500 500
     // various people may submit jobs to this app
Please login to merge, or discard this patch.
html/inc/bootstrap.inc 1 patch
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -210,7 +210,7 @@
 block discarded – undo
210 210
                                 ];
211 211
                             } else {
212 212
                                 $x[] = [
213
-                                    "Manage $app->name",
213
+                                    "manage $app->name",
214 214
                                     "manage_project.php"
215 215
                                 ];
216 216
                             }
Please login to merge, or discard this patch.
html/inc/submit_util.inc 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
     foreach ($res_in_prog as $res) {
179 179
         $wus_in_prog[$res->workunitid] = true;
180 180
     }
181
-    unset($res_in_progress);    // does this do anything?
181
+    unset($res_in_progress); // does this do anything?
182 182
 
183 183
     $fp_total = 0;
184 184
     $fp_done = 0;
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
 // get the total size of output files of a batch
321 321
 //
322 322
 function batch_output_file_size($batchid) {
323
-    $batch_td_size=0;
323
+    $batch_td_size = 0;
324 324
     $wus = BoincWorkunit::enum("batch=$batchid");
325 325
     $fanout = parse_config(get_config(), "<uldl_dir_fanout>");
326 326
     $upload_dir = parse_config(get_config(), "<upload_dir>");
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
 }
351 351
 
352 352
 function boinc_get_wu_output_files_url($user, $wu_id) {
353
-    $auth_str =  md5($user->authenticator.$wu_id);
353
+    $auth_str = md5($user->authenticator.$wu_id);
354 354
     return "get_output.php?cmd=workunit_files&wu_id=$wu_id&auth_str=$auth_str";
355 355
 }
356 356
 
@@ -384,7 +384,7 @@  discard block
 block discarded – undo
384 384
     if (!file_exists($path)) return null;
385 385
     $x = file_get_contents($path);
386 386
     $n = sscanf($x, "%s %d", $md5, $size);
387
-    if ($n != 2 || strlen($md5)!=32) {
387
+    if ($n != 2 || strlen($md5) != 32) {
388 388
         return null;
389 389
     }
390 390
     return [$md5, $size];
Please login to merge, or discard this patch.
html/inc/boinc_db.inc 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -362,12 +362,12 @@
 block discarded – undo
362 362
         $db = BoincDb::get();
363 363
         return $db->enum('result', 'BoincResult', $where_clause);
364 364
     }
365
-	static function enum_fields($fields, $where_clause, $order_clause=null) {
365
+    static function enum_fields($fields, $where_clause, $order_clause=null) {
366 366
         $db = BoincDb::get();
367
-		return $db->enum_fields(
367
+        return $db->enum_fields(
368 368
             'result', 'BoincResult', $fields, $where_clause, $order_clause
369 369
         );
370
-	}
370
+    }
371 371
     function update($clause) {
372 372
         $db = BoincDb::get();
373 373
         return $db->update($this, 'result', $clause);
Please login to merge, or discard this patch.
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -44,8 +44,8 @@  discard block
 block discarded – undo
44 44
 // close() closes the connection.
45 45
 
46 46
 class BoincDb {
47
-    static $instance;       // a DbConn object, or null
48
-    static $dbnum;          // which replica we're connected to
47
+    static $instance; // a DbConn object, or null
48
+    static $dbnum; // which replica we're connected to
49 49
 
50 50
     // connect to DB $dbnum (0, 1, ...)
51 51
     // If the requested DB doesn't exist or connection fails, connect to DB 0.
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
         self::$instance = null;
57 57
         $config = get_config();
58 58
         if ($dbnum) {
59
-            $r = $dbnum==1?'':strval($dbnum);
59
+            $r = $dbnum == 1 ? '' : strval($dbnum);
60 60
             $host = parse_config($config, sprintf('<replica%s_db_host>', $r));
61 61
             $name = parse_config($config, sprintf('<replica%s_db_name>', $r));
62 62
             $user = parse_config($config, sprintf('<replica%s_db_user>', $r));
@@ -204,11 +204,11 @@  discard block
 block discarded – undo
204 204
         $db = BoincDb::get();
205 205
         return $db->update($this, 'user', $clause);
206 206
     }
207
-    static function enum($where_clause, $order_clause=null) {
207
+    static function enum($where_clause, $order_clause = null) {
208 208
         $db = BoincDb::get();
209 209
         return $db->enum('user', 'BoincUser', $where_clause, $order_clause);
210 210
     }
211
-    static function enum_fields($fields, $where_clause, $order_clause=null) {
211
+    static function enum_fields($fields, $where_clause, $order_clause = null) {
212 212
         $db = BoincDb::get();
213 213
         return $db->enum_fields(
214 214
             'user', 'BoincUser', $fields, $where_clause, $order_clause
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
         $db = BoincDb::get();
259 259
         return $db->update($this, 'team', $clause);
260 260
     }
261
-    static function enum($where_clause, $order_clause=null) {
261
+    static function enum($where_clause, $order_clause = null) {
262 262
         $db = BoincDb::get();
263 263
         return $db->enum('team', 'BoincTeam', $where_clause, $order_clause);
264 264
     }
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
         $db = BoincDb::get();
284 284
         return $db->max('team', $field);
285 285
     }
286
-    static function enum_fields($fields, $where_clause, $order_clause=null) {
286
+    static function enum_fields($fields, $where_clause, $order_clause = null) {
287 287
         $db = BoincDb::get();
288 288
         return $db->enum_fields(
289 289
             'team', 'BoincTeam', $fields, $where_clause, $order_clause
@@ -321,11 +321,11 @@  discard block
 block discarded – undo
321 321
         $db = BoincDb::get();
322 322
         return $db->delete($this, 'host');
323 323
     }
324
-    static function enum($where_clause, $order_clause=null) {
324
+    static function enum($where_clause, $order_clause = null) {
325 325
         $db = BoincDb::get();
326 326
         return $db->enum('host', 'BoincHost', $where_clause, $order_clause);
327 327
     }
328
-    static function enum_fields($fields, $where_clause, $order_clause=null) {
328
+    static function enum_fields($fields, $where_clause, $order_clause = null) {
329 329
         $db = BoincDb::get();
330 330
         return $db->enum_fields(
331 331
             'host', 'BoincHost', $fields, $where_clause, $order_clause
@@ -362,7 +362,7 @@  discard block
 block discarded – undo
362 362
         $db = BoincDb::get();
363 363
         return $db->enum('result', 'BoincResult', $where_clause);
364 364
     }
365
-	static function enum_fields($fields, $where_clause, $order_clause=null) {
365
+	static function enum_fields($fields, $where_clause, $order_clause = null) {
366 366
         $db = BoincDb::get();
367 367
 		return $db->enum_fields(
368 368
             'result', 'BoincResult', $fields, $where_clause, $order_clause
@@ -449,7 +449,7 @@  discard block
 block discarded – undo
449 449
         $db = BoincDb::get();
450 450
         return $db->update($this, 'app', $clause);
451 451
     }
452
-    static function sum($field, $clause=null) {
452
+    static function sum($field, $clause = null) {
453 453
         $db = BoincDb::get();
454 454
         return $db->sum('app', $field, $clause);
455 455
     }
@@ -507,11 +507,11 @@  discard block
 block discarded – undo
507 507
         $db = BoincDb::get();
508 508
         return $db->insert('profile', $clause);
509 509
     }
510
-    static function enum($where_clause=null, $order_clause=null) {
510
+    static function enum($where_clause = null, $order_clause = null) {
511 511
         $db = BoincDb::get();
512 512
         return $db->enum('profile', 'BoincProfile', $where_clause, $order_clause);
513 513
     }
514
-    static function enum_fields($fields, $where_clause=null, $order_clause=null) {
514
+    static function enum_fields($fields, $where_clause = null, $order_clause = null) {
515 515
         $db = BoincDb::get();
516 516
         return $db->enum_fields('profile', 'BoincProfile', $fields, $where_clause, $order_clause);
517 517
     }
@@ -906,12 +906,12 @@  discard block
 block discarded – undo
906 906
         return $db->enum('consent', 'BoincConsent', $where_clause);
907 907
     }
908 908
 
909
-    static function insert ($clause) {
909
+    static function insert($clause) {
910 910
         $db = BoincDb::get();
911 911
         return $db->insert('consent', $clause);
912 912
     }
913 913
 
914
-    static function update ($clause) {
914
+    static function update($clause) {
915 915
         $db = BoincDb::get();
916 916
         return $db->update_aux('consent', $clause);
917 917
     }
@@ -936,17 +936,17 @@  discard block
 block discarded – undo
936 936
         return $db->lookup('consent_type', 'BoincConsentType', $clause);
937 937
     }
938 938
 
939
-    static function enum($where_clause, $order_clause=null) {
939
+    static function enum($where_clause, $order_clause = null) {
940 940
         $db = BoincDb::get();
941 941
         return $db->enum('consent_type', 'BoincConsentType', $where_clause, $order_clause);
942 942
     }
943 943
 
944
-    static function insert ($clause) {
944
+    static function insert($clause) {
945 945
         $db = BoincDb::get();
946 946
         return $db->insert('consent_type', $clause);
947 947
     }
948 948
 
949
-    static function update ($clause) {
949
+    static function update($clause) {
950 950
         $db = BoincDb::get();
951 951
         return $db->update_aux('consent_type', $clause);
952 952
     }
@@ -972,7 +972,7 @@  discard block
 block discarded – undo
972 972
         return $db->lookup('latest_consent', 'BoincLatestConsent', $clause);
973 973
     }
974 974
 
975
-    static function enum($where_clause, $order_clause=null) {
975
+    static function enum($where_clause, $order_clause = null) {
976 976
         $db = BoincDb::get();
977 977
         return $db->enum('latest_consent', 'BoincLatestConsent', $where_clause, $order_clause);
978 978
     }
@@ -983,7 +983,7 @@  discard block
 block discarded – undo
983 983
 // apply this to any user-supplied strings used in queries
984 984
 //
985 985
 function boinc_real_escape_string($x) {
986
-    if (version_compare(phpversion(),"4.3.0")>=0) {
986
+    if (version_compare(phpversion(), "4.3.0") >= 0) {
987 987
         return BoincDb::escape_string($x);
988 988
     } else {
989 989
         $x = str_replace("'", "\'", $x);
Please login to merge, or discard this patch.