/[drupal]/contributions/modules/sympal_scripts/cron.php
ViewVC logotype

Contents of /contributions/modules/sympal_scripts/cron.php

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (show annotations) (download) (as text)
Sat Aug 5 18:55:21 2006 UTC (3 years, 3 months ago) by ber
Branch: MAIN
CVS Tags: HEAD
File MIME type: text/x-php
common.php got two new functions, one to retreive all sites installed on your multisite, the other is a start for a new proper argument parsing system
drupal.php now can include many drupal sites in one PHP session. handy if you want to perform batch tasks on a range of sites (such as running cron).
changed crontab into cron.php.
Cron.php is now compatible with the usage docs http://webschuur.com/node/637
1 #!/usr/bin/php
2 <?php
3
4 function cron_init() {
5 global $argc, $argv;
6 if ($argc > 1) {
7 include_once('script_settings.php');
8 include_once('common.php');
9
10 $arguments = parse_dash_arguments();
11
12 if ($arguments['drupal_dir']) {
13 $drupal_dir = $arguments['drupal_dir'];
14 }
15 if (isset($arguments['all'])) {
16 /** @todo: Sessions and variables are persistant. So this does not yet work **/
17 return cron_run_all($drupal_dir);
18 }
19 elseif ($arguments['site']) {
20 return cron_run_one($arguments['site'], $drupal_dir);
21 }
22 }
23 return '';
24 }
25
26 function cron_run_one($site, $drupal_dir) {
27 $sites = list_all_domains($drupal_dir);
28 if (in_array($site, $sites)) {
29 include_once('drupal.php');
30 $message = installer_include_drupal($site);
31
32 global $base_path, $base_url;
33
34 report_to_console($base_url . $site, 'cron', $message);
35 @fclose(@fopen("$base_url/cron.php" ,'r'));
36 }
37 }
38
39 function cron_run_all($drupal_dir) {
40 foreach (list_all_domains($drupal_dir) as $site) {
41 cron_run_one($site, $drupal_dir);
42 }
43 }
44 /**
45 * Include Drupal
46 */
47 cron_init();
48
49 ?>

  ViewVC Help
Powered by ViewVC 1.1.2