fixed asyncservices to run under the windows sheduler

This commit is contained in:
Ralf Becker 2004-07-31 19:37:58 +00:00
parent fe44aa6f00
commit 74fd47804a
4 changed files with 60 additions and 13 deletions

View File

@ -145,7 +145,7 @@
if ($async->only_fallback)
{
echo '<p>'.lang('Under windows you can only use the fallback mode at the moment. Fallback means the jobs get only checked after each page-view !!!')."</p>\n";
echo '<p>'.lang('Under windows you need to install the asyncservice %1manually%2 or use the fallback mode. Fallback means the jobs get only checked after each page-view !!!','<a href="http://www.egroupware.org/wiki/TimedAsyncServicesWindows" target="_blank">','</a>')."</p>\n";
}
else
{

View File

@ -347,7 +347,7 @@ top admin de oben
total records admin de Anzahl Datensätze insgesamt
trust level admin de Grad des Vertrauens
trust relationship admin de Vertrauensverhältnis
under windows you can only use the fallback mode at the moment. fallback means the jobs get only checked after each page-view !!! admin de Unter Windows steht im Moment nur die Ausweichmöglichkeit zur Verfügung. Bei der Ausweichmöglichkeit werden die Jobs nur nach jedem Seitenaufbau überprüft!!!
under windows you need to install the asyncservice %1manually%2 or use the fallback mode. fallback means the jobs get only checked after each page-view !!! admin de Unter Windows muß der asynchrone Service %1von Hand%2 installiert werden oder es wird nur die Ausweichmöglichkeit benutzt. Bei der Ausweichmöglichkeit werden die Jobs nur nach jedem Seitenaufbau überprüft!!!
use cookies to pass sessionid admin de SitzungsId in einem Cookie speichern
use pure html compliant code (not fully working yet) admin de Vollständig HTML kompatiblen Code verwenden (nicht vollständig implementiert)
use theme admin de Benutztes Farbschema

View File

@ -341,7 +341,7 @@ top admin en top
total records admin en Total records
trust level admin en Trust Level
trust relationship admin en Trust Relationship
under windows you can only use the fallback mode at the moment. fallback means the jobs get only checked after each page-view !!! admin en Under windows you can only use the fallback mode at the moment. Fallback means the jobs get only checked after each page-view !!!
under windows you need to install the asyncservice %1manually%2 or use the fallback mode. fallback means the jobs get only checked after each page-view !!! admin en Under windows you need to install the asyncservice %1manually%2 or use the fallback mode. Fallback means the jobs get only checked after each page-view !!!
use cookies to pass sessionid admin en Use cookies to pass sessionid
use pure html compliant code (not fully working yet) admin en Use pure HTML compliant code (not fully working yet)
use theme admin en Use theme

View File

@ -23,8 +23,19 @@
/* $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';
$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(
'currentapp' => 'login',
@ -32,7 +43,13 @@
);
if (!is_readable($path_to_egroupware.'/header.inc.php'))
{
echo "asyncservice.php: Could not find '$path_to_egroupware/header.inc.php', exiting !!!\n";
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);
}
include($path_to_egroupware.'/header.inc.php');
@ -41,12 +58,34 @@
$db_type = $GLOBALS['phpgw_domain'][$_GET['domain']]['db_type'];
if (!isset($GLOBALS['phpgw_domain'][$_GET['domain']]) || empty($db_type))
{
echo "asyncservice.php: Domain '$_GET[domain]' is not configured or renamed, exiting !!!\n";
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);
}
if (!extension_loaded($db_type) && !dl($db_type.'.so'))
// some constanst for pre php4.3
if (!defined('PHP_SHLIB_SUFFIX'))
{
echo "asyncservice.php: Extension '$db_type' is not loaded and can't be loaded via dl('$db_type.so') !!!\n";
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
@ -54,7 +93,15 @@
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";
$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();