diff --git a/admin/judges_sa.php b/admin/judges_sa.php index 4735a6d..d936448 100644 --- a/admin/judges_sa.php +++ b/admin/judges_sa.php @@ -28,7 +28,12 @@ require_once('../projects.inc.php'); require_once('judges.inc.php'); require_once('anneal.inc.php'); - +// INFO ONLY: Re Windows OS. I have not found a test that works for both methods of starting this +// SERVER_ADDR is Always null in Windows OS IIS server +// when I launch using judges_sa_launcher_apache.php I could test using SERVER_NAME +// However when I Launch using $WshShell->run($bat_filename,0,false ); for Windows IIS it seems: +// All the $_SERVER variables are set as if were a website page so any variable I have tried will cause a bailout +// THUS.. There is no test I have found to verify this was run from the command line (or in background) for Windows if($_SERVER['SERVER_ADDR']) { echo "This script must be run from the command line"; exit; diff --git a/admin/judges_sa_launcher.php b/admin/judges_sa_launcher.php index 2d20d53..8858405 100644 --- a/admin/judges_sa_launcher.php +++ b/admin/judges_sa_launcher.php @@ -1,10 +1,54 @@ $logPath/judge_scheduler_".date("YmdHis").".log 2>&1 &"."\n"); + fwrite($bat_file, "EXIT"."\n"); + fclose($bat_file); + } + $WshShell = new COM("WScript.Shell"); + // next line designed for Windows os with IIS web server. It will probably fail if Windows using apache web server + try { + $oExec = $WshShell->run($bat_filename,0,false ); // THIS SHOULD WORK for windows using IIS as webserver. + } + catch (Exception $e) { + // if the wshshell-> run fails then we are perhaps running an apache server and the next might work. + // But, the call in judges_sa_launcher_apache.php does not return until completed so I use this logic + // to inform the user how to get to the status page. + // CAUTION: This path REQUIRES that php be compiled with CLI option and other things Dennis does not understand! + // This may work for some servers. NEVER use this on a shared server - you will hog it and get your account suspended. + echo " This server requires manual intervention to start the scheduler and to navigate to the Status page.
"; + echo " The scheduler will run at normal priority - which in some servers may present a sluggish response.
"; + echo " Please follow these instruction exactly:
"; + echo " 1. Click 'Start the Scheduler' link ONCE. (You will not see any change in this screen)
"; + echo " *** DO NOT Click 'Start the Scheduler' more than once!
"; + echo " 2. Click 'Check the Status' link and wait. (You will be taken to the Status Page. There, you should see that the scheduler is running.)
"; + echo "
Start the Scheduler

"; + echo "Check the Status
"; + exit; + // This is the call that works - but it does not return until judges_sa is finished so... I launch it from another window + // exec("php judges_sa.php >$logPath/judge_scheduler_".date("YmdHis").".log 2>&1 &"); + } +} +else{ + // *nix server //add PHP_SELF just so when we do a process listing on the server we know which fair its running for //the argument does not get used by the script at all exec("nice php judges_sa.php {$_SERVER['PHP_SELF']} > $logPath/judge_scheduler_".date("YmdHis").".log 2>&1 &"); +} usleep(1500000); // 1.5 second to allow the judges_sa to update the % status to 0% otherwise the status page will think its not running if it gets there too soon header("Location: judges_scheduler_status.php"); exit; diff --git a/admin/judges_sa_launcher_apache.php b/admin/judges_sa_launcher_apache.php new file mode 100644 index 0000000..69f6d22 --- /dev/null +++ b/admin/judges_sa_launcher_apache.php @@ -0,0 +1,8 @@ +$logPath/judge_scheduler_".date("YmdHis").".log 2>&1 &"); +exit; +?> + diff --git a/admin/judges_scheduler_status.php b/admin/judges_scheduler_status.php index f6a8016..6b5760a 100644 --- a/admin/judges_scheduler_status.php +++ b/admin/judges_scheduler_status.php @@ -151,6 +151,7 @@ echo "
"; echo "".i18n("Print/Export Reports").""; echo "
"; echo "
"; +echo "Note: If you are using Windows Internet Explorer and do not see status updates do this:
Click menu bar 'Tools' then 'Internet Options'.
In the 'General' Tab under 'Browsing history' click 'Settings'.
Under 'Check for newer versions of stored pages:'
Select the option 'Every time I visit the webpage'.
Click OK then OK"; } send_footer(); diff --git a/common.inc.functions.php b/common.inc.functions.php index 41f707f..17d5dc9 100644 --- a/common.inc.functions.php +++ b/common.inc.functions.php @@ -888,6 +888,10 @@ function get_conference_info($conferenceId){ //make sure logs folder exists, and htaccess it to deny access, and return the full path function get_logpath(){ $q = mysql_fetch_assoc(mysql_query("SELECT val FROM config WHERE var = 'SFIABDIRECTORY'")); + if( empty($_SERVER['DOCUMENT_ROOT']) ) // Not set in Windows OS with IIS server. + { + $_SERVER['DOCUMENT_ROOT'] = dirname(__FILE__); + } $directory = $_SERVER["DOCUMENT_ROOT"] . $q['val'] . '/data/logs'; if(!file_exists($directory)) diff --git a/common.inc.php b/common.inc.php index 636e5b4..db7cc22 100644 --- a/common.inc.php +++ b/common.inc.php @@ -452,8 +452,13 @@ global $config; //we only show the debug session variables if we have an ODD numbered version. if(substr($config['version'], -1) % 2 != 0) { - // Dennis 2011-02-18 Just Info Next line does not work in Windows (no grep etc.) - $revision=exec("svn info |grep Revision"); + $pos = strpos(getcwd(),'/'); + if($pos === false){ // Windows OS + $revision = "na"; + } + else{ + $revision=exec("svn info |grep Revision"); + } $extra=" (Development $revision)"; if($_SESSION['debug']=="true") $extradebug="
DEBUG SESSION: ".print_r($_SESSION,true);