2004-11-14 00:42:02 +00:00
|
|
|
<?php
|
2005-02-08 04:38:31 +00:00
|
|
|
$cvs_version_tracker[]="\$Id$"; //Generated automatically - do not edit
|
2004-11-14 00:42:02 +00:00
|
|
|
|
|
|
|
// cancel a WU:
|
|
|
|
// - mark unsent results as OVER, outcome DIDNT_NEED
|
|
|
|
// - set CANCELLED bit in WU error mask
|
|
|
|
//
|
|
|
|
|
|
|
|
function test_mysql_query($msg) {
|
2004-11-14 17:49:16 +00:00
|
|
|
echo "mysql_query($msg)<br/>";
|
2004-11-14 00:42:02 +00:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2004-11-14 17:49:16 +00:00
|
|
|
// for purposes of testing and seeing queries,
|
|
|
|
// replace the two instances of mysql_query() below with test_mysql_query().
|
|
|
|
//
|
2004-11-14 00:42:02 +00:00
|
|
|
function cancel_wu($wuid1, $wuid2) {
|
|
|
|
$command1="update result set server_state=5, outcome=5 where server_state=2 and $wuid1<=workunitid and workunitid<=$wuid2";
|
|
|
|
$command2="update workunit set error_mask=error_mask|16 where $wuid1<=id and id<=$wuid2";
|
|
|
|
|
|
|
|
if (!mysql_query($command1)) {
|
2004-11-14 17:49:16 +00:00
|
|
|
echo "MySQL command $command1 failed:<br/>unable to cancel unsent results.<br/>";
|
|
|
|
return 1;
|
2004-11-14 00:42:02 +00:00
|
|
|
} else if (!mysql_query($command2)) {
|
2004-11-14 17:49:16 +00:00
|
|
|
echo "MySQL command $command2 failed:<br/>unable to cancel workunits.<br/>";
|
|
|
|
return 2;
|
2004-11-14 00:42:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
require_once("../inc/db.inc");
|
2005-02-08 04:38:31 +00:00
|
|
|
require_once("../inc/util_ops.inc");
|
2004-11-14 00:42:02 +00:00
|
|
|
|
|
|
|
// REMOVE THE FOLLOWING ONLY AFTER PASSWORD-PROTECTING html/ops
|
|
|
|
//
|
|
|
|
if (1) {
|
|
|
|
echo "
|
|
|
|
WARNING! Make sure the html/ops directory is password-protected,
|
|
|
|
then edit html/ops/cancel_wu_action.php by hand to remove this message.
|
|
|
|
";
|
|
|
|
exit();
|
|
|
|
}
|
|
|
|
|
2005-02-08 04:38:31 +00:00
|
|
|
admin_page_head("Cancel WU");
|
2004-11-14 00:42:02 +00:00
|
|
|
|
|
|
|
db_init();
|
|
|
|
|
|
|
|
$wuid1 = $_GET['wuid1'];
|
|
|
|
$wuid2 = $_GET['wuid2'];
|
|
|
|
|
|
|
|
if ($wuid1<1 || $wuid2<$wuid1) {
|
2004-11-14 17:49:16 +00:00
|
|
|
echo "<h2>Workunit IDs fail to satisfy the conditions:<br/>
|
|
|
|
1 <= WU1 ($wuid1) <= WU2 ($wuid2)<br/>
|
|
|
|
Unable to process request to cancel workunits.
|
|
|
|
</h2>
|
|
|
|
";
|
|
|
|
exit();
|
2004-11-14 00:42:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
echo "CANCELLING workunits $wuid1 to $wuid2 inclusive....<br/>";
|
|
|
|
|
2004-11-14 17:49:16 +00:00
|
|
|
if (cancel_wu($wuid1, $wuid2)) {
|
|
|
|
echo "<h2>Failed in";
|
|
|
|
} else {
|
|
|
|
echo "<h2>Success in";
|
|
|
|
}
|
|
|
|
echo " cancelling workunits $wuid1 <= WUID <= $wuid2</h2>";
|
2004-11-14 00:42:02 +00:00
|
|
|
|
2005-02-08 04:38:31 +00:00
|
|
|
admin_page_tail();
|
2004-11-14 00:42:02 +00:00
|
|
|
?>
|