[ Index ]

PHP Cross Reference of Drupal 6 (gatewave)

title

Body

[close]

/sites/all/modules/project_issue/scripts/ -> project-issue-cron.php (source)

   1  #!/usr/bin/php
   2  <?php
   3  // $Id: project-issue-cron.php,v 1.3 2009/01/20 18:38:04 dww Exp $
   4  
   5  
   6  /**
   7   * @file
   8   * Script to invoke project_issue periodic code outside of hook_cron().
   9   *
  10   * On some sites, hook_cron() becomes very busy and you can frequently get
  11   * timeouts where all of the cron-tasks can't be completed during the time
  12   * limit for web-based PHP requests. To aleviate this problem, you can move
  13   * some of the code invoked by hook_cron() into separate CLI scripts which you
  14   * invoke directly by adding additional entries to the crontab on your system.
  15   * If you do this, you must also set the "project_issue_hook_cron" variable
  16   * to FALSE in your site's settings.php file.
  17   *
  18   * @author Derek Wright (http://drupal.org/user/46549)
  19   *
  20   */
  21  
  22  // ------------------------------------------------------------
  23  // Required customization
  24  // ------------------------------------------------------------
  25  
  26  // The root of your Drupal installation, so we can properly bootstrap
  27  // Drupal. This should be the full path to the directory that holds
  28  // your index.php file, the "includes" subdirectory, etc.
  29  define('DRUPAL_ROOT', '');
  30  
  31  // The name of your site. Required so that when we bootstrap Drupal in
  32  // this script, we find the right settings.php file in your sites folder.
  33  define('SITE_NAME', '');
  34  
  35  
  36  // ------------------------------------------------------------
  37  // Initialization
  38  // (Real work begins here, nothing else to customize)
  39  // ------------------------------------------------------------
  40  
  41  // Check if all required variables are defined
  42  $vars = array(
  43    'DRUPAL_ROOT' => DRUPAL_ROOT,
  44    'SITE_NAME' => SITE_NAME,
  45  );
  46  $fatal_err = FALSE;
  47  foreach ($vars as $name => $val) {
  48    if (empty($val)) {
  49      print "ERROR: \"$name\" constant not defined, aborting\n";
  50      $fatal_err = TRUE;
  51    }
  52  }
  53  if ($fatal_err) {
  54    exit(1);
  55  }
  56  
  57  $script_name = $argv[0];
  58  
  59  // Setup variables for Drupal bootstrap
  60  $_SERVER['HTTP_HOST'] = SITE_NAME;
  61  $_SERVER['REQUEST_URI'] = '/' . $script_name;
  62  $_SERVER['SCRIPT_NAME'] = '/' . $script_name;
  63  $_SERVER['PHP_SELF'] = '/' . $script_name;
  64  $_SERVER['SCRIPT_FILENAME'] = $_SERVER['PWD'] .'/'. $script_name;
  65  $_SERVER['PATH_TRANSLATED'] = $_SERVER['SCRIPT_FILENAME'];
  66  
  67  if (!chdir(DRUPAL_ROOT)) {
  68    print "ERROR: Can't chdir(DRUPAL_ROOT), aborting.\n";
  69    exit(1);
  70  }
  71  // Make sure our umask is sane for generating directories and files.
  72  umask(022);
  73  
  74  require_once  'includes/bootstrap.inc';
  75  drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
  76  
  77  // Real work begins.
  78  if (module_exists('project_issue') && variable_get('project_issue_hook_cron', TRUE) == FALSE) {
  79    module_load_include('inc', 'project_issue', 'includes/cron');
  80    _project_issue_cron();
  81  }
  82  


Generated: Thu Mar 24 11:18:33 2011 Cross-referenced by PHPXref 0.7