Index: install.php
===================================================================
RCS file: /cvs/drupal/drupal/install.php,v
retrieving revision 1.9
diff -u -F^f -r1.9 install.php
--- install.php	21 Aug 2006 06:22:01 -0000	1.9
+++ install.php	26 Aug 2006 22:00:34 -0000
@@ -28,7 +28,6 @@ function install_main() {
     // Establish a connection to the database.
     require_once './includes/database.inc';
     db_set_active();
-
     // Check if Drupal is installed.
     if (install_verify_drupal()) {
       install_already_done_error();
@@ -51,7 +50,7 @@ function install_main() {
     install_goto("install.php?profile=$profile");
   }
   else {
-    _install_no_profile_error();
+    install_no_profile_error();
   }
   // Load the profile.
   require_once "./profiles/$profile/$profile.profile";
@@ -61,6 +60,9 @@ function install_main() {
     install_change_settings();
   }
 
+  // Check the installation requirements for Drupal and this profile.
+  install_check_requirements($profile);
+
   // Perform actual installation defined in the profile.
   $modules = drupal_verify_profile($profile);
   drupal_install_profile($profile, $modules);
@@ -449,4 +451,27 @@ function install_complete($profile) {
   print theme('maintenance_page', $output);
 }
 
+/**
+ * Page to check installation requirements and report any errors.
+ */
+function install_check_requirements($profile) {
+  $requirements = drupal_check_profile($profile);
+  $severity = drupal_requirements_severity($requirements);
+
+  // If there are issues, report them.
+  if ($severity == REQUIREMENT_ERROR) {
+    drupal_maintenance_theme();
+
+    foreach ($requirements as $requirement) {
+      if (isset($requirement['severity']) && $requirement['severity'] == REQUIREMENT_ERROR) {
+        drupal_set_message($requirement['description'] .' ('. t('Currently using @item %version', array('@item' => $requirement['title'], '%version' => $requirement['value'])) .')', 'error');
+      }
+    }
+
+    drupal_set_title('Incompatible environment');
+    print theme('install_page', '');
+    exit;
+  }
+}
+
 install_main();
Index: includes/common.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/common.inc,v
retrieving revision 1.560
diff -u -F^f -r1.560 common.inc
--- includes/common.inc	22 Aug 2006 11:13:03 -0000	1.560
+++ includes/common.inc	26 Aug 2006 22:00:40 -0000
@@ -1332,10 +1332,6 @@ function drupal_add_js($data = NULL, $ty
 
   if (!isset($javascript[$scope])) {
     $javascript[$scope] = array('core' => array(), 'module' => array(), 'theme' => array(), 'setting' => array(), 'inline' => array());
-
-    if (empty($javascript['header']['core']['misc/drupal.js'])) {
-      drupal_add_js('misc/drupal.js', 'core');
-    }
   }
 
   if (!isset($javascript[$scope][$type])) {
@@ -1343,6 +1339,9 @@ function drupal_add_js($data = NULL, $ty
   }
 
   if (!is_null($data)) {
+    if (empty($javascript['header']['core']['misc/drupal.js'])) {
+      drupal_add_js('misc/drupal.js', 'core');
+    }
     switch ($type) {
       case 'setting':
         $javascript[$scope][$type][] = $data;
Index: includes/database.mysql.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/database.mysql.inc,v
retrieving revision 1.56
diff -u -F^f -r1.56 database.mysql.inc
--- includes/database.mysql.inc	31 Jul 2006 19:24:16 -0000	1.56
+++ includes/database.mysql.inc	26 Aug 2006 22:00:41 -0000
@@ -11,6 +11,19 @@
  * @{
  */
 
+
+/**
+ * Report database status.
+ */
+function db_status_report() {
+  $t = function_exists('install_main') ? 'st' : 't';
+  $form['mysql'] = array(
+    'title' => $t('MySQL database'),
+    'value' => mysql_get_server_info(),
+  );
+  return $form;
+}
+
 /**
  * Initialize a database connection.
  *
Index: includes/database.mysqli.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/database.mysqli.inc,v
retrieving revision 1.20
diff -u -F^f -r1.20 database.mysqli.inc
--- includes/database.mysqli.inc	26 Jul 2006 07:16:08 -0000	1.20
+++ includes/database.mysqli.inc	26 Aug 2006 22:00:41 -0000
@@ -16,6 +16,18 @@
  */
 
 /**
+ * Report database status.
+ */
+function db_status_report() {
+  $t = function_exists('install_main') ? 'st' : 't';
+  $form['mysql'] = array(
+    'title' => $t('MySQL database'),
+    'value' => mysqli_get_server_info($connection),
+  );
+  return $form;
+}
+
+/**
  * Initialise a database connection.
  *
  * Note that mysqli does not support persistent connections.
Index: includes/database.pgsql.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/database.pgsql.inc,v
retrieving revision 1.34
diff -u -F^f -r1.34 database.pgsql.inc
--- includes/database.pgsql.inc	18 Aug 2006 12:16:57 -0000	1.34
+++ includes/database.pgsql.inc	26 Aug 2006 22:00:41 -0000
@@ -12,6 +12,24 @@
  */
 
 /**
+ * Report database status.
+ */
+function db_status_report() {
+  $t = function_exists('install_main') ? 'st' : 't';
+  if (function_exists('pg_version')) {
+    $version = pg_version();
+  }
+  else {
+    $version = array('server' => t('Unknown'));
+  }
+  $form['pgsql'] = array(
+    'title' => $t('PostgreSQL database'),
+    'value' => $version['server'],
+  );
+  return $form;
+}
+
+/**
  * Initialize a database connection.
  *
  * Note that you can change the pg_connect() call to pg_pconnect() if you
Index: includes/install.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/install.inc,v
retrieving revision 1.15
diff -u -F^f -r1.15 install.inc
--- includes/install.inc	18 Aug 2006 18:58:44 -0000	1.15
+++ includes/install.inc	26 Aug 2006 22:00:44 -0000
@@ -4,11 +4,9 @@
 define('SCHEMA_UNINSTALLED', -1);
 define('SCHEMA_INSTALLED', 0);
 
-define('DRUPAL_MINIMUM_PHP',    '4.3.3');
-define('DRUPAL_MINIMUM_MEMORY', '8M');
-define('DRUPAL_MINIMUM_MYSQL',  '3.23.17'); // If using MySQL
-define('DRUPAL_MINIMUM_PGSQL',  '7.3');  // If using PostgreSQL
-define('DRUPAL_MINIMUM_APACHE', '1.3');  // If using Apache
+define('REQUIREMENT_OK', 0);
+define('REQUIREMENT_WARNING', 1);
+define('REQUIREMENT_ERROR', 2);
 
 define('FILE_EXIST',          1);
 define('FILE_READABLE',       2);
@@ -128,7 +126,7 @@ function drupal_detect_baseurl($file = '
   $proto = $_SERVER['HTTPS'] ? 'https://' : 'http://';
   $host = $_SERVER['SERVER_NAME'];
   $port = ($_SERVER['SERVER_PORT'] == 80 ? '' : ':'. $_SERVER['SERVER_PORT']);
-  $uri = str_replace("?profile=$profile", '', $_SERVER['REQUEST_URI']);
+  $uri = preg_replace("/\?.*/", '', $_SERVER['REQUEST_URI']);
   $dir = str_replace("/$file", '', $uri);
 
   return "$proto$host$port$dir";
@@ -262,7 +260,7 @@ function drupal_verify_profile($profile)
   $profile_file = "./profiles/$profile/$profile.profile";
 
   if (!isset($profile) || !file_exists($profile_file)) {
-    _install_no_profile_error();
+    install_no_profile_error();
   }
 
   require_once($profile_file);
@@ -574,3 +572,72 @@ function _st(&$value, $key) {
     case '!':
   }
 }
+
+
+/**
+ * Check a profile's requirements.
+ *
+ * @param profile
+ *   Name of profile to check.
+ */
+function drupal_check_profile($profile) {
+  include_once './includes/file.inc';
+
+  $profile_file = "./profiles/$profile/$profile.profile";
+
+  if (!isset($profile) || !file_exists($profile_file)) {
+    install_no_profile_error();
+  }
+
+  require_once($profile_file);
+
+  // Get a list of modules required by this profile.
+  $function = $profile .'_profile_modules';
+  $module_list = array_unique(array_merge(array('system'), $function()));
+
+  // Get a list of all .install files.
+  $installs = drupal_get_install_files($module_list);
+
+  // Collect requirement testing results
+  $requirements = array();
+  foreach ($installs as $install) {
+    require_once $install->filename;
+    $requirements = array_merge($requirements, module_invoke($install->name, 'requirements', 'install'));
+  }
+  return $requirements;
+}
+
+/**
+ * Extract highest severity from requirements array.
+ */
+function drupal_requirements_severity(&$requirements) {
+  $severity = REQUIREMENT_OK;
+  foreach ($requirements as $requirement) {
+    if (isset($requirement['severity'])) {
+      $severity = max($severity, $requirement['severity']);
+    }
+  }
+  return $severity;
+}
+
+/**
+ * Check a module's requirements.
+ */
+function drupal_check_module($module) {
+  // Include install file
+  $install = drupal_get_install_files(array($module));
+  if (isset($install[$module])) {
+    require_once $install[$module]->filename;
+
+    // Check requirements
+    $requirements = module_invoke($module, 'requirements', 'install');
+    if (is_array($requirements) && drupal_requirements_severity($requirements) == REQUIREMENT_ERROR) {
+      // Print any error messages
+      foreach ($requirements as $requirement) {
+        if (isset($requirement['severity']) && $requirement['severity'] == REQUIREMENT_ERROR) {
+          drupal_set_message($requirement['description'] .' ('. t('Currently using @item %version', array('@item' => $requirement['title'], '%version' => $requirement['value'])) .')', 'error');
+        }
+      }
+    }
+  } 
+}
Index: includes/theme.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/theme.inc,v
retrieving revision 1.310
diff -u -F^f -r1.310 theme.inc
--- includes/theme.inc	22 Aug 2006 09:00:30 -0000	1.310
+++ includes/theme.inc	26 Aug 2006 22:00:47 -0000
@@ -449,16 +449,16 @@ function theme_install_page($content) {
     $output .= theme('status_messages', 'error');
   }
 
-  $output .= "\n<!-- begin content -->\n";
-  $output .= $content;
-  $output .= "\n<!-- end content -->\n";
-
   if (isset($messages['status'])) {
     $warnings = count($messages['status']) > 1 ? 'warnings' : 'warning';
     $output .= "<h4>The following installation $warnings should be carefully reviewed, but in most cases may be safely ignored:</h4>";
     $output .= theme('status_messages', 'status');
   }
 
+  $output .= "\n<!-- begin content -->\n";
+  $output .= $content;
+  $output .= "\n<!-- end content -->\n";
+
   $output .= '</body></html>';
 
   return $output;
Index: includes/unicode.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/unicode.inc,v
retrieving revision 1.19
diff -u -F^f -r1.19 unicode.inc
--- includes/unicode.inc	18 Aug 2006 12:16:57 -0000	1.19
+++ includes/unicode.inc	26 Aug 2006 22:00:47 -0000
@@ -9,7 +9,7 @@
  * Wrapper around _unicode_check().
  */
 function unicode_check() {
-  $GLOBALS['multibyte'] = _unicode_check();
+  list($GLOBALS['multibyte']) = _unicode_check();
 }
 
 /**
@@ -23,68 +23,70 @@ function unicode_check() {
  * @param $errors
  *   Whether to report any fatal errors with form_set_error().
  */
-function _unicode_check($errors = FALSE) {
+function _unicode_check() {
+  // Ensure translations don't break at install time
+  $t = function_exists('install_main') ? 'st' : 't';
+
   // Set the standard C locale to ensure consistent, ASCII-only string handling.
   setlocale(LC_CTYPE, 'C');
 
   // Check for outdated PCRE library
   // Note: we check if U+E2 is in the range U+E0 - U+E1. This test returns TRUE on old PCRE versions.
   if (preg_match('/[à-á]/u', 'â')) {
-    if ($errors) {
-      form_set_error('unicode', t('The PCRE library in your PHP installation is outdated. This will cause problems when handling Unicode text. If you are running PHP 4.3.3 or higher, make sure you are using the PCRE library supplied by PHP. Please refer to the <a href="@url">PHP PCRE documentation</a> for more information.', array('@url' => 'http://www.php.net/pcre')));
-    }
-    return UNICODE_ERROR;
+    return array(UNICODE_ERROR, $t('The PCRE library in your PHP installation is outdated. This will cause problems when handling Unicode text. If you are running PHP 4.3.3 or higher, make sure you are using the PCRE library supplied by PHP. Please refer to the <a href="@url">PHP PCRE documentation</a> for more information.', array('@url' => 'http://www.php.net/pcre')), REQUIREMENT_ERROR);
   }
 
   // Check for mbstring extension
-  if (!function_exists('mb_strlen')) {
-    return UNICODE_SINGLEBYTE;
+  if (1 || !function_exists('mb_strlen')) {
+    return array(UNICODE_SINGLEBYTE, $t('Operations on Unicode strings are emulated on a best-effort basis. Install the <a href="@url">PHP mbstring extension</a> for improved Unicode support.', array('@url' => 'http://www.php.net/mbstring')), REQUIREMENT_WARNING);
   }
 
   // Check mbstring configuration
   if (ini_get('mbstring.func_overload') != 0) {
-    if ($errors) {
-      form_set_error('unicode', t('Multibyte string function overloading in PHP is active and must be disabled. Check the php.ini <em>mbstring.func_overload</em> setting. Please refer to the <a href="@url">PHP mbstring documentation</a> for more information.', array('@url' => 'http://www.php.net/mbstring')));
-    }
-    return UNICODE_ERROR;
+    return array(UNICODE_ERROR, $t('Multibyte string function overloading in PHP is active and must be disabled. Check the php.ini <em>mbstring.func_overload</em> setting. Please refer to the <a href="@url">PHP mbstring documentation</a> for more information.', array('@url' => 'http://www.php.net/mbstring')), REQUIREMENT_ERROR);
   }
   if (ini_get('mbstring.encoding_translation') != 0) {
-    if ($errors) {
-      form_set_error('unicode', t('Multibyte string input conversion in PHP is active and must be disabled. Check the php.ini <em>mbstring.encoding_translation</em> setting. Please refer to the <a href="@url">PHP mbstring documentation</a> for more information.', array('@url' => 'http://www.php.net/mbstring')));
-    }
-    return UNICODE_ERROR;
+    return array(UNICODE_ERROR, $t('Multibyte string input conversion in PHP is active and must be disabled. Check the php.ini <em>mbstring.encoding_translation</em> setting. Please refer to the <a href="@url">PHP mbstring documentation</a> for more information.', array('@url' => 'http://www.php.net/mbstring')), REQUIREMENT_ERROR);
   }
   if (ini_get('mbstring.http_input') != 'pass') {
-    if ($errors) {
-      form_set_error('unicode', t('Multibyte string input conversion in PHP is active and must be disabled. Check the php.ini <em>mbstring.http_input</em> setting. Please refer to the <a href="@url">PHP mbstring documentation</a> for more information.', array('@url' => 'http://www.php.net/mbstring')));
-    }
-    return UNICODE_ERROR;
+    return array(UNICODE_ERROR, $t('Multibyte string input conversion in PHP is active and must be disabled. Check the php.ini <em>mbstring.http_input</em> setting. Please refer to the <a href="@url">PHP mbstring documentation</a> for more information.', array('@url' => 'http://www.php.net/mbstring')), REQUIREMENT_ERROR);
   }
   if (ini_get('mbstring.http_output') != 'pass') {
-    if ($errors) {
-      form_set_error('unicode', t('Multibyte string output conversion in PHP is active and must be disabled. Check the php.ini <em>mbstring.http_output</em> setting. Please refer to the <a href="@url">PHP mbstring documentation</a> for more information.', array('@url' => 'http://www.php.net/mbstring')));
-    }
-    return UNICODE_ERROR;
+    return array(UNICODE_ERROR, $t('Multibyte string output conversion in PHP is active and must be disabled. Check the php.ini <em>mbstring.http_output</em> setting. Please refer to the <a href="@url">PHP mbstring documentation</a> for more information.', array('@url' => 'http://www.php.net/mbstring')), REQUIREMENT_ERROR);
   }
 
   // Set appropriate configuration
   mb_internal_encoding('utf-8');
   mb_language('uni');
-  return UNICODE_MULTIBYTE;
+  return array(UNICODE_MULTIBYTE);
 }
 
 /**
- * Return the required Unicode status and errors for admin/settings.
+ * Return Unicode library status and errors.
  */
-function unicode_settings() {
-  $status = _unicode_check(TRUE);
-  $options = array(UNICODE_SINGLEBYTE => t('Standard PHP: operations on Unicode strings are emulated on a best-effort basis. Install the <a href="@url">PHP mbstring extension</a> for improved Unicode support.', array('@url' => 'http://www.php.net/mbstring')),
-                   UNICODE_MULTIBYTE => t('Multi-byte: operations on Unicode strings are supported through the <a href="@url">PHP mbstring extension</a>.', array('@url' => 'http://www.php.net/mbstring')),
-                   UNICODE_ERROR => t('Invalid: the current configuration is incompatible with Drupal.'));
-  $form['settings'] = array('#type' => 'item', '#title' => t('String handling method'), '#value' => $options[$status]);
-  return $form;
-}
+function unicode_requirements() {
+  // Ensure translations don't break at install time
+  $t = function_exists('install_main') ? 'st' : 't';
+
+  $libraries = array(
+    UNICODE_SINGLEBYTE => $t('Standard PHP'),
+    UNICODE_MULTIBYTE => $t('PHP Mbstring Extension'),
+    UNICODE_ERROR => $t('Error'),
+  );
+  list($library, $description, $severity) = _unicode_check();
 
+  $requirements['unicode'] = array(
+    'title' => $t('Unicode library'),
+    'value' => $libraries[$library],
+  );
+  if ($description) {
+    $requirements['unicode']['description'] = $description;
+    $requirements['unicode']['severity'] = $severity;
+  }
+
+  return $requirements;
+}
+ 
 /**
  * Prepare a new XML parser.
  *
Index: modules/system/admin.css
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/admin.css,v
retrieving revision 1.2
diff -u -F^f -r1.2 admin.css
--- modules/system/admin.css	17 Aug 2006 21:39:47 -0000	1.2
+++ modules/system/admin.css	26 Aug 2006 22:01:02 -0000
@@ -49,3 +49,28 @@
   margin-right: 1em;
   padding-right: 4px;
 }
+
+/**
+ * Formatting for status report
+ */
+table.system-status-report th {
+  border-bottom: 1px solid #ccc;
+}
+table.system-status-report th, table.system-status-report tr.merge-up td {
+  padding-left: 30px;
+}
+table.system-status-report th  {
+  background-repeat: no-repeat;
+  background-position: 5px 50%;
+  padding-top: 6px;
+  padding-bottom: 6px;
+}
+table.system-status-report tr.ok th {
+  background-image: url('../../misc/watchdog-ok.png');
+}
+table.system-status-report tr.error th {
+  background-image: url('../../misc/watchdog-error.png');
+}
+table.system-status-report tr.warning th {
+  background-image: url('../../misc/watchdog-warning.png');
+}
Index: modules/system/system.css
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.css,v
retrieving revision 1.5
diff -u -F^f -r1.5 system.css
--- modules/system/system.css	21 Aug 2006 07:33:26 -0000	1.5
+++ modules/system/system.css	26 Aug 2006 22:01:03 -0000
@@ -36,7 +36,20 @@
   display: inline;
 }
 .error {
-  color: red;
+  color: #f00;
+}
+div.error {
+  border: 1px solid #d77;
+}
+div.error, tr.error {
+  background: #fcc;
+  color: #200;
+}
+div.warning, tr.warning {
+  background: #ffd;
+}
+div.ok, tr.ok {
+  background: #dfd;
 }
 .item-list .icon {
   color: #555;
@@ -73,6 +86,12 @@
   margin-bottom: 0;
   white-space: nowrap;
 }
+tr.merge-down, tr.merge-down td, tr.merge-down th {
+  border-bottom-width: 0 !important;
+}
+tr.merge-up, tr.merge-up td, tr.merge-up th {
+  border-top-width: 0 !important;
+}
 .form-item input.error, .form-item textarea.error {
   border: 2px solid red;
 }
@@ -100,9 +119,6 @@
 .nowrap {
   white-space: nowrap;
 }
-.ok {
-  color: #080;
-}
 #pager {
   clear: both;
   text-align: center;
Index: modules/system/system.install
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.install,v
retrieving revision 1.10
diff -u -F^f -r1.10 system.install
--- modules/system/system.install	22 Aug 2006 07:43:33 -0000	1.10
+++ modules/system/system.install	26 Aug 2006 22:01:04 -0000
@@ -1,6 +1,131 @@
 <?php
 // $Id: system.install,v 1.10 2006/08/22 07:43:33 dries Exp $
 
+define('DRUPAL_MINIMUM_PHP',    '4.3.3');
+define('DRUPAL_MINIMUM_MEMORY', '8M');
+define('DRUPAL_MINIMUM_MYSQL',  '3.23.17'); // If using MySQL
+define('DRUPAL_MINIMUM_PGSQL',  '7.3');  // If using PostgreSQL
+define('DRUPAL_MINIMUM_APACHE', '1.3');  // If using Apache
+
+/**
+ * Test and report Drupal installation requirements.
+ */
+function system_requirements($phase) {
+  $requirements = array();
+  // Ensure translations don't break at install time
+  $t = function_exists('t') ? 't' : 'st';
+
+  // Report Drupal version
+  if ($phase == 'runtime') {
+    $requirements['drupal'] = array(
+      'title' => $t('Drupal'),
+      'value' => check_plain(VERSION),
+    );
+  }
+
+  // Test web server
+  $requirements['webserver'] = array(
+    'title' => $t('Web server'),
+  );
+  // Use server info string, if present.
+  if (isset($_SERVER['SERVER_SOFTWARE'])) {
+    $requirements['webserver']['value'] = $_SERVER['SERVER_SOFTWARE'];
+
+    list($server, $version) = split('[ /]', $_SERVER['SERVER_SOFTWARE']);
+    switch ($server) {
+      case 'Apache':
+        if (version_compare($version, DRUPAL_MINIMUM_APACHE) < 0) {
+          $requirements['webserver']['description'] = $t('Your Apache server is too old. Drupal requires at least Apache %version.', array('%version' => DRUPAL_MINIMUM_APACHE));
+          $requirements['webserver']['severity'] = REQUIREMENT_ERROR;
+        }
+        break;
+
+      default:
+        $requirements['webserver']['description'] = $t('The web server you\'re using has not been tested with Drupal and might not work properly.');
+        $requirements['webserver']['severity'] = REQUIREMENT_WARNING;
+        break;
+    }
+  }
+  else {
+    $requirements['webserver']['value'] = $t('Unknown');
+    $requirements['webserver']['description'] = $t('Unable to determine your web server type. Drupal might not work properly.');
+    $requirements['webserver']['severity'] = REQUIREMENT_WARNING;
+  }
+
+  // Test PHP version
+  $requirements['php'] = array(
+    'title' => $t('PHP'),
+    'value' => check_plain(phpversion()),
+  );
+  if (version_compare(phpversion(), DRUPAL_MINIMUM_PHP) < 0) {
+    $requirements['php']['description'] = $t('Your PHP installation is too old. Drupal requires at least PHP %version.', array('%version' => DRUPAL_MINIMUM_PHP));
+    $requirements['php']['severity'] = REQUIREMENT_ERROR;
+  }
+
+  // Show DB version
+  global $db_type;
+  if (function_exists('db_status_report')) {
+    $requirements += db_status_report();    
+  }
+
+  // Test PHP memory limit
+  $memory = ini_get('memory_limit');
+  $requirements['memory'] = array(
+    'title' => $t('Memory limit'),
+    'value' => $memory ? trim($memory) : $t('Unlimited')
+  );
+  $suffixes = array('g' => 1024 * 1024 * 1024, 'm' => 1024 * 1024, 'k' => 1024);
+  $suffix = $suffixes[strtolower($memory{strlen($memory) - 1})];
+  if ($memory && $memory * $suffix < DRUPAL_MINIMUM_MEMORY) {
+    $requirements['memory']['severity'] = REQUIREMENT_ERROR;
+    $requirements['memory']['description'] = $t('Your PHP installation is configured with a memory limit that is too low. Drupal requires at least %size of memory.', array('%size' => ini_get('memory_limit')));
+  }
+
+  // Test settings.php file writability
+  if ($phase == 'runtime') {
+    if (!drupal_verify_install_file(conf_path() .'/settings.php', FILE_EXIST|FILE_READABLE|FILE_NOT_WRITABLE)) {
+      $requirements['settings.php'] = array(
+        'value' => $t('Not protected'),
+        'severity' => REQUIREMENT_ERROR,
+        'description' => $t('The file %file is not protected from modifications and poses a security risk. You must change the file\'s permissions to be non-writable.', array('%file' => conf_path() .'/settings.php')),
+      );
+    }
+    else {
+      $requirements['settings.php'] = array(
+        'value' => $t('Protected'),
+      );      
+    }
+    $requirements['settings.php']['title'] = $t('Configuration file');   
+  }
+
+  // Report Cron status
+  if ($phase == 'runtime') {
+    $cron_last = variable_get('cron_last', NULL);
+
+    if (is_numeric($cron_last)) {
+      $requirements['cron']['value'] = $t('Last run !time ago', array('!time' => format_interval(time() - $cron_last)));
+    }
+    else {
+      $requirements['cron'] = array(
+        'description' => $t('Cron has not run. It appears cron jobs have not been setup on your system. Please check the help pages for <a href="@url">configuring cron jobs</a>.', array('@url' => 'http://drupal.org/cron')) .'<br />',
+        'severity' => REQUIREMENT_ERROR,
+        'value' => $t('Never run.'),
+      );
+    }
+
+    $requirements['cron']['description'] .= t('Cron can, if necessary, also be run <a href="@cron">manually</a>.', array('@cron' => url('admin/logs/status/run-cron')));
+
+    $requirements['cron']['title'] = $t('Cron maintenance tasks');
+  }
+
+  // Test Unicode library
+  include_once './includes/unicode.inc';
+  $requirements = array_merge($requirements, unicode_requirements());
+  
+  return $requirements;
+}
+
+
 function system_install() {
   switch ($GLOBALS['db_type']) {
     case 'mysql':
Index: modules/system/system.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.module,v
retrieving revision 1.348
diff -u -F^f -r1.348 system.module
--- modules/system/system.module	20 Aug 2006 05:57:40 -0000	1.348
+++ modules/system/system.module	26 Aug 2006 22:01:06 -0000
@@ -27,7 +27,7 @@ function system_help($section) {
 <li><a href="@cron-status">view</a> whether or not cron is running on your site.</li>
 <li>run cron <a href="@cron-manually">manually</a>.</li>
 </ul>
-', 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')));
+', array('@file-cron' => 'cron.php', '@external-http-drupal-org-cron' => 'http://drupal.org/cron', '@cron-status' => url('admin/logs/status'), '@cron-manually' => url('admin/logs/status/run-cron'), '@admin-settings' => url('admin/settings/page-caching')));
       $output .= '<p>'. t('For more information please read the configuration and customization handbook <a href="@system">System page</a>.', array('@system' => 'http://drupal.org/handbook/modules/system/')) .'</p>';
       return $output;
     case 'admin/settings/modules#description':
@@ -45,6 +45,8 @@ function system_help($section) {
     case 'admin/settings/modules':
       return t('<p>Modules are plugins for Drupal that extend its core functionality. Here you can select which modules are enabled. Click on the name of the module in the navigation menu for their individual configuration pages. Once a module is enabled, new <a href="@permissions">permissions</a> might be made available. Modules can automatically be temporarily disabled to reduce server load when your site becomes extremely busy by enabling the throttle.module and checking throttle. The auto-throttle functionality must be enabled on the <a href="@throttle">throttle configuration page</a> after having enabled the throttle module.</p>
 <p>It is important that <a href="@update-php">update.php</a> is run every time a module is updated to a newer version.</p>', array('@permissions' => url('admin/user/access'), '@throttle' => url('admin/settings/throttle'), '@update-php' => $base_url .'/update.php'));
+    case 'admin/logs/status':
+      return t('<p>Here you can find a short overview of your Drupal site\'s parameters as well as any problems detected with your installation. It is useful for example to copy/paste this information when you need support.</p>');
   }
 }
 
@@ -233,28 +235,39 @@ function system_menu($may_cache) {
       'callback' => 'drupal_get_form',
       'callback arguments' => array('system_date_time_settings'));
     $items[] = array(
-      'path' => 'admin/settings/site-status',
-      'title' => t('site status'),
+      'path' => 'admin/settings/site-maintenance',
+      'title' => t('site maintenance'),
       'description' => t('Take the site off-line for maintenance or bring it back online.'),
       'callback' => 'drupal_get_form',
-      'callback arguments' => array('system_site_status_settings'));
-    $items[] = array(
-      'path' => 'admin/settings/unicode',
-      'title' => t('unicode'),
-      'description' => t('Unicode string handling settings.'),
-      'callback' => 'drupal_get_form',
-      'callback arguments' => array('system_unicode_settings'));
-    $items[] = array(
-      'path' => 'admin/settings/cron-status',
-      'title' => t('cron status'),
-      'description' => t('Check cron status or run cron manually.'),
-      'callback' => 'system_cron_status');
+      'callback arguments' => array('system_site_maintenance_settings'));
     $items[] = array(
       'path' => 'admin/settings/clean-urls',
       'title' => t('clean URLs'),
       'description' => t('Enable or disable clean URLs for your site.'),
       'callback' => 'drupal_get_form',
       'callback arguments' => array('system_clean_url_settings'));
+
+
+    // Logs:
+    $items[] = array(
+      'path' => 'admin/logs',
+      'title' => t('logs'),
+      'description' => t('View system logs and other status information.'),
+      'callback' => 'system_admin_menu_block_page',
+      'weight' => 5,
+      'position' => 'left');
+    $items[] = array(
+      'path' => 'admin/logs/status',
+      'title' => t('status report'),
+      'description' => t('Get a status report about your site\'s operation and any detected problems.'),
+      'callback' => 'system_status',
+      'weight' => -11,
+      'access' => $access);
+    $items[] = array(
+      'path' => 'admin/logs/status/run-cron',
+      'title' => t('run cron'),
+      'callback' => 'system_run_cron',
+      'type' => MENU_CALLBACK);
   }
   else {
     /**
@@ -308,6 +321,12 @@ function system_main_admin_page($arg = N
     return drupal_not_found();
   }
 
+  // Check for status report errors.
+  if (system_status(TRUE)) {
+    drupal_set_message(t('One or more problems were detected with your Drupal installation. Check the <a href="@status">status report</a> for more information.', array('@status' => url('admin/logs/status'))), 'error');
+  }
+
+
   $menu = menu_get_item(NULL, 'admin');
   usort($menu['children'], '_menu_sort');
   foreach ($menu['children'] as $mid) {
@@ -754,11 +773,11 @@ function system_date_time_settings() {
   return system_settings_form($form);
 }
 
-function system_site_status_settings() {
+function system_site_maintenance_settings() {
 
   $form['site_offline'] = array(
     '#type' => 'radios',
-    '#title' => t('Site status'),
+    '#title' => t('Site maintenance'),
     '#default_value' => variable_get('site_offline', 0),
     '#options' => array(t('Online'), t('Off-line')),
     '#description' => t('When set to "Online", all visitors will be able to browse your site normally. When set to "Off-line", only users with the "administer site configuration" permission will be able to access your site to perform maintenance; all other visitors will see the site off-line message configured below. Authorized users can log in during "Off-line" mode directly via the <a href="@user-login">user login</a> page.', array('@user-login' => url('user'))),
@@ -774,35 +793,6 @@ function system_site_status_settings() {
   return system_settings_form($form);
 }
 
-function system_unicode_settings() {
-  $form = unicode_settings();
-  return system_settings_form($form);
-}
-
-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 <a href="@url">configuring cron jobs</a>.', array('@url' => 'http://drupal.org/cron'));
-  }
-  $status .= ' '. t('Cron can, if necessary, also be run <a href="%cron">manually</a>.', array('%cron' => url('admin/settings/cron-status/cron')));
-
-  return $status;
-}
-
 /**
  * Checks the existence of the directory specified in $form_element. This
  * function is called from the system_settings form to check both the
@@ -1273,6 +1263,8 @@ function theme_system_modules($form) {
 function system_modules_submit($form_id, $edit) {
   include_once './includes/install.inc';
   $new_modules = array();
+
+  // Enable/disable modules that have already been installed
   foreach ($edit['status'] as $key => $choice) {
     if ($choice) {
       if (drupal_get_installed_schema_version($key) == SCHEMA_UNINSTALLED) {
@@ -1289,8 +1281,11 @@ function system_modules_submit($form_id,
 
   module_list(TRUE, FALSE);
 
+  // Install new modules
   foreach ($new_modules as $module) {
-    drupal_install_module($module);
+    if (drupal_check_module($module)) {
+      drupal_install_module($module);
+    }
   }
 
   if (is_array($edit['throttle'])) {
@@ -1308,6 +1303,72 @@ function system_modules_submit($form_id,
   return 'admin/settings/modules';
 }
 
+/**
+ * Menu callback: run cron manually
+ */
+function system_run_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/logs/status');
+}
+
+/**
+ * Menu callback: displays the site status report. Can also be used as a pure check.
+ *
+ * @param $check
+ *   If true, only returns a boolean whether there are system status errors.
+ */
+function system_status($check = FALSE) {
+  // Load .install files
+  include_once './includes/install.inc';
+  drupal_load_updates();
+
+  // Check run-time requirements and status information
+  $requirements = module_invoke_all('requirements', 'runtime');
+
+  if ($check) {
+    return drupal_requirements_severity($requirements) == REQUIREMENT_ERROR;
+  }
+
+  return theme('status_report', $requirements);
+}
+
+/**
+ * Theme status report
+ */
+function theme_status_report(&$requirements) {
+  $output = '<table class="system-status-report">';
+  foreach ($requirements as $requirement) {
+    if ($requirement['#type'] == '') {
+      $class = $i % 2 == 0 ? 'even' : 'odd';
+
+      $classes = array(
+        REQUIREMENT_OK => 'ok',
+        REQUIREMENT_WARNING => 'warning',
+        REQUIREMENT_ERROR => 'error',
+      );
+      $class = $classes[(int)$requirement['severity']] .' '. $class;
+
+      // Output table row(s)
+      if ($requirement['description']) {
+        $output .= '<tr class="'. $class .' merge-down"><th>'. $requirement['title'] .'</th><td>'. check_plain($requirement['value']) .'</td></tr>';
+        $output .= '<tr class="'. $class .' merge-up"><td colspan="2">'. $requirement['description'] .'</td></tr>';
+      }
+      else {
+        $output .= '<tr class="'. $class .'"><th>'. $requirement['title'] .'</th><td>'. check_plain($requirement['value']) .'</td></tr>';        
+      }
+    }
+  }
+
+  $output .= '</table>';
+  return $output;
+}
 
 /**
  * Menu callback; displays a module's settings page.
Index: modules/watchdog/watchdog.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/watchdog/watchdog.module,v
retrieving revision 1.150
diff -u -F^f -r1.150 watchdog.module
--- modules/watchdog/watchdog.module	18 Aug 2006 18:58:47 -0000	1.150
+++ modules/watchdog/watchdog.module	26 Aug 2006 22:01:10 -0000
@@ -42,11 +42,6 @@ function watchdog_menu($may_cache) {
   $items = array();
 
   if ($may_cache) {
-    $items[] = array('path' => 'admin/logs', 'title' => t('logs'),
-      'description' => t('View system logs and other status information.'),
-      'callback' => 'system_admin_menu_block_page',
-      'weight' => 5,
-      'position' => 'left');
     $items[] = array('path' => 'admin/logs/watchdog', 'title' => t('watchdog log'),
       'description' => t('View the primary system log.'),
       'weight' => -10,
