[ Index ]
 

Code source de eGroupWare 1.2.106-2

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/phpgwapi/inc/ -> class.asyncservice.inc.php (sommaire)

(pas de description)

Poids: 702 lignes (21 kb)
Inclus ou requis:0 fois
Référencé: 0 fois
Nécessite: 0 fichiers

Définit 1 class

asyncservice:: (12 méthodes):
  asyncservice()
  set_timer()
  next_run()
  cancel_timer()
  last_check_run()
  check_run()
  read()
  write()
  delete()
  find_binarys()
  installed()
  install()


Classe: asyncservice  - X-Ref

The class implements a general eGW service to execute callbacks at a given time.

see http://www.egroupware.org/wiki/TimedAsyncServices

asyncservice()   X-Ref
constructor of the class


set_timer($times,$id,$method,$data,$account_id=False)   X-Ref
calculates the next run of the timer and puts that with the rest of the data in the db for later execution.

param: int/array $times unix timestamp or array('min','hour','dow','day','month','year') with execution time.
param: string $id unique id to cancel the request later, if necessary. Should be in a form like
param: string $method Method to be called via ExecMethod($method,$data). $method has the form
param: mixed $data This data is passed back when the method is called. It might simply be an
param: int $account_id account_id, under which the methode should be called or False for the actual user
return: boolean False if $id already exists, else True    

next_run($times,$debug=False)   X-Ref
calculates the next execution time for $times

param: int/array $times unix timestamp or array('year'=>$year,'month'=>$month,'dow'=>$dow,'day'=>$day,'hour'=>$hour,'min'=>$min)
param: boolean $debug if True some debug-messages about syntax-errors in $times are echoed
return: int a unix timestamp of the next execution time or False if no more executions

cancel_timer($id)   X-Ref
cancels a timer

param: string $id has to be the one used to set it.
return: boolean True if the timer exists and is not expired.

last_check_run($semaphore=False,$release=False,$run_by='')   X-Ref
checks when the last check_run was run or set the run-semaphore if $semaphore == True

param: boolean $semaphore if False only check, if true try to set/release the semaphore
param: boolean $release if $semaphore == True, tells if we should set or release the semaphore
return: mixed if !$set array('start' => $start,'end' => $end) with timestamps of last check_run start and end,  \

check_run($run_by='')   X-Ref
checks if there are any jobs ready to run (timer expired) and executes them


read($id=0)   X-Ref
reads all matching db-rows / jobs

param: string $id =0 reads all expired rows / jobs ready to run\
return: array/boolean db-rows / jobs as array or False if no matches

write($job,$exists = False)   X-Ref
write a job / db-row to the db

param: array $job db-row as array
param: boolean $exits if True, we do an update, else we check if update or insert necesary

delete($id)   X-Ref
delete db-row / job with $id

return: boolean False if $id not found else True

find_binarys()   X-Ref
Pas de description

installed()   X-Ref
checks if phpgwapi/cron/asyncservices.php is installed as cron-job

return: array the times asyncservices are run (normaly 'min'=>'* /5') or False if not installed or 0 if crontab not found

install($times)   X-Ref
installs /phpgwapi/cron/asyncservices.php as cron-job

Not implemented for Windows at the moment, always returns 0

param: array $times array with keys 'min','hour','day','month','dow', not set is equal to '*'.
return: mixed the times asyncservices are run, False if they are not installed,



Généré le : Sun Feb 25 17:20:01 2007 par Balluche grâce à PHPXref 0.7