cron.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. /**
  3. * @file
  4. * Handles incoming requests to fire off regularly-scheduled tasks (cron jobs).
  5. */
  6. if (!file_exists('includes/bootstrap.inc')) {
  7. if (!empty($_SERVER['DOCUMENT_ROOT']) && file_exists($_SERVER['DOCUMENT_ROOT'] . '/includes/bootstrap.inc')) {
  8. chdir($_SERVER['DOCUMENT_ROOT']);
  9. } elseif (preg_match('@^(.*)[\\\\/]sites[\\\\/][^\\\\/]+[\\\\/]modules[\\\\/]([^\\\\/]+[\\\\/])?elysia(_cron)?$@', getcwd(), $r) && file_exists($r[1] . '/includes/bootstrap.inc')) {
  10. chdir($r[1]);
  11. } else {
  12. die("Cron Fatal Error: Can't locate bootstrap.inc. Check cron.php position.");
  13. }
  14. }
  15. /**
  16. * Root directory of Drupal installation.
  17. */
  18. define('DRUPAL_ROOT', getcwd());
  19. include_once DRUPAL_ROOT . '/includes/bootstrap.inc';
  20. drupal_override_server_variables(array(
  21. 'SCRIPT_NAME' => '/cron.php',
  22. ));
  23. drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
  24. if (!isset($_GET['cron_key']) || variable_get('cron_key', 'drupal') != $_GET['cron_key']) {
  25. watchdog('cron', 'Cron could not run because an invalid key was used.', array(), WATCHDOG_NOTICE);
  26. drupal_access_denied();
  27. }
  28. elseif (variable_get('maintenance_mode', 0)) {
  29. watchdog('cron', 'Cron could not run because the site is in maintenance mode.', array(), WATCHDOG_NOTICE);
  30. drupal_access_denied();
  31. }
  32. else {
  33. if (function_exists('elysia_cron_run')) {
  34. elysia_cron_run();
  35. }
  36. else {
  37. drupal_cron_run();
  38. }
  39. }