Skip to content

Commit e83909d

Browse files
authored
Merge pull request #6948 from BOINC/dpa_copilot
Web: fix copilot warnings, remove deprecated files. No functional changes
2 parents dbc4ace + 1fa76e8 commit e83909d

19 files changed

Lines changed: 24 additions & 800 deletions

html/inc/db.inc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,10 +168,10 @@ function db_init_aux($try_replica=false) {
168168
if ($x) $db_name = $x;
169169
}
170170
}
171-
if ($host == null) {
171+
if (is_blank($host)) {
172172
$host = parse_config($config, "<db_host>");
173173
}
174-
if ($host == null) {
174+
if (is_blank($host)) {
175175
$host = "localhost";
176176
}
177177
if (1) {

html/inc/util_basic.inc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,13 @@ function time_diff($x, $res=3) {
242242
return $s;
243243
}
244244

245+
// is the arg either null, '', or whitespace?
246+
// Note: if ($x) will be false if $x is '0'.
247+
// We don't want to treat '0' as blank.
248+
//
249+
function is_blank($x) {
250+
return $x === null || trim($x) === '';
251+
}
245252

246253
// security vulnerabilities and user-supplied strings:
247254
// sources:

html/inc/util_ops.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ function db_init_cli() {
103103
$config = get_config();
104104
$db_name = parse_config($config, "<db_name>");
105105
$host = parse_config($config, "<db_host>");
106-
if ($host == null) {
106+
if (is_blank($host)) {
107107
$host = "localhost";
108108
}
109109
$in = fopen("php://stdin","r");

html/ops/analyze_coproc_log.php

Lines changed: 0 additions & 92 deletions
This file was deleted.

html/ops/cancel_workunits.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
admin_page_head("Cancel Jobs");
3030

3131
$limit = get_int('limit', true);
32-
if (!$limit || $limit==0) {
32+
if (!$limit) {
3333
$limit = 100;
3434
}
3535

html/ops/fix_project_prefs.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ function repair_prefs($prefs) {
117117
}
118118

119119
$root = $prefs_dom->firstChild;
120-
if ($root->hasChildNodes()) {
120+
if ($root && $root->hasChildNodes()) {
121121
$subNodes = $root->childNodes;
122122
$to_remove = array();
123123
foreach ($subNodes as $subNode) {

html/ops/grant_credit.php

Lines changed: 0 additions & 123 deletions
This file was deleted.

html/ops/nvidia.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
// script for studying NVIDIA GPUs on hosts
2020

21-
DEPRECATED: we don't use host.serialnum anymore
21+
TODO: use host.misc instead of host.serialnum
2222

2323
$cli_only = true;
2424
require_once("../inc/util_ops.inc");

0 commit comments

Comments
 (0)