From: <ral...@us...> - 2004-07-31 19:33:55
|
Update of /cvsroot/egroupware/phpgwapi/cron In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11060 Modified Files: Tag: Version-1_0_0-branch asyncservices.php Log Message: fixed asyncservices to run under the windows sheduler Index: asyncservices.php =================================================================== RCS file: /cvsroot/egroupware/phpgwapi/cron/asyncservices.php,v retrieving revision 1.7 retrieving revision 1.7.4.1 diff -C2 -d -r1.7 -r1.7.4.1 *** asyncservices.php 23 May 2004 19:16:15 -0000 1.7 --- asyncservices.php 31 Jul 2004 19:33:43 -0000 1.7.4.1 *************** *** 24,29 **** /* $Id$ */ - $path_to_egroupware = realpath(dirname(__FILE__).'/../..'); // need to be adapted if this script is moved somewhere else $_GET['domain'] = isset($_SERVER['argv'][1]) ? $_SERVER['argv'][1] : 'default'; $GLOBALS['phpgw_info']['flags'] = array( --- 24,40 ---- /* $Id$ */ $_GET['domain'] = isset($_SERVER['argv'][1]) ? $_SERVER['argv'][1] : 'default'; + $path_to_egroupware = realpath(dirname(__FILE__).'/../..'); // need to be adapted if this script is moved somewhere else + + // remove the comment from one of the following lines to enable loging + // define('ASYNC_LOG','C:\\async.log'); // Windows + // define('ASYNC_LOG','/tmp/async.log'); // Linux, Unix, ... + if (defined('ASYNC_LOG')) + { + $msg = date('Y/m/d H:i:s ').$_GET['domain'].": asyncservice started\n"; + $f = fopen(ASYNC_LOG,'a+'); + fwrite($f,$msg); + fclose($f); + } $GLOBALS['phpgw_info']['flags'] = array( *************** *** 33,37 **** if (!is_readable($path_to_egroupware.'/header.inc.php')) { ! echo "asyncservice.php: Could not find '$path_to_egroupware/header.inc.php', exiting !!!\n"; exit(1); } --- 44,54 ---- if (!is_readable($path_to_egroupware.'/header.inc.php')) { ! echo $msg = "asyncservice.php: Could not find '$path_to_egroupware/header.inc.php', exiting !!!\n"; ! if (defined('ASYNC_LOG')) ! { ! $f = fopen(ASYNC_LOG,'a+'); ! fwrite($f,$msg); ! fclose($f); ! } exit(1); } *************** *** 42,60 **** if (!isset($GLOBALS['phpgw_domain'][$_GET['domain']]) || empty($db_type)) { ! echo "asyncservice.php: Domain '$_GET[domain]' is not configured or renamed, exiting !!!\n"; exit(1); } ! if (!extension_loaded($db_type) && !dl($db_type.'.so')) { ! echo "asyncservice.php: Extension '$db_type' is not loaded and can't be loaded via dl('$db_type.so') !!!\n"; } ! $GLOBALS['phpgw_info']['server']['sessions_type'] = 'db'; // no php4-sessions availible for cgi include(PHPGW_API_INC.'/functions.inc.php'); ! $num = ExecMethod('phpgwapi.asyncservice.check_run','crontab'); - // if the following comment got removed, you will get an email from cron for every check performed - //echo date('Y/m/d H:i:s ').$_GET['domain'].': '.($num ? "$num job(s) executed" : 'Nothing to execute')."\n"; $GLOBALS['phpgw']->common->phpgw_exit(); --- 59,107 ---- if (!isset($GLOBALS['phpgw_domain'][$_GET['domain']]) || empty($db_type)) { ! echo $msg = "asyncservice.php: Domain '$_GET[domain]' is not configured or renamed, exiting !!!\n"; ! if (defined('ASYNC_LOG')) ! { ! $f = fopen(ASYNC_LOG,'a+'); ! fwrite($f,$msg); ! fclose($f); ! } exit(1); } ! // some constanst for pre php4.3 ! if (!defined('PHP_SHLIB_SUFFIX')) { ! define('PHP_SHLIB_SUFFIX',strtoupper(substr(PHP_OS, 0,3)) == 'WIN' ? 'dll' : 'so'); } ! if (!defined('PHP_SHLIB_PREFIX')) ! { ! define('PHP_SHLIB_PREFIX',PHP_SHLIB_SUFFIX == 'dll' ? 'php_' : ''); ! } ! $db_extension = PHP_SHLIB_PREFIX.$db_type.'.'.PHP_SHLIB_SUFFIX; ! if (!extension_loaded($db_type) && !dl($db_extension)) ! { ! echo $msg = "asyncservice.php: Extension '$db_type' is not loaded and can't be loaded via dl('$db_extension') !!!\n"; ! if (defined('ASYNC_LOG')) ! { ! $f = fopen(ASYNC_LOG,'a+'); ! fwrite($f,$msg); ! fclose($f); ! } ! } ! $GLOBALS['phpgw_info']['server']['sessions_type'] = 'db'; // no php4-sessions availible for cgi include(PHPGW_API_INC.'/functions.inc.php'); ! $num = ExecMethod('phpgwapi.asyncservice.check_run','crontab'); + $msg = date('Y/m/d H:i:s ').$_GET['domain'].': '.($num ? "$num job(s) executed" : 'Nothing to execute')."\n\n"; + // if the following comment got removed, you will get an email from cron for every check performed (*nix only) + //echo $msg; + + if (defined('ASYNC_LOG')) + { + $f = fopen(ASYNC_LOG,'a+'); + fwrite($f,$msg); + fclose($f); + } $GLOBALS['phpgw']->common->phpgw_exit(); |