3 /***************************************************************************\
4 * SPIP, Systeme de publication pour l'internet *
6 * Copyright (c) 2001-2016 *
7 * Arnaud Martin, Antoine Pitrou, Philippe Riviere, Emmanuel Saint-James *
9 * Ce programme est un logiciel libre distribue sous licence GNU/GPL. *
10 * Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. *
11 \***************************************************************************/
13 if (!defined('_ECRIRE_INC_VERSION')) return;
16 * Url pour lancer le cron de manière asynchrone si le serveur
19 * On se base sur le même code que celui du pipeline affichage final
21 * Cette fonction est utile pour être appelée depuis un cron UNIX par exemple
22 * car elle retourne tout de suite
24 * Exemple de tache cron Unix pour un appel toutes les minutes :
25 * "* * * * * curl http://www.mondomaine.tld/spip.php?action=super_cron"
27 function action_super_cron_dist(){
28 // Si fsockopen est possible, on lance le cron via un socket
30 if(function_exists('fsockopen')){
31 $url = generer_url_action('cron');
32 $parts=parse_url($url);
33 $fp = fsockopen($parts['host'],
34 isset($parts['port'])?
$parts['port']:80,
37 $out = "GET ".$parts['path']."?".$parts['query']." HTTP/1.1\r\n";
38 $out.= "Host: ".$parts['host']."\r\n";
39 $out.= "Connection: Close\r\n\r\n";
45 // ici lancer le cron par un CURL asynchrone si CURL est présent