Skip to content

Instantly share code, notes, and snippets.

@carlcrott
Created November 8, 2012 00:33
Show Gist options
  • Save carlcrott/4035642 to your computer and use it in GitHub Desktop.
Save carlcrott/4035642 to your computer and use it in GitHub Desktop.
$status=file($folder . DIRECTORY_SEPARATOR . "STATUS");
if ($status === FALSE) {
$status = array();
}
// check the global status
switch(checkStatus("CONFIG")) {
case 0:
$nextenabled="disabled=\"disabled\"";
header( "refresh:5" );
break;
case 1:
$nextenabled="disabled=\"disabled\"";
chdir($folder);
//if ($workflow['custom_config'] == "yes") {
if true {
header( "Location: sugarcane/index.php?workflowid=$workflowid&offline=offline");
} else {
pclose(popen('R_LIBS_USER="' . ${pecan_install} . '" R CMD BATCH workflow_stage2.R &', 'r'));
if ($offline) {
header( "Location: running_stage2.php?workflowid=$workflowid&offline=offline");
} else {
header( "Location: running_stage2.php?workflowid=$workflowid");
}
}
break;
case 2:
$nextenabled="";
if ($offline) {
header( "Location: finished.php?workflowid=$workflowid&offline=offline");
} else {
header( "Location: finished.php?workflowid=$workflowid");
}
mysql_query("UPDATE workflows SET finished_at=NOW() WHERE id=${workflowid} AND finished_at IS NULL");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment