1
|
|
|
<?php |
2
|
|
|
// This file is part of BOINC. |
3
|
|
|
// http://boinc.berkeley.edu |
4
|
|
|
// Copyright (C) 2012 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
|
|
|
// Re-validate jobs. |
20
|
|
|
// Use this if you changed your validator to a more permissive policy, |
21
|
|
|
// and you want to rerun it on some jobs |
22
|
|
|
// (e.g. to grant credit to instances previously marked as invalid) |
23
|
|
|
|
24
|
|
|
ini_set ("memory_limit", "2G"); |
25
|
|
|
|
26
|
|
|
require_once("../inc/util_ops.inc"); |
27
|
|
|
|
28
|
|
|
function show_form() { |
29
|
|
|
admin_page_head("Revalidate jobs"); |
30
|
|
|
echo " |
31
|
|
|
This form lets you re-validate jobs. |
32
|
|
|
Use this if you changed your validator to a more permissive policy, |
33
|
|
|
and you want to rerun it on some jobs |
34
|
|
|
(e.g. to grant credit to instances previously marked as invalid). |
35
|
|
|
<p> |
36
|
|
|
<form method=get action=revalidate.php> |
37
|
|
|
<p> |
38
|
|
|
Enter a SQL 'where' clause indicating which workunits |
39
|
|
|
you want to revalidate |
40
|
|
|
(e.g., <b>id >= 1000 and id < 2000</b>). |
41
|
|
|
<p> |
42
|
|
|
where <input name=clause size=60> |
43
|
|
|
<p> |
44
|
|
|
<input class=\"btn btn-default\" type=submit value=OK> |
45
|
|
|
</form> |
46
|
|
|
"; |
47
|
|
|
admin_page_tail(); |
48
|
|
|
} |
49
|
|
|
|
50
|
|
|
function revalidate($clause) { |
51
|
|
|
$nwus = 0; |
52
|
|
|
$nresults = 0; |
53
|
|
|
|
54
|
|
|
$wus = BoincWorkunit::enum($clause); |
55
|
|
|
foreach($wus as $wu) { |
56
|
|
|
$results = BoincResult::enum("workunitid=$wu->id"); |
57
|
|
|
$n = 0; |
58
|
|
|
foreach ($results as $result) { |
59
|
|
|
if ($result->server_state != 5) continue; |
60
|
|
|
if ($result->outcome != 1) continue; |
61
|
|
|
if ($result->validate_state < 1) continue; |
62
|
|
|
$result->update("validate_state=0"); |
63
|
|
|
echo "<br>updated result $result->id\n"; |
64
|
|
|
$n++; |
65
|
|
|
$nresults++; |
66
|
|
|
} |
67
|
|
|
if ($n) { |
68
|
|
|
$wu->update("need_validate=1"); |
69
|
|
|
echo "<br>updated wu $wu->id\n"; |
70
|
|
|
$nwus++; |
71
|
|
|
} |
72
|
|
|
} |
73
|
|
|
echo "Examined ".count($wus)." jobs.\n"; |
74
|
|
|
echo "$nwus jobs and $nresults instances were marked for revalidation"; |
75
|
|
|
} |
76
|
|
|
|
77
|
|
|
$clause = get_str("clause", true); |
78
|
|
|
if ($clause) { |
79
|
|
|
admin_page_head("Jobs marked for revalidation"); |
80
|
|
|
revalidate($clause); |
81
|
|
|
admin_page_tail(); |
82
|
|
|
} else { |
83
|
|
|
show_form(); |
|
|
|
|
84
|
|
|
} |
85
|
|
|
|
86
|
|
|
?> |
87
|
|
|
|
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.