Issues (1963)

html/ops/reset_hrclass.php (3 issues)

1
<?php
2
// This file is part of BOINC.
3
// http://boinc.berkeley.edu
4
// Copyright (C) 2008 University of California
5
//
6
// BOINC is free software; you can redistribute it and/or modify it
7
// under the terms of the GNU Lesser General Public License
8
// as published by the Free Software Foundation,
9
// either version 3 of the License, or (at your option) any later version.
10
//
11
// BOINC is distributed in the hope that it will be useful,
12
// but WITHOUT ANY WARRANTY; without even the implied warranty of
13
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14
// See the GNU Lesser General Public License for more details.
15
//
16
// You should have received a copy of the GNU Lesser General Public License
17
// along with BOINC.  If not, see <http://www.gnu.org/licenses/>.
18
19
// change all WUs committed to a given HR class back to uncommitted
20
//
21
// TODO: document - when/why would you want to do this?
0 ignored issues
show
Coding Style Best Practice introduced by
Comments for TODO tasks are often forgotten in the code; it might be better to use a dedicated issue tracker.
Loading history...
22
// TODO: use new DB interface
0 ignored issues
show
Coding Style Best Practice introduced by
Comments for TODO tasks are often forgotten in the code; it might be better to use a dedicated issue tracker.
Loading history...
23
24
include_once( "../inc/db.inc" );
25
include_once( "../inc/util.inc" );
26
include_once( "../inc/db_ops.inc" );
27
include_once( "../inc/util_ops.inc" );
28
include_once( "../inc/prefs.inc" );
29
30
db_init();
31
32
if (get_int('hr_class')) {
33
    $hr_class = get_int('hr_class');
34
} else {
35
    $hr_class = 0;
36
}
37
38
$timestr = time_str(time(0));
0 ignored issues
show
The call to time() has too many arguments starting with 0. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

38
$timestr = time_str(/** @scrutinizer ignore-call */ time(0));

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.

Loading history...
39
$title = "hr_class ".$hr_class." reset at ".$timestr;
40
41
admin_page_head($title);
42
43
if ($hr_class != 0) {
44
    $result = _mysql_query("UPDATE workunit SET hr_class=0 WHERE hr_class=".$hr_class);
45
}
46
47
echo $title;
48
49
admin_page_tail();
50
51
?>
52