cron.php 1.4 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. }
  10. elseif (preg_match('@^(.*)[\\\\/]sites[\\\\/][^\\\\/]+[\\\\/]modules[\\\\/]([^\\\\/]+[\\\\/])?elysia(_cron)?$@', getcwd(), $r) && file_exists($r[1] . '/includes/bootstrap.inc')) {
  11. chdir($r[1]);
  12. }
  13. else {
  14. die("Cron Fatal Error: Can't locate bootstrap.inc. Check cron.php position.");
  15. }
  16. }
  17. /**
  18. * Root directory of Drupal installation.
  19. */
  20. define('DRUPAL_ROOT', getcwd());
  21. include_once DRUPAL_ROOT . '/includes/bootstrap.inc';
  22. drupal_override_server_variables(array('SCRIPT_NAME' => '/cron.php'));
  23. drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
  24. if ((variable_get('cron_key') && empty($_GET['cron_key'])) || !empty($_GET['cron_key']) && variable_get('cron_key') != $_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) && !variable_get('elysia_cron_run_maintenance', FALSE)) {
  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. }