. // web interface for canceling WUs according to a SQL where clause // TODO: use get_int() etc. require_once("../inc/util_ops.inc"); admin_page_head("Cancel Jobs"); $limit = 100; if (array_key_exists('limit',$_REQUEST)) { $nlimit=$_REQUEST['limit']; if ($nlimit != 0) { $limit = $nlimit; } } $clause = ""; if (array_key_exists('minid',$_REQUEST) && $_REQUEST['minid'] != "" && array_key_exists('maxid',$_REQUEST) && $_REQUEST['maxid'] != "") $clause = "id >=" . $_REQUEST['minid'] . " AND id <=" . $_REQUEST['maxid']; else if (array_key_exists('list',$_REQUEST) && $_REQUEST['list'] != "") $clause = "id IN (" . $_REQUEST['list'] . ")"; else if (array_key_exists('uclause',$_REQUEST) && $_REQUEST['uclause'] != "") $clause = urldecode($_REQUEST['uclause']); else if (array_key_exists('clause',$_REQUEST) && $_REQUEST['clause'] != "") // the following line is BS, but apparently I can't find another way to pass a // double quote (") to the query $clause = str_replace('\"', '"', $_REQUEST['clause']); if ($clause == "") { // copied from old cancel_wu_form.php echo "

This form may be used to cancel unnecessary or unwanted jobs. We recommend that you stop the project before doing this. Note that the jobs and their corresponding results (if any) are NOT removed from the database. Instead, they are marked as 'no longer needed'. In most cases you should probably only remove jobs whose results are all unsent, since otherwise a user will not get credit for a result that they might return.

Please specify jobs by ID range, ID list or clause to be used in a 'SELECT FROM workunit WHERE' query.

You will be given a list of jobs matching your specification for confirmation before these are actually canceled.

"; $page = $_SERVER["REQUEST_URI"]; echo "
\n"; echo "\n"; echo "

\n"; echo ' Limit '; echo ""; echo "

\n"; echo "

\n"; echo ''; echo "

\n"; } else { // if ($clause) db_init(true); // try to get list of WUs from replica $query = "SELECT id, name FROM workunit WHERE canonical_resultid = 0 AND error_mask = 0 AND $clause;"; $dbresult = _mysql_query($query); if (!$dbresult) { echo "Error in query '$query'
\n"; } else { echo "\n"; echo ""; echo "
\n"; echo "\n"; $rescount = 0; while ($res = _mysql_fetch_object($dbresult)) { if ($rescount < $limit) { $id = $res->id; echo "\n"; echo "\n"; echo "\n"; echo "\n"; } $rescount++; } // while (_mysql_fetch_object()) _mysql_free_result($dbresult); echo "
WU IDWU name
"; echo "\n"; echo ""; echo $id; echo ""; echo ""; echo $res->name; echo "
\n

"; echo $rescount; echo " WUs match the query ($query)\n

"; echo "

"; echo ""; echo ""; $eclause = urlencode($clause); echo ""; echo ""; echo "

\n"; echo "
\n"; } // if (!$dbresult) } // if ($clause) admin_page_tail(); $cvs_version_tracker[]="\$Id$"; //Generated automatically - do not edit ?>