diff --git a/html/ops/errorwus.php b/html/ops/errorwus.php
index 10bdbee9cf..224b5d2c1e 100644
--- a/html/ops/errorwus.php
+++ b/html/ops/errorwus.php
@@ -21,7 +21,8 @@ require_once("../inc/cache.inc");
// User - configuarble variables
// seconds to cache this page
-$cache_sec = 300;
+// this page runs a scan of the two largest tables, so this shouldn't be done more often than necessary
+$cache_sec = 1800;
// Number that determines how many client errors are necessary for a WU to show up in this list.
// This number is added to min_quorum of the WU, so a value of 1 means that there must be more than
// (min_quorum + 1) errors for a WU to show up in this list.
@@ -30,9 +31,7 @@ $notification_level = 1;
start_cache($cache_sec);
admin_page_head("All-error Workunits");
-db_init();
-
-function print_wu($id,$name,$quorum,$errors) {
+function print_wu($id,$name,$quorum,$errors,$valerrors,$mask) {
echo "
\n";
echo "";
@@ -50,6 +49,13 @@ function print_wu($id,$name,$quorum,$errors) {
echo $quorum;
echo " | \n";
+ echo "";
+ if ($mask)
+ echo wu_error_mask_str($mask);
+ else
+ echo $mask;
+ echo " | \n";
+
echo "";
echo " | \n";
+ echo "";
+ echo "";
+ echo $valerrors;
+ echo " | \n";
echo "
\n";
}
-$dbresult = _mysql_query("
- SELECT workunitid, outcome, workunit.name, min_quorum
- FROM result, workunit
- WHERE workunit.id = workunitid AND server_state = 5
+$db = BoincDb::get();
+$dbresult = $db->do_query("
+ SELECT workunitid, outcome, workunit.name, min_quorum, error_mask
+ FROM result INNER JOIN workunit ON workunit.id = workunitid
+ WHERE server_state = 5
ORDER BY workunitid, outcome DESC
;");
echo "
\n";
-echo "WU ID | WU name | Quorum | Errors |
\n";
+echo "WU ID | WU name | Quorum | Error mask | Client Errors | Validate Errors |
\n";
$rescount = 0;
$previd = -1;
$prevname = "";
$prevquorum = 1;
-$errors = 0;
+$prevmask = 0;
+$valerrors = 0;
+$clerrors = 0;
-// The current version scans for client errors only.
-// In case you want to include validate errors, add "|| (outcome = 6)" to "(outcome = 3)"
-
-while ($res = _mysql_fetch_object($dbresult)) {
+while ($res = $dbresult->fetch_object()) {
$id = $res->workunitid;
if ($id != $previd) {
- if ($errors > $prevquorum + $notification_level) {
- print_wu($previd,$prevname,$prevquorum,$errors);
+ if (($clerrors > $prevquorum + $notification_level) ||
+ ($valerrors > $prevquorum + $notification_level)) {
+ print_wu($previd,$prevname,$prevquorum,$clerrors,$valerrors,$prevmask);
$rescount++;
}
+ $prevmask = $res->error_mask;
$previd = $id;
$prevname = $res->name;
$prevquorum = $res->min_quorum;
- $errors = 0;
+ $clerrors = 0;
+ $valerrors = 0;
}
if ($res->outcome == 3) {
- $errors ++;
+ $clerrors ++;
+ }
+ if ($res->outcome == 6) {
+ $valerrors ++;
}
if ($res->outcome == 1) {
- $errors = 0;
+ $clerrors = 0;
+ $valerrors = 0;
}
}
-_mysql_free_result($dbresult);
-if ($errors > $prevquorum) {
- print_wu($id,$prevname,$prevquorum,$errors);
+
+$dbresult->free();
+
+if (($clerrors > $prevquorum + $notification_level) ||
+ ($valerrors > $prevquorum + $notification_level)) {
+ print_wu($id,$prevname,$prevquorum,$clerrors,$valerrors,$prevmask);
$rescount++;
}
@@ -108,6 +130,11 @@ echo "
\n
";
echo $rescount;
echo " entries\n";
+echo "
";
+
+echo "Page last updated ";
+echo time_str(time());
+
admin_page_tail();
end_cache($cache_sec);