Platform  3.1
PHP API documentation
 All Data Structures Namespaces Files Functions Variables Pages
crontab.php
Go to the documentation of this file.
1 <?php
2 /*
3  * @author Anakeen
4  * @license http://creativecommons.org/licenses/by-nc-sa/2.0/fr/ Anakeen - licence CC
5  * @package FDL
6 */
7 /**
8  * API script to manipulate user crontab
9  *
10  * @author Anakeen 2009
11  * @version $Id: crontab.php,v 1.2 2009/01/16 15:51:35 jerome Exp $
12  * @license http://creativecommons.org/licenses/by-nc-sa/2.0/fr/ Anakeen - licence CC
13  * @package FDL
14  * @subpackage
15  */
16 /**
17  */
18 
19 include_once ("WHAT/Class.Crontab.php");
20 include_once ("FDL/Lib.Util.php");
21 
22 $cmd = getHttpVars("cmd", NULL);
23 $file = getHttpVars("file", NULL);
24 $user = getHttpVars("user", NULL);
25 
26 function usage()
27 {
28  print "\n";
29  print "wsh --api=crontab --cmd=list [--user=<uid>]\n";
30  print "wsh --api=crontab --cmd=<register|unregister> --file=<path/to/cronfile> [--user=<uid>]\n";
31  print "\n";
32 }
33 
34 switch ($cmd) {
35  case 'list':
36  $crontab = new Crontab($user);
37  $ret = $crontab->listAll();
38  if ($ret === FALSE) {
39  exit(1);
40  }
41  break;
42 
43  case 'register':
44  if ($file === NULL) {
45  error_log("Error: missing --file argument");
46  exit(1);
47  }
48  $crontab = new Crontab($user);
49  $ret = $crontab->registerFile($file);
50  if ($ret === FALSE) {
51  exit(1);
52  }
53  break;
54 
55  case 'unregister':
56  if ($file === NULL) {
57  error_log("Error: missing --file argument");
58  exit(1);
59  }
60  $crontab = new Crontab($user);
61  $ret = $crontab->unregisterFile($file);
62  if ($ret === FALSE) {
63  exit(1);
64  }
65  break;
66 
67  default:
68  usage();
69 }
70 
71 exit(0);
72 ?>
← centre documentaire © anakeen - published under CC License - Dynacase