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 | // Show how many unsent results are committed to each HR class |
||||
20 | |||||
21 | // TODO: convert to use new DB interface |
||||
0 ignored issues
–
show
Coding Style
Best Practice
introduced
by
![]() |
|||||
22 | // TODO: document in the wiki |
||||
0 ignored issues
–
show
|
|||||
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 | $system_string[ 128 ] = "No OS"; |
||||
0 ignored issues
–
show
|
|||||
31 | $system_string[ 256 ] = "Linux"; |
||||
0 ignored issues
–
show
|
|||||
32 | $system_string[ 384 ] = "Windows"; |
||||
0 ignored issues
–
show
|
|||||
33 | $system_string[ 512 ] = "Darwin"; |
||||
0 ignored issues
–
show
|
|||||
34 | $system_string[ 640 ] = "FreeBSD"; |
||||
0 ignored issues
–
show
|
|||||
35 | |||||
36 | $cpu_string[ 0 ] = "Unspecified"; |
||||
0 ignored issues
–
show
|
|||||
37 | $cpu_string[ 1 ] = "No cpu"; |
||||
0 ignored issues
–
show
|
|||||
38 | $cpu_string[ 2 ] = "Intel"; |
||||
0 ignored issues
–
show
|
|||||
39 | $cpu_string[ 3 ] = "AMD"; |
||||
0 ignored issues
–
show
|
|||||
40 | $cpu_string[ 4 ] = "Macintosh"; |
||||
0 ignored issues
–
show
|
|||||
41 | $cpu_string[ 5 ] = "AMD Athlon"; |
||||
0 ignored issues
–
show
|
|||||
42 | $cpu_string[ 6 ] = "AMD Duron"; |
||||
0 ignored issues
–
show
|
|||||
43 | $cpu_string[ 7 ] = "AMD Sempron"; |
||||
0 ignored issues
–
show
|
|||||
44 | $cpu_string[ 8 ] = "AMD Opteron"; |
||||
0 ignored issues
–
show
|
|||||
45 | $cpu_string[ 9 ] = "AMD Athlon 64"; |
||||
0 ignored issues
–
show
|
|||||
46 | $cpu_string[ 10 ] = "AMD Athlon XP"; |
||||
0 ignored issues
–
show
|
|||||
47 | $cpu_string[ 11 ] = "Intel Xeon"; |
||||
0 ignored issues
–
show
|
|||||
48 | $cpu_string[ 12 ] = "Intel Celeron"; |
||||
0 ignored issues
–
show
|
|||||
49 | $cpu_string[ 13 ] = "Intel Pentium"; |
||||
0 ignored issues
–
show
|
|||||
50 | $cpu_string[ 14 ] = "Intel Pentium II"; |
||||
0 ignored issues
–
show
|
|||||
51 | $cpu_string[ 15 ] = "Intel Pentium III"; |
||||
0 ignored issues
–
show
|
|||||
52 | $cpu_string[ 16 ] = "Intel Pentium 4"; |
||||
0 ignored issues
–
show
|
|||||
53 | $cpu_string[ 17 ] = "Intel Pentium D"; |
||||
0 ignored issues
–
show
|
|||||
54 | $cpu_string[ 18 ] = "Intel Pentium M"; |
||||
0 ignored issues
–
show
|
|||||
55 | $cpu_string[ 19 ] = "AMD Athlon MP"; |
||||
0 ignored issues
–
show
|
|||||
56 | $cpu_string[ 20 ] = "AMD Turion"; |
||||
0 ignored issues
–
show
|
|||||
57 | $cpu_string[ 21 ] = "Intel Core2"; |
||||
0 ignored issues
–
show
|
|||||
58 | |||||
59 | $query = "SELECT COUNT(workunit.id) AS count FROM workunit LEFT JOIN result ON workunit.id=result.workunitid WHERE result.server_state=2 AND workunit.hr_class="; |
||||
60 | |||||
61 | function get_mysql_count($hr_class) { |
||||
62 | $result = _mysql_query("select count(id) as count from workunit where hr_class=" . $hr_class); |
||||
63 | $count = _mysql_fetch_object($result); |
||||
64 | _mysql_free_result($result); |
||||
65 | return $count->count; |
||||
66 | } |
||||
67 | |||||
68 | function make_reset_url($hr_class) { |
||||
69 | return ("<a href=ops_reset_hrclass.php?hr_class=".$hr_class.">".$hr_class."</a>"); |
||||
70 | } |
||||
71 | |||||
72 | db_init(); |
||||
73 | |||||
74 | $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
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. ![]() |
|||||
75 | $title = "hr_class summary list at ".$timestr; |
||||
76 | |||||
77 | admin_page_head($title); |
||||
78 | |||||
79 | start_table(); |
||||
80 | |||||
81 | table_header( |
||||
82 | "hr_class", "System", "CPU", "# unsent results" |
||||
83 | ); |
||||
84 | |||||
85 | $unsentresults = get_mysql_count( 0 ); |
||||
86 | table_row( |
||||
87 | make_reset_url(0), $system_string[ 128 ], $cpu_string[ 0 ], $unsentresults ); |
||||
0 ignored issues
–
show
|
|||||
88 | |||||
89 | for ($system = 2; $system < 6; ++$system ) { |
||||
0 ignored issues
–
show
|
|||||
90 | for ($cpu = 1; $cpu < 22; ++$cpu ) { |
||||
0 ignored issues
–
show
|
|||||
91 | $hr_class=128*$system+$cpu; |
||||
92 | |||||
93 | $unsentresults = get_mysql_count( $hr_class ); |
||||
94 | |||||
95 | table_row( |
||||
96 | make_reset_url($hr_class), |
||||
97 | $system_string[$system * 128], |
||||
98 | $cpu_string[$cpu], |
||||
99 | $unsentresults |
||||
100 | ); |
||||
101 | } |
||||
102 | } |
||||
103 | |||||
104 | end_table(); |
||||
105 | |||||
106 | admin_page_tail(); |
||||
107 | |||||
108 | ?> |
||||
109 |