14

cron

cron_run
SYNOPSIS

cron_run()

DESCRIPTION
CODE
  1. require_once 'registry.php';
  1. define('CRON_DIR', ROOT_DIR . DIRECTORY_SEPARATOR . 'cron');
  1. function cron_run() {
  2.     $files=glob(CRON_DIR . DIRECTORY_SEPARATOR . '*.php');
  3.  
  4.     if (!$files) {
  5.         return true;
  6.     }
  7.  
  8.     $now=time();
  9.  
  10.     $semaphore = registry_get('cron_lock', false);
  11.  
  12.     if ($semaphore) {
  13.         if ($now - $semaphore < 3600) {
  14.             return false;
  15.         }
  16.     }
  17.  
  18.     registry_set('cron_last', $now);
  19.     registry_set('cron_lock', $now);
  20.  
  21.     foreach ($files as $f) {
  22.         include $f;
  23.     }
  24.  
  25.     registry_delete('cron_lock');
  26.  
  27.     return true;
  28. }
cron_cleanup
SYNOPSIS

cron_cleanup()

DESCRIPTION
CODE
  1. function cron_cleanup() {
  2.     registry_delete('cron_lock');
  3. }
VOIR AUSSI

registry, index

Commentaires

Votre commentaire :
[p] [b] [i] [u] [s] [quote] [pre] [br] [code] [url] [email] strip aide 2000

Entrez un maximum de 2000 caractères.
Améliorez la présentation de votre texte avec les balises de formatage suivantes :
[p]paragraphe[/p], [b]gras[/b], [i]italique[/i], [u]souligné[/u], [s]barré[/s], [quote]citation[/quote], [pre]tel quel[/pre], [br]à la ligne,
[url]http://www.izend.org[/url], [url=http://www.izend.org]site[/url], [email]izend@izend.org[/email], [email=izend@izend.org]izend[/email],
[code]commande[/code], [code=langage]code source en c, java, php, html, javascript, xml, css, sql, bash, dos, make, etc.[/code].