From 37469a8df4e754327c24b3cf29b3c1e79d0caaf8 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Wed, 9 Aug 2006 07:42:55 +0000 Subject: - Patch #76958 by forngren, dww et al: make it a tad easier to run cron manually. --- modules/system/system.module | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) (limited to 'modules/system/system.module') diff --git a/modules/system/system.module b/modules/system/system.module index 89d6a7bef..7ad3a891a 100644 --- a/modules/system/system.module +++ b/modules/system/system.module @@ -17,15 +17,17 @@ function system_help($section) { switch ($section) { case 'admin/help#system': $output = '

'. t('The system module provides system-wide defaults such as running jobs at a particular time, and storing web pages to improve efficiency. The ability to run scheduled jobs makes administering the web site more usable, as administrators do not have to manually start jobs. The storing of web pages, or caching, allows the site to efficiently re-use web pages and improve web site performance. The settings module provides control over preferences, behaviours including visual and operational settings.') .'

'; - $output .= '

'. t('Some modules require regularly scheduled actions, such as cleaning up logfiles. Cron, which stands for chronograph, is a periodic command scheduler executing commands at intervals specified in seconds. It can be used to control the execution of daily, weekly and monthly jobs (or anything with a period measured in seconds). The aggregator module periodically updates feeds using cron. Ping periodically notifies services of new content on your site. Search periodically indexes the content on your site. Automating tasks is one of the best ways to keep a system running smoothly, and if most of your administration does not require your direct involvement, cron is an ideal solution.') .'

'; + $output .= '

'. t('Some modules require regularly scheduled actions, such as cleaning up logfiles. Cron, which stands for chronograph, is a periodic command scheduler executing commands at intervals specified in seconds. It can be used to control the execution of daily, weekly and monthly jobs (or anything with a period measured in seconds). The aggregator module periodically updates feeds using cron. Ping periodically notifies services of new content on your site. Search periodically indexes the content on your site. Automating tasks is one of the best ways to keep a system running smoothly, and if most of your administration does not require your direct involvement, cron is an ideal solution. Cron can, if necessary, also be run manually.') .'

'; $output .= '

'. t('There is a caching mechanism which stores dynamically generated web pages in a database. By caching a web page, the system module does not have to create the page each time someone wants to view it, instead it takes only one SQL query to display it, reducing response time and the server\'s load. Only pages requested by anonymous users are cached. In order to reduce server load and save bandwidth, the system module stores and sends cached pages compressed.') .'

'; $output .= t('

You can

-', array('%file-cron' => 'cron.php', '%external-http-drupal-org-cron' => 'http://drupal.org/cron', '%admin-settings' => url('admin/settings/page-caching'))); +', array('%file-cron' => 'cron.php', '%external-http-drupal-org-cron' => 'http://drupal.org/cron', '%cron-status' => url('admin/settings/cron-status'), '%cron-manually' => url('admin/settings/cron-status/cron'), '%admin-settings' => url('admin/settings/page-caching'))); $output .= '

'. t('For more information please read the configuration and customization handbook System page.', array('%system' => 'http://drupal.org/handbook/modules/system/')) .'

'; return $output; case 'admin/settings/modules#description': @@ -227,7 +229,7 @@ function system_menu($may_cache) { $items[] = array( 'path' => 'admin/settings/cron-status', 'title' => t('cron status'), - 'description' => t('View whether or not cron is running on your site.'), + 'description' => t('Check cron status or run cron manually.'), 'callback' => 'system_cron_status'); $items[] = array( 'path' => 'admin/settings/clean-urls', @@ -751,15 +753,26 @@ function system_unicode_settings() { return system_settings_form('system_unicode_settings', unicode_settings()); } -function system_cron_status() { - $cron_last = variable_get('cron_last', NULL); +function system_cron_status($cron = '') { + if ($cron == 'cron') { + // Run cron manually + if (drupal_cron_run()) { + drupal_set_message(t('Cron ran successfully')); + } + else { + drupal_set_message(t('Cron run failed')); + } + drupal_goto('admin/settings/cron-status'); + } + $cron_last = variable_get('cron_last', NULL); if (is_numeric($cron_last)) { $status = t('Cron is running. The last cron job ran %time ago.', array('%time' => format_interval(time() - $cron_last))); } else { $status = t('Cron has not run. It appears cron jobs have not been setup on your system. Please check the help pages for configuring cron jobs.', array('%url' => 'http://drupal.org/cron')); } + $status .= ' '. t('Cron can, if necessary, also be run manually.', array('%cron' => url('admin/settings/cron-status/cron'))); return $status; } -- cgit v1.2.3