[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] CVS: phpgwapi/inc class.asyncservice.inc.php,1.1.2.5
From: |
Ralf Becker <address@hidden> |
Subject: |
[Phpgroupware-cvs] CVS: phpgwapi/inc class.asyncservice.inc.php,1.1.2.5,1.1.2.6 |
Date: |
Sat, 05 Jul 2003 16:35:58 -0400 |
Update of /cvsroot/phpgroupware/phpgwapi/inc
In directory subversions:/tmp/cvs-serv10114/inc
Modified Files:
Tag: Version-0_9_16-branch
class.asyncservice.inc.php
Log Message:
update asyncservice to store user-info and create a "normal" phpgw environment
(eg. preferences) for the job to run
Index: class.asyncservice.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/phpgwapi/inc/class.asyncservice.inc.php,v
retrieving revision 1.1.2.5
retrieving revision 1.1.2.6
diff -C2 -r1.1.2.5 -r1.1.2.6
*** class.asyncservice.inc.php 14 Jun 2003 15:47:18 -0000 1.1.2.5
--- class.asyncservice.inc.php 5 Jul 2003 20:35:56 -0000 1.1.2.6
***************
*** 56,60 ****
@function set_timer
@abstract calculates the next run of the timer and puts that
with the rest of the data in the db for later execution.
! @syntax set_timer($times,$id,$method,$data)
@param $times unix timestamp or
array('min','hour','dow','day','month','year') with execution time.
Repeated events are possible to shedule by setting the
array only partly, eg.
--- 56,60 ----
@function set_timer
@abstract calculates the next run of the timer and puts that
with the rest of the data in the db for later execution.
! @syntax set_timer($times,$id,$method,$data,$account_id=False)
@param $times unix timestamp or
array('min','hour','dow','day','month','year') with execution time.
Repeated events are possible to shedule by setting the
array only partly, eg.
***************
*** 67,73 ****
@param $data This data is passed back when the method is
called. It might simply be an
integer id, but it can also be a complete array.
@result False if $id already exists, else True
*/
! function set_timer($times,$id,$method,$data)
{
if (empty($id) || empty($method) || $this->read($id) ||
--- 67,74 ----
@param $data This data is passed back when the method is
called. It might simply be an
integer id, but it can also be a complete array.
+ @param $account_id account_id, under which the methode should
be called or False for the actual user
@result False if $id already exists, else True
*/
! function set_timer($times,$id,$method,$data,$account_id=False)
{
if (empty($id) || empty($method) || $this->read($id) ||
***************
*** 76,79 ****
--- 77,84 ----
return False;
}
+ if ($account_id === False)
+ {
+ $account_id =
$GLOBALS['phpgw_info']['user']['account_id'];
+ }
$job = array(
'id' => $id,
***************
*** 81,85 ****
'times' => $times,
'method' => $method,
! 'data' => $data
);
$this->write($job);
--- 86,91 ----
'times' => $times,
'method' => $method,
! 'data' => $data,
! 'account_id' => $account_id
);
$this->write($job);
***************
*** 392,397 ****
flush();
- unset($GLOBALS['phpgw_info']['user']); // if we run
via the fallback, we dont want to be treated as that user
-
if (!$this->last_check_run(True,False,$run_by))
{
--- 398,401 ----
***************
*** 402,405 ****
--- 406,437 ----
foreach($jobs as $id => $job)
{
+ // checking / setting up phpgw_info/user
+ //
+ if
($GLOBALS['phpgw_info']['user']['account_id'] != $job['account_id'])
+ {
+ $domain =
$GLOBALS['phpgw_info']['user']['domain'];
+ $lang =
$GLOBALS['phpgw_info']['user']['preferences']['common']['lang'];
+
unset($GLOBALS['phpgw_info']['user']);
+
+ if
($GLOBALS['phpgw']->session->account_id = $job['account_id'])
+ {
+
$GLOBALS['phpgw']->session->account_lid =
$GLOBALS['phpgw']->accounts->id2name($job['account_id']);
+
$GLOBALS['phpgw']->session->account_domain = $domain;
+
$GLOBALS['phpgw']->session->read_repositories(False,False);
+
$GLOBALS['phpgw_info']['user'] = $GLOBALS['phpgw']->session->user;
+
+ if ($lang !=
$GLOBALS['phpgw_info']['user']['preferences']['common']['lang'])
+ {
+
unset($GLOBALS['lang']);
+ }
+ }
+ else
+ {
+
$GLOBALS['phpgw_info']['user']['domain'] = $domain;
+ }
+ }
+ list($app) =
explode('.',$job['method']);
+
$GLOBALS['phpgw']->translation->add_app($app);
+
ExecMethod($job['method'],$job['data']);
***************
*** 454,458 ****
'times' =>
unserialize($this->db->f('times')),
'method' => $this->db->f('method'),
! 'data' =>
unserialize($this->db->f('data'))
);
//echo "job id='$id'<pre>";
print_r($jobs[$id]); echo "</pre>\n";
--- 486,491 ----
'times' =>
unserialize($this->db->f('times')),
'method' => $this->db->f('method'),
! 'data' =>
unserialize($this->db->f('data')),
! 'account_id' =>
$this->db->f('account_id')
);
//echo "job id='$id'<pre>";
print_r($jobs[$id]); echo "</pre>\n";
***************
*** 477,490 ****
$job['data'] =
$this->db->db_addslashes(serialize($job['data']));
$job['next'] = intval($job['next']);
if ($exists || $this->read($job['id']))
{
$this->db->query("UPDATE $this->db_table SET
next=$job[next],times='$job[times]',".
!
"method='$job[method]',data='$job[data]' WHERE
id='$job[id]'",__LINE__,__FILE__);
}
else
{
! $this->db->query("INSERT INTO $this->db_table
(id,next,times,method,data) VALUES ".
!
"('$job[id]',$job[next],'$job[times]','$job[method]','$job[data]')",__LINE__,__FILE__);
}
}
--- 510,524 ----
$job['data'] =
$this->db->db_addslashes(serialize($job['data']));
$job['next'] = intval($job['next']);
+ $job['account_id'] = intval($job['account_id']);
if ($exists || $this->read($job['id']))
{
$this->db->query("UPDATE $this->db_table SET
next=$job[next],times='$job[times]',".
!
"method='$job[method]',data='$job[data]',account_id=$job[account_id] WHERE
id='$job[id]'",__LINE__,__FILE__);
}
else
{
! $this->db->query("INSERT INTO $this->db_table
(id,next,times,method,data,account_id) VALUES ".
!
"('$job[id]',$job[next],'$job[times]','$job[method]','$job[data]',$job[account_id])",__LINE__,__FILE__);
}
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] CVS: phpgwapi/inc class.asyncservice.inc.php,1.1.2.5,1.1.2.6,
Ralf Becker <address@hidden> <=
- Prev by Date:
[Phpgroupware-cvs] CVS: phpgwapi/setup setup.inc.php,1.37.2.6.2.8,1.37.2.6.2.9 tables_current.inc.php,1.32.2.6.2.8,1.32.2.6.2.9 tables_update.inc.php,1.53.2.9.2.11,1.53.2.9.2.12
- Next by Date:
[Phpgroupware-cvs] CVS: admin/setup phpgw_de.lang,1.14.2.9.2.9,1.14.2.9.2.10 phpgw_en.lang,1.23.2.18.2.10,1.23.2.18.2.11
- Previous by thread:
[Phpgroupware-cvs] CVS: phpgwapi/setup setup.inc.php,1.37.2.6.2.8,1.37.2.6.2.9 tables_current.inc.php,1.32.2.6.2.8,1.32.2.6.2.9 tables_update.inc.php,1.53.2.9.2.11,1.53.2.9.2.12
- Next by thread:
[Phpgroupware-cvs] CVS: admin/setup phpgw_de.lang,1.14.2.9.2.9,1.14.2.9.2.10 phpgw_en.lang,1.23.2.18.2.10,1.23.2.18.2.11
- Index(es):