|
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
|
|
|
// ?? what's this script for? |
|
20
|
|
|
|
|
21
|
|
|
$cli_only = true; |
|
22
|
|
|
require_once("../inc/db.inc"); |
|
23
|
|
|
require_once("../inc/util_ops.inc"); |
|
24
|
|
|
|
|
25
|
|
|
db_init(); |
|
26
|
|
|
|
|
27
|
|
|
function parse_num($xml, $tag) { |
|
28
|
|
|
$x = parse_element($xml, $tag); |
|
29
|
|
|
if (!$x) return 0; |
|
30
|
|
|
return $x; |
|
31
|
|
|
} |
|
32
|
|
|
|
|
33
|
|
|
function parse_boolint($xml, $tag) { |
|
34
|
|
|
$x = parse_bool($xml, $tag); |
|
35
|
|
|
if ($x) return 1; |
|
36
|
|
|
return 0; |
|
37
|
|
|
} |
|
38
|
|
|
|
|
39
|
|
|
function make_user($user) { |
|
40
|
|
|
$prefs = $user->global_prefs; |
|
41
|
|
|
|
|
42
|
|
|
$run_on_batteries = parse_boolint($prefs, "run_on_batteries"); |
|
43
|
|
|
$run_if_user_active = parse_boolint($prefs, "run_if_user_active"); |
|
44
|
|
|
$start_hour = parse_num($prefs, "<start_hour>"); |
|
45
|
|
|
$end_hour = parse_num($prefs, "<end_hour>"); |
|
46
|
|
|
$net_start_hour = parse_num($prefs, "<net_start_hour>"); |
|
47
|
|
|
$net_end_hour = parse_num($prefs, "<net_end_hour>"); |
|
48
|
|
|
$leave_apps_in_memory = parse_boolint($prefs, "leave_apps_in_memory"); |
|
49
|
|
|
$confirm_before_connecting = parse_boolint($prefs, "confirm_before_connecting"); |
|
50
|
|
|
$hangup_if_dialed = parse_boolint($prefs, "hangup_if_dialed"); |
|
51
|
|
|
$work_buf_min_days = parse_num($prefs, "<work_buf_min_days>"); |
|
52
|
|
|
$max_cpus = parse_num($prefs, "<max_cpus>"); |
|
53
|
|
|
$cpu_scheduling_period_minutes = parse_num($prefs, "<cpu_scheduling_period_minutes>"); |
|
54
|
|
|
$disk_interval = parse_num($prefs, "<disk_interval>"); |
|
55
|
|
|
$disk_max_used_gb = parse_num($prefs, "<disk_max_used_gb>"); |
|
56
|
|
|
$disk_max_used_pct = parse_num($prefs, "<disk_max_used_pct>"); |
|
57
|
|
|
$disk_min_free_gb = parse_num($prefs, "<disk_min_free_gb>"); |
|
58
|
|
|
$vm_max_used_pct = parse_num($prefs, "<vm_max_used_pct>"); |
|
59
|
|
|
$idle_time_to_run = parse_num($prefs, "<idle_time_to_run>"); |
|
60
|
|
|
$max_bytes_sec_up = parse_num($prefs, "<max_bytes_sec_up>"); |
|
61
|
|
|
$max_bytes_sec_down = parse_num($prefs, "<max_bytes_sec_down>"); |
|
62
|
|
|
$query = "insert into puser values |
|
63
|
|
|
($user->id, |
|
64
|
|
|
$user->create_time, |
|
65
|
|
|
'$user->email_addr', |
|
66
|
|
|
'$user->country', |
|
67
|
|
|
$user->total_credit, |
|
68
|
|
|
'$user->venue', |
|
69
|
|
|
$run_on_batteries, |
|
70
|
|
|
$run_if_user_active, |
|
71
|
|
|
$start_hour, |
|
72
|
|
|
$end_hour, |
|
73
|
|
|
$net_start_hour, |
|
74
|
|
|
$net_end_hour, |
|
75
|
|
|
$leave_apps_in_memory, |
|
76
|
|
|
$confirm_before_connecting, |
|
77
|
|
|
$hangup_if_dialed, |
|
78
|
|
|
$work_buf_min_days, |
|
79
|
|
|
$max_cpus, |
|
80
|
|
|
$cpu_scheduling_period_minutes, |
|
81
|
|
|
$disk_interval, |
|
82
|
|
|
$disk_max_used_gb, |
|
83
|
|
|
$disk_max_used_pct, |
|
84
|
|
|
$disk_min_free_gb, |
|
85
|
|
|
$vm_max_used_pct, |
|
86
|
|
|
$idle_time_to_run, |
|
87
|
|
|
$max_bytes_sec_up, |
|
88
|
|
|
$max_bytes_sec_down) |
|
89
|
|
|
"; |
|
90
|
|
|
$retval = _mysql_query($query); |
|
91
|
|
|
if (!$retval) { |
|
92
|
|
|
echo _mysql_error(); |
|
93
|
|
|
} |
|
94
|
|
|
} |
|
95
|
|
|
|
|
96
|
|
|
set_time_limit(0); |
|
97
|
|
|
|
|
98
|
|
|
$result = _mysql_query("select * from user where total_credit > 0"); |
|
99
|
|
|
while ($user = _mysql_fetch_object($result)) { |
|
100
|
|
|
make_user($user); |
|
|
|
|
|
|
101
|
|
|
} |
|
102
|
|
|
|
|
103
|
|
|
?> |
|
104
|
|
|
|
This check compares calls to functions or methods with their respective definitions. If the call has less 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.