Passed
Push — vko_fix_manager_add_projects_w... ( 672238 )
by Vitalii
10:53
created
html/ops/make_emails_lowercase.php 4 patches
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -37,14 +37,14 @@  discard block
 block discarded – undo
37 37
 
38 38
 // activate/deactivate script
39 39
 if (1) {
40
-  echo "
40
+    echo "
41 41
 This script needs to be activated before it can be run.
42 42
 Once you understand what the script does you can change the
43 43
 if (1) to if (0) at the top of the file to activate it.
44 44
 Be sure to deactivate the script after using it to make sure
45 45
 it is not accidentally run.
46 46
 ";
47
-  exit;
47
+    exit;
48 48
 }
49 49
 
50 50
 db_init();
@@ -63,33 +63,33 @@  discard block
 block discarded – undo
63 63
 // loop over all users
64 64
 while ($user = _mysql_fetch_object($result)) {
65 65
 
66
-  $id=$user->id;
67
-  $email_addr=$user->email_addr;
68
-  $cpid=$user->cross_project_id;
66
+    $id=$user->id;
67
+    $email_addr=$user->email_addr;
68
+    $cpid=$user->cross_project_id;
69 69
 
70
-  $new_email=strtolower(trim($email_addr));
70
+    $new_email=strtolower(trim($email_addr));
71 71
   
72
-  if (strcmp($email_addr, $new_email))
72
+    if (strcmp($email_addr, $new_email))
73 73
     echo "Problematic email address [$id] $email_addr becomes $new_email<br/>";
74 74
   
75
-  if (!(strcmp($cpid,"0"))) {
75
+    if (!(strcmp($cpid,"0"))) {
76 76
     $newcpid=random_string();
77 77
     echo "Problematic CPID=0 for [$id] $email_addr gets CPID=$newcpid<br/>";
78
-  }
79
-  else
78
+    }
79
+    else
80 80
     $newcpid=$cpid;
81 81
   
82
-  if (strcmp($email_addr, $new_email) || strcmp($newcpid,$cpid)) {
82
+    if (strcmp($email_addr, $new_email) || strcmp($newcpid,$cpid)) {
83 83
     $update="update user set email_addr='$new_email', cross_project_id='$newcpid' where id='$id'";
84 84
     if ($confirm != "yes") {
85
-      echo "QUERY WOULD BE [$id] $query <br/>[click the link at the bottom to enable]<br/>";
86
-      $update_needed = TRUE;
85
+        echo "QUERY WOULD BE [$id] $query <br/>[click the link at the bottom to enable]<br/>";
86
+        $update_needed = TRUE;
87 87
     }
88 88
     else {
89
-      _mysql_query($update);
90
-      echo "Doing $update<br/>\n";
89
+        _mysql_query($update);
90
+        echo "Doing $update<br/>\n";
91
+    }
91 92
     }
92
-  }
93 93
 }
94 94
 if ($confirm != "yes" && $update_needed) {
95 95
     echo "You can enable the changes by <a href=\"make_emails_lowercase.php?confirm=yes\">click</a>";
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -75,8 +75,7 @@  discard block
 block discarded – undo
75 75
   if (!(strcmp($cpid,"0"))) {
76 76
     $newcpid=random_string();
77 77
     echo "Problematic CPID=0 for [$id] $email_addr gets CPID=$newcpid<br/>";
78
-  }
79
-  else
78
+  } else
80 79
     $newcpid=$cpid;
81 80
   
82 81
   if (strcmp($email_addr, $new_email) || strcmp($newcpid,$cpid)) {
@@ -84,8 +83,7 @@  discard block
 block discarded – undo
84 83
     if ($confirm != "yes") {
85 84
       echo "QUERY WOULD BE [$id] $query <br/>[click the link at the bottom to enable]<br/>";
86 85
       $update_needed = TRUE;
87
-    }
88
-    else {
86
+    } else {
89 87
       _mysql_query($update);
90 88
       echo "Doing $update<br/>\n";
91 89
     }
Please login to merge, or discard this patch.
Upper-Lower-Casing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -83,11 +83,11 @@
 block discarded – undo
83 83
     $update="update user set email_addr='$new_email', cross_project_id='$newcpid' where id='$id'";
84 84
     if ($confirm != "yes") {
85 85
       echo "QUERY WOULD BE [$id] $query <br/>[click the link at the bottom to enable]<br/>";
86
-      $update_needed = TRUE;
86
+      $update_needed = true;
87 87
     }
88 88
     else {
89 89
       _mysql_query($update);
90
-      echo "Doing $update<br/>\n";
90
+      echo "doing $update<br/>\n";
91 91
     }
92 92
   }
93 93
 }
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -63,24 +63,24 @@
 block discarded – undo
63 63
 // loop over all users
64 64
 while ($user = _mysql_fetch_object($result)) {
65 65
 
66
-  $id=$user->id;
67
-  $email_addr=$user->email_addr;
68
-  $cpid=$user->cross_project_id;
66
+  $id = $user->id;
67
+  $email_addr = $user->email_addr;
68
+  $cpid = $user->cross_project_id;
69 69
 
70
-  $new_email=strtolower(trim($email_addr));
70
+  $new_email = strtolower(trim($email_addr));
71 71
 
72 72
   if (strcmp($email_addr, $new_email))
73 73
     echo "Problematic email address [$id] $email_addr becomes $new_email<br/>";
74 74
 
75
-  if (!(strcmp($cpid,"0"))) {
76
-    $newcpid=random_string();
75
+  if (!(strcmp($cpid, "0"))) {
76
+    $newcpid = random_string();
77 77
     echo "Problematic CPID=0 for [$id] $email_addr gets CPID=$newcpid<br/>";
78 78
   }
79 79
   else
80
-    $newcpid=$cpid;
80
+    $newcpid = $cpid;
81 81
 
82
-  if (strcmp($email_addr, $new_email) || strcmp($newcpid,$cpid)) {
83
-    $update="update user set email_addr='$new_email', cross_project_id='$newcpid' where id='$id'";
82
+  if (strcmp($email_addr, $new_email) || strcmp($newcpid, $cpid)) {
83
+    $update = "update user set email_addr='$new_email', cross_project_id='$newcpid' where id='$id'";
84 84
     if ($confirm != "yes") {
85 85
       echo "QUERY WOULD BE [$id] $query <br/>[click the link at the bottom to enable]<br/>";
86 86
       $update_needed = TRUE;
Please login to merge, or discard this patch.
html/ops/team_export.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -100,7 +100,7 @@
 block discarded – undo
100 100
     $f = fopen("temp.xml", "w");
101 101
     $teams = BoincTeam::enum(null);
102 102
     fwrite($f, "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<teams>\n");
103
-    foreach($teams as $team) {
103
+    foreach ($teams as $team) {
104 104
         handle_team($team, $f);
105 105
     }
106 106
     fwrite($f, "</teams>\n");
Please login to merge, or discard this patch.
html/ops/badge_admin.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@
 block discarded – undo
39 39
     $i = 0;
40 40
     foreach ($badges as $badge) {
41 41
         echo "<tr class=row$i valign=top><form action=badge_admin.php method=POST>";
42
-        $i = 1-$i;
42
+        $i = 1 - $i;
43 43
         echo "<td>$badge->id</td>\n";
44 44
         echo "<input type=hidden name=id value=$badge->id>";
45 45
         $nu = BoincBadgeUser::count("badge_id=$badge->id");
Please login to merge, or discard this patch.
html/ops/db_schemaversion.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@
 block discarded – undo
28 28
 $updates = array();
29 29
 foreach ($db_updates as $db_update) {
30 30
     if ($db_update[0] > $db_revision) {
31
-		$db_revision = $db_update[0];
31
+        $db_revision = $db_update[0];
32 32
     }
33 33
 }
34 34
 
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@
 block discarded – undo
21 21
 
22 22
 $db_revision = 0;
23 23
 if (file_exists("../../db_revision")) {
24
-    $db_revision = (int) file_get_contents("../../db_revision");
24
+    $db_revision = (int)file_get_contents("../../db_revision");
25 25
 }
26 26
 require_once("db_update.php");
27 27
 
Please login to merge, or discard this patch.
html/ops/test_job_file.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
     $post = array();
59 59
     $post["request"] = $xml;
60 60
     if ($req->type == "upload") {
61
-        $i=0;
61
+        $i = 0;
62 62
         foreach ($files as $f) {
63 63
             if ($f['path'] != "") {
64 64
                 $post["file_$i"] = '@'.$f['path'];
@@ -70,9 +70,9 @@  discard block
 block discarded – undo
70 70
     curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
71 71
     $reply = curl_exec($ch);
72 72
     if ($reply) {
73
-        print $reply . "\n";
73
+        print $reply."\n";
74 74
     } else {
75
-        print curl_error($ch) . "\n";
75
+        print curl_error($ch)."\n";
76 76
     }
77 77
     curl_close($ch);
78 78
 }
Please login to merge, or discard this patch.
html/ops/update_forum_activities.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@
 block discarded – undo
40 40
     }
41 41
     if ($is_helpdesk) {
42 42
         $diff = ($now - $thread->create_time)/86400;
43
-        $activity = ($thread->sufferers+1)/$diff;
43
+        $activity = ($thread->sufferers + 1)/$diff;
44 44
         echo "thread $thread->id helpdesk $diff $activity\n";
45 45
     } else {
46 46
         $posts = BoincPost::enum("thread=$thread->id");
Please login to merge, or discard this patch.
html/ops/db_cleanse.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@
 block discarded – undo
51 51
     $n = 0;
52 52
     while (1) {
53 53
         $n++;
54
-        if ($n % 1000 == 0) echo "$n\n";
54
+        if ($n%1000 == 0) echo "$n\n";
55 55
         $x = fgets($fres);
56 56
         if (!$x) break;
57 57
         list($reswuid, $resid) = sscanf($x, "%d %d");
Please login to merge, or discard this patch.
html/ops/nvidia.php 2 patches
Indentation   +80 added lines, -80 removed lines patch added patch discarded remove patch
@@ -68,93 +68,93 @@
 block discarded – undo
68 68
 }
69 69
 
70 70
 function analyze_nvidia() {
71
-	$hosts_total = 0;     // number of hosts 6.2 or better
72
-	$hosts_gpu = 0;     // number with an nvidia gpu
73
-	$rac_total =0;
74
-	$rac_gpu = 0;
75
-	$linux_total = 0;
76
-	$linux_gpus = 0;
77
-	$windows_total = 0;
78
-	$windows_gpus = 0;
79
-	$model = array();   // name -> count
80
-	$ram = array();     // size -> count
81
-	$driver = array();  // vers -> count
82
-	$ngpus = array();   // ngpus -> count
71
+    $hosts_total = 0;     // number of hosts 6.2 or better
72
+    $hosts_gpu = 0;     // number with an nvidia gpu
73
+    $rac_total =0;
74
+    $rac_gpu = 0;
75
+    $linux_total = 0;
76
+    $linux_gpus = 0;
77
+    $windows_total = 0;
78
+    $windows_gpus = 0;
79
+    $model = array();   // name -> count
80
+    $ram = array();     // size -> count
81
+    $driver = array();  // vers -> count
82
+    $ngpus = array();   // ngpus -> count
83 83
 
84
-	$hosts = BoincHost::enum("expavg_credit > 10 and serialnum<>''");
85
-	foreach($hosts as $host) {
86
-		$boinc_vers = parse_vers($host->serialnum);
87
-		if (!$boinc_vers) continue;
88
-		if ($boinc_vers->major < 6) continue;
89
-		$is_linux = false;
90
-		if (strstr($host->os_name, "Linux")) {
91
-			$linux_total++;
92
-			$is_linux = true;
93
-		} else if (strstr($host->os_name, "Windows")) {
94
-			$windows_total++;
95
-		} else {
96
-			continue;
97
-		}
98
-		$hosts_total++;
99
-		$rac_total += $host->expavg_credit;
100
-		$gpu = parse_cuda($host->serialnum);
101
-		if (!$gpu) {
102
-			continue;
103
-		}
104
-		$hosts_gpu++;
105
-		$rac_gpu += $host->expavg_credit;
106
-		if ($is_linux) {
107
-			$linux_gpus++;
108
-		} else {
109
-			$windows_gpus++;
110
-		}
111
-		inc($model, $gpu->model);
112
-		inc($ram, $gpu->ram);
113
-		inc($driver, $gpu->driver);
114
-		inc($ngpus, $gpu->ngpus);
115
-	}
84
+    $hosts = BoincHost::enum("expavg_credit > 10 and serialnum<>''");
85
+    foreach($hosts as $host) {
86
+        $boinc_vers = parse_vers($host->serialnum);
87
+        if (!$boinc_vers) continue;
88
+        if ($boinc_vers->major < 6) continue;
89
+        $is_linux = false;
90
+        if (strstr($host->os_name, "Linux")) {
91
+            $linux_total++;
92
+            $is_linux = true;
93
+        } else if (strstr($host->os_name, "Windows")) {
94
+            $windows_total++;
95
+        } else {
96
+            continue;
97
+        }
98
+        $hosts_total++;
99
+        $rac_total += $host->expavg_credit;
100
+        $gpu = parse_cuda($host->serialnum);
101
+        if (!$gpu) {
102
+            continue;
103
+        }
104
+        $hosts_gpu++;
105
+        $rac_gpu += $host->expavg_credit;
106
+        if ($is_linux) {
107
+            $linux_gpus++;
108
+        } else {
109
+            $windows_gpus++;
110
+        }
111
+        inc($model, $gpu->model);
112
+        inc($ram, $gpu->ram);
113
+        inc($driver, $gpu->driver);
114
+        inc($ngpus, $gpu->ngpus);
115
+    }
116 116
 
117
-	$pct = 100*($hosts_gpu/$hosts_total);
118
-	echo "ntotal: $hosts_total   ngpus: $hosts_gpu ($pct %)\n";
119
-	$pct = 100*($windows_gpus/$windows_total);
120
-	echo "Windows: total $windows_total gpus $windows_gpus ($pct %)\n";
121
-	$pct = 100*($linux_gpus/$linux_total);
122
-	echo "Linux: total $linux_total gpus $linux_gpus ($pct %)\n";
117
+    $pct = 100*($hosts_gpu/$hosts_total);
118
+    echo "ntotal: $hosts_total   ngpus: $hosts_gpu ($pct %)\n";
119
+    $pct = 100*($windows_gpus/$windows_total);
120
+    echo "Windows: total $windows_total gpus $windows_gpus ($pct %)\n";
121
+    $pct = 100*($linux_gpus/$linux_total);
122
+    echo "Linux: total $linux_total gpus $linux_gpus ($pct %)\n";
123 123
 
124
-	$rac_non_gpu = $rac_total - $rac_gpu;
125
-	$hosts_non_gpu = $hosts_total - $hosts_gpu;
126
-	$a = $rac_gpu/$hosts_gpu;
127
-	$b = $rac_non_gpu/$hosts_non_gpu;
128
-	echo "Avg RAC: GPU: $a non-GPU: $b\n";
124
+    $rac_non_gpu = $rac_total - $rac_gpu;
125
+    $hosts_non_gpu = $hosts_total - $hosts_gpu;
126
+    $a = $rac_gpu/$hosts_gpu;
127
+    $b = $rac_non_gpu/$hosts_non_gpu;
128
+    echo "Avg RAC: GPU: $a non-GPU: $b\n";
129 129
 
130
-	arsort($model);
131
-	foreach($model as $m=>$c) {
132
-		echo "$m $c\n";
133
-	}
134
-	print_r($ram);
135
-	print_r($driver);
136
-	print_r($ngpus);
130
+    arsort($model);
131
+    foreach($model as $m=>$c) {
132
+        echo "$m $c\n";
133
+    }
134
+    print_r($ram);
135
+    print_r($driver);
136
+    print_r($ngpus);
137 137
 }
138 138
 
139 139
 function analyze_all() {
140
-	$total = 0;
141
-	$nnv = 0;
142
-	$nati = 0;
143
-	$nboth = 0;
144
-	$hosts = BoincHost::enum("expavg_credit > 10 and serialnum<>''");
145
-	foreach($hosts as $host) {
146
-		$boinc_vers = parse_vers($host->serialnum);
147
-		if (!$boinc_vers) continue;
148
-		if ($boinc_vers->major < 6) continue;
149
-		if ($boinc_vers->major == 6 && $boinc_vers->minor < 10) continue;
150
-		$total++;
151
-		$has_nv = strstr($host->serialnum, 'CUDA');
152
-		$has_ati = strstr($host->serialnum, 'ATI');
153
-		if ($has_nv) $nnv++;
154
-		if ($has_ati) $nati++;
155
-		if ($has_nv && $has_ati) $nboth++;
156
-	}
157
-	echo "total: $total NVIDIA: $nnv ATI: $nati both: $nboth\n";
140
+    $total = 0;
141
+    $nnv = 0;
142
+    $nati = 0;
143
+    $nboth = 0;
144
+    $hosts = BoincHost::enum("expavg_credit > 10 and serialnum<>''");
145
+    foreach($hosts as $host) {
146
+        $boinc_vers = parse_vers($host->serialnum);
147
+        if (!$boinc_vers) continue;
148
+        if ($boinc_vers->major < 6) continue;
149
+        if ($boinc_vers->major == 6 && $boinc_vers->minor < 10) continue;
150
+        $total++;
151
+        $has_nv = strstr($host->serialnum, 'CUDA');
152
+        $has_ati = strstr($host->serialnum, 'ATI');
153
+        if ($has_nv) $nnv++;
154
+        if ($has_ati) $nati++;
155
+        if ($has_nv && $has_ati) $nboth++;
156
+    }
157
+    echo "total: $total NVIDIA: $nnv ATI: $nati both: $nboth\n";
158 158
 }
159 159
 
160 160
 analyze_all();
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 $cli_only = true;
22 22
 require_once("../inc/util_ops.inc");
23 23
 
24
-ini_set ("memory_limit", "8000M");
24
+ini_set("memory_limit", "8000M");
25 25
 set_time_limit(0);
26 26
 
27 27
 error_reporting(E_ALL);
@@ -68,21 +68,21 @@  discard block
 block discarded – undo
68 68
 }
69 69
 
70 70
 function analyze_nvidia() {
71
-	$hosts_total = 0;     // number of hosts 6.2 or better
72
-	$hosts_gpu = 0;     // number with an nvidia gpu
73
-	$rac_total =0;
71
+	$hosts_total = 0; // number of hosts 6.2 or better
72
+	$hosts_gpu = 0; // number with an nvidia gpu
73
+	$rac_total = 0;
74 74
 	$rac_gpu = 0;
75 75
 	$linux_total = 0;
76 76
 	$linux_gpus = 0;
77 77
 	$windows_total = 0;
78 78
 	$windows_gpus = 0;
79
-	$model = array();   // name -> count
80
-	$ram = array();     // size -> count
81
-	$driver = array();  // vers -> count
82
-	$ngpus = array();   // ngpus -> count
79
+	$model = array(); // name -> count
80
+	$ram = array(); // size -> count
81
+	$driver = array(); // vers -> count
82
+	$ngpus = array(); // ngpus -> count
83 83
 
84 84
 	$hosts = BoincHost::enum("expavg_credit > 10 and serialnum<>''");
85
-	foreach($hosts as $host) {
85
+	foreach ($hosts as $host) {
86 86
 		$boinc_vers = parse_vers($host->serialnum);
87 87
 		if (!$boinc_vers) continue;
88 88
 		if ($boinc_vers->major < 6) continue;
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 	echo "Avg RAC: GPU: $a non-GPU: $b\n";
129 129
 
130 130
 	arsort($model);
131
-	foreach($model as $m=>$c) {
131
+	foreach ($model as $m=>$c) {
132 132
 		echo "$m $c\n";
133 133
 	}
134 134
 	print_r($ram);
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 	$nati = 0;
143 143
 	$nboth = 0;
144 144
 	$hosts = BoincHost::enum("expavg_credit > 10 and serialnum<>''");
145
-	foreach($hosts as $host) {
145
+	foreach ($hosts as $host) {
146 146
 		$boinc_vers = parse_vers($host->serialnum);
147 147
 		if (!$boinc_vers) continue;
148 148
 		if ($boinc_vers->major < 6) continue;
Please login to merge, or discard this patch.
html/ops/app_details.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@
 block discarded – undo
51 51
     row2("Plan class", $av->plan_class);
52 52
     row2("Version num", $av->version_num);
53 53
     row2("Jobs validated", $av->pfc_n);
54
-    row2("Average efficiency", $av->pfc_avg?1/$av->pfc_avg:"---");
54
+    row2("Average efficiency", $av->pfc_avg ? 1/$av->pfc_avg : "---");
55 55
     row2("Credit scale factor", $av->pfc_scale);
56 56
     row2("Average credit", $av->expavg_credit);
57 57
     end_table();
Please login to merge, or discard this patch.