forked from extern/egroupware
bugfix: async service "sometimes" misses jobs (db-class was not cloned but copied)
This commit is contained in:
parent
ad513a1351
commit
e1d55562ff
@ -1,41 +1,31 @@
|
|||||||
<?php
|
<?php
|
||||||
/**************************************************************************\
|
/**
|
||||||
* eGroupWare API - Timed Asynchron Services for eGroupWare *
|
* API - Timed Asynchron Services for eGroupWare
|
||||||
* Written by Ralf Becker <RalfBecker@outdoor-training.de> *
|
*
|
||||||
* Class for creating cron-job like timed calls of eGroupWare methods *
|
* @link http://www.egroupware.org
|
||||||
* -------------------------------------------------------------------------*
|
* @author Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
||||||
* This library is part of the eGroupWare API *
|
* @copyright Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
||||||
* http://www.eGroupWare.org *
|
*
|
||||||
* ------------------------------------------------------------------------ *
|
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||||
* This program is free software; you can redistribute it and/or modify it *
|
* @package api
|
||||||
* under the terms of the GNU General Public License as published by the *
|
* @access public
|
||||||
* Free Software Foundation; either version 2 of the License, or (at your *
|
* @version $Id$
|
||||||
* option) any later version. *
|
*/
|
||||||
\**************************************************************************/
|
|
||||||
|
|
||||||
/* $Id$ */
|
/**
|
||||||
|
|
||||||
/**
|
|
||||||
* The class implements a general eGW service to execute callbacks at a given time.
|
* The class implements a general eGW service to execute callbacks at a given time.
|
||||||
*
|
*
|
||||||
* see http://www.egroupware.org/wiki/TimedAsyncServices
|
* see http://www.egroupware.org/wiki/TimedAsyncServices
|
||||||
*
|
|
||||||
* @author Ralf Becker
|
|
||||||
* @copyright GPL - GNU General Public License
|
|
||||||
*/
|
*/
|
||||||
class asyncservice
|
class asyncservice
|
||||||
{
|
{
|
||||||
var $public_functions = array(
|
|
||||||
'set_timer' => True,
|
|
||||||
'check_run' => True,
|
|
||||||
'cancel_timer' => True,
|
|
||||||
'read' => True,
|
|
||||||
'install' => True,
|
|
||||||
'installed' => True,
|
|
||||||
'last_check_run' => True
|
|
||||||
);
|
|
||||||
var $php = '';
|
var $php = '';
|
||||||
var $crontab = '';
|
var $crontab = '';
|
||||||
|
/**
|
||||||
|
* Our instance of the db-class
|
||||||
|
*
|
||||||
|
* @var egw_db
|
||||||
|
*/
|
||||||
var $db;
|
var $db;
|
||||||
var $db_table = 'egw_async';
|
var $db_table = 'egw_async';
|
||||||
var $debug = 0;
|
var $debug = 0;
|
||||||
@ -45,7 +35,14 @@
|
|||||||
*/
|
*/
|
||||||
function asyncservice()
|
function asyncservice()
|
||||||
{
|
{
|
||||||
$this->db = is_object($GLOBALS['egw']->db) ? $GLOBALS['egw']->db : $GLOBALS['phpgw_setup']->db;
|
if (is_object($GLOBALS['egw']->db))
|
||||||
|
{
|
||||||
|
$this->db = clone($GLOBALS['egw']->db);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->db = clone($GLOBALS['egw_setup']->db);
|
||||||
|
}
|
||||||
$this->db->set_app('phpgwapi');
|
$this->db->set_app('phpgwapi');
|
||||||
|
|
||||||
$this->cronline = EGW_SERVER_ROOT . '/phpgwapi/cron/asyncservices.php '.$GLOBALS['egw_info']['user']['domain'];
|
$this->cronline = EGW_SERVER_ROOT . '/phpgwapi/cron/asyncservices.php '.$GLOBALS['egw_info']['user']['domain'];
|
||||||
@ -402,7 +399,7 @@
|
|||||||
{
|
{
|
||||||
foreach($jobs as $id => $job)
|
foreach($jobs as $id => $job)
|
||||||
{
|
{
|
||||||
// checking / setting up phpgw_info/user
|
// checking / setting up egw_info/user
|
||||||
//
|
//
|
||||||
if ($GLOBALS['egw_info']['user']['account_id'] != $job['account_id'])
|
if ($GLOBALS['egw_info']['user']['account_id'] != $job['account_id'])
|
||||||
{
|
{
|
||||||
@ -430,7 +427,6 @@
|
|||||||
}
|
}
|
||||||
list($app) = explode('.',$job['method']);
|
list($app) = explode('.',$job['method']);
|
||||||
$GLOBALS['egw']->translation->add_app($app);
|
$GLOBALS['egw']->translation->add_app($app);
|
||||||
|
|
||||||
ExecMethod($job['method'],$job['data']);
|
ExecMethod($job['method'],$job['data']);
|
||||||
|
|
||||||
// re-read job, in case it had been updated or even deleted in the method
|
// re-read job, in case it had been updated or even deleted in the method
|
||||||
@ -591,16 +587,15 @@
|
|||||||
}
|
}
|
||||||
//echo "<p>$name = '".$this->$name."'</p>\n";
|
//echo "<p>$name = '".$this->$name."'</p>\n";
|
||||||
}
|
}
|
||||||
if ($this->php4[0] == '/') // we found a php4 binary
|
if ($this->php4{0} == '/') // we found a php4 binary
|
||||||
{
|
{
|
||||||
$this->php = $this->php4;
|
$this->php = $this->php4;
|
||||||
}
|
}
|
||||||
if ($this->php5[0] == '/') // we found a php5 binary
|
if ($this->php5{0} == '/') // we found a php5 binary
|
||||||
{
|
{
|
||||||
$this->php = $this->php5;
|
$this->php = $this->php5;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -630,10 +625,10 @@
|
|||||||
if ($this->debug) echo 'line '.++$n.": $line<br>\n";
|
if ($this->debug) echo 'line '.++$n.": $line<br>\n";
|
||||||
$parts = split(' ',$line,6);
|
$parts = split(' ',$line,6);
|
||||||
|
|
||||||
if ($line[0] == '#' || count($parts) < 6 || ($parts[5][0] != '/' && substr($parts[5],0,3) != 'php'))
|
if ($line{0} == '#' || count($parts) < 6 || ($parts[5]{0} != '/' && substr($parts[5],0,3) != 'php'))
|
||||||
{
|
{
|
||||||
// ignore comments
|
// ignore comments
|
||||||
if ($line[0] != '#')
|
if ($line{0} != '#')
|
||||||
{
|
{
|
||||||
$times['error'] .= $line;
|
$times['error'] .= $line;
|
||||||
}
|
}
|
||||||
@ -699,4 +694,4 @@
|
|||||||
}
|
}
|
||||||
return $times !== False ? $this->installed() : ' ';
|
return $times !== False ? $this->installed() : ' ';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user