From 6be2fdfa1f2f85d1d5ecf6ae2bd2c46ab62f9b2d Mon Sep 17 00:00:00 2001 From: Cerdic <cedric@yterium.com> Date: Tue, 12 Apr 2011 08:15:49 +0000 Subject: [PATCH] - Quand une insertion de tache avec unicite est demandee, renvoyer l'id_job de la tache deja existante le cas echeant pour permettre son execution immediate, et non false - documentation sur l'argument d'inclusion de job_queue_add - bouton 'Executer maintenant' pas en ajax pour permettre du debug dans la tache --- ecrire/inc/queue.php | 4 ++-- ecrire/inc/utils.php | 3 ++- prive/squelettes/contenu/job_queue.html | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/ecrire/inc/queue.php b/ecrire/inc/queue.php index 2ba5f6ded8..d166f7b499 100644 --- a/ecrire/inc/queue.php +++ b/ecrire/inc/queue.php @@ -57,12 +57,12 @@ function queue_add_job($function, $description, $arguments = array(), $file = '' if ( $no_duplicate AND - sql_countsel('spip_jobs', + $id_job = sql_getfetsel('id_job','spip_jobs', 'status='.intval(_JQ_SCHEDULED).' AND fonction='.sql_quote($function) .(($no_duplicate==='function_only')?'': ' AND md5args='.sql_quote($md5args).' AND inclure='.sql_quote($file))) ) - return false; + return $id_job; // si pas de date programee, des que possible if (!$time) diff --git a/ecrire/inc/utils.php b/ecrire/inc/utils.php index 25154378d9..2c11309341 100644 --- a/ecrire/inc/utils.php +++ b/ecrire/inc/utils.php @@ -597,7 +597,8 @@ function cron ($taches=array(), $taches_old= array()) { * @param $arguments * Optional array of arguments to pass to the function. * @param $file - * Optional file path which needs to be included for $fucntion. + * Optional file path which needs to be included for $function. + * if ends with '/', will do charger_fonction($function,$file); * @param $no_duplicate * If TRUE, do not add the job to the queue if one with the same function and * arguments already exists. diff --git a/prive/squelettes/contenu/job_queue.html b/prive/squelettes/contenu/job_queue.html index e4a0c7a8f3..b3be03eca0 100644 --- a/prive/squelettes/contenu/job_queue.html +++ b/prive/squelettes/contenu/job_queue.html @@ -22,7 +22,7 @@ genie_queue_watch_dist(); [(#AUTORISER{'annuler','job',#ID_JOB}|oui) <div class="actions"> [(#BOUTON_ACTION{<:annuler:>,#URL_ACTION_AUTEUR{annuler_job,#ID_JOB,#SELF},ajax})] - [(#BOUTON_ACTION{<:queue_executer_maintenant:>,#URL_ACTION_AUTEUR{forcer_job,#ID_JOB,#SELF},ajax})] + [(#BOUTON_ACTION{<:queue_executer_maintenant:>,#URL_ACTION_AUTEUR{forcer_job,#ID_JOB,#SELF}})] </div> ] </li> -- GitLab