diff --git a/core/lib/Drupal/Core/Database/Install/Tasks.php b/core/lib/Drupal/Core/Database/Install/Tasks.php index c4d88d2..b00ecb2 100644 --- a/core/lib/Drupal/Core/Database/Install/Tasks.php +++ b/core/lib/Drupal/Core/Database/Install/Tasks.php @@ -154,7 +154,7 @@ public function runTasks() { } } if (!empty($message)) { - $message = '

In order for Drupal to work, and to continue with the installation process, you must resolve all issues reported below. For more help with configuring your database server, see the installation handbook. If you are unsure what any of this means you should probably contact your hosting provider.

' . $message; + $message = t('

In order for Drupal to work, and to continue with the installation process, you must resolve all issues reported below. For more help with configuring your database server, see the installation handbook. If you are unsure what any of this means you should probably contact your hosting provider.

!message', array('@url' => 'http://drupal.org/getting-started/install', '!message' => $message)); throw new TaskException($message); } } diff --git a/core/modules/system/system.install b/core/modules/system/system.install index 4c94516..a87cd87 100644 --- a/core/modules/system/system.install +++ b/core/modules/system/system.install @@ -107,15 +107,19 @@ function system_requirements($phase) { } if (!empty($missing_extensions)) { - $description = t('Drupal requires you to enable the PHP extensions in the following list (see the system requirements page for more information):', array( - '@system_requirements' => 'http://drupal.org/requirements', - )); - $item_list = array( '#theme' => 'item_list', '#items' => $missing_extensions, ); - $description .= drupal_render($item_list); + + $description = array( + '#type' => 'inline_template', + '#template' => '{% trans %}Drupal requires you to enable the PHP extensions in the following list (see the system requirements page for more information):{% endtrans %} {{ item_list }}', + '#context' => array( + 'system_requirements' => 'http://drupal.org/requirements', + 'item_list' => drupal_render($item_list), + ), + ); $requirements['php_extensions']['value'] = t('Disabled'); $requirements['php_extensions']['severity'] = REQUIREMENT_ERROR; @@ -188,26 +192,32 @@ function system_requirements($phase) { ); if (!Environment::checkMemoryLimit(DRUPAL_MINIMUM_PHP_MEMORY_LIMIT, $memory_limit)) { - $description = ''; - if ($phase == 'install') { - $description = t('Consider increasing your PHP memory limit to %memory_minimum_limit to help prevent errors in the installation process.', array('%memory_minimum_limit' => DRUPAL_MINIMUM_PHP_MEMORY_LIMIT)); - } - elseif ($phase == 'update') { - $description = t('Consider increasing your PHP memory limit to %memory_minimum_limit to help prevent errors in the update process.', array('%memory_minimum_limit' => DRUPAL_MINIMUM_PHP_MEMORY_LIMIT)); - } - elseif ($phase == 'runtime') { - $description = t('Depending on your configuration, Drupal can run with a %memory_limit PHP memory limit. However, a %memory_minimum_limit PHP memory limit or above is recommended, especially if your site uses additional custom or contributed modules.', array('%memory_limit' => $memory_limit, '%memory_minimum_limit' => DRUPAL_MINIMUM_PHP_MEMORY_LIMIT)); - } - - if (!empty($description)) { - if ($php_ini_path = get_cfg_var('cfg_file_path')) { - $description .= ' ' . t('Increase the memory limit by editing the memory_limit parameter in the file %configuration-file and then restart your web server (or contact your system administrator or hosting provider for assistance).', array('%configuration-file' => $php_ini_path)); - } - else { - $description .= ' ' . t('Contact your system administrator or hosting provider for assistance with increasing your PHP memory limit.'); - } + if ($phase == 'install' || $phase == 'update' || $phase == 'runtime') { + $description = array( + '#type' => 'inline_template', + '#template' => "{% if phase == 'install' %} + {% trans %}Consider increasing your PHP memory limit to {{ memory_minimum_limit|placeholder }} to help prevent errors in the installation process.{% endtrans %} + {% elseif phase == 'update' %} + {% trans %}Consider increasing your PHP memory limit to {{ memory_minimum_limit|placeholder }} to help prevent errors in the update process.{% endtrans %} + {% elseif phase == 'runtime' %} + {% trans %}Depending on your configuration, Drupal can run with a {{ memory_limit|placeholder }} PHP memory limit. However, a {{ memory_minimum_limit|placeholder }} PHP memory limit or above is recommended, especially if your site uses additional custom or contributed modules.{% endtrans %} + {% endif %} + {% if configuration_file %} + {% trans %}Increase the memory limit by editing the memory_limit parameter in the file {{ configuration_file|placeholder }} and then restart your web server (or contact your system administrator or hosting provider for assistance).{% endtrans %} + {% else %} + {% trans %}Contact your system administrator or hosting provider for assistance with increasing your PHP memory limit.{% endtrans %} + {% endif %} + {% trans %}For more information, see the online handbook entry for increasing the PHP memory limit.{% endtrans %}", + '#context' => array( + 'phase' => $phase, + 'memory_minimum_limit' => DRUPAL_MINIMUM_PHP_MEMORY_LIMIT, + 'memory_limit' => $memory_limit, + 'configuration_file' => get_cfg_var('cfg_file_path'), + 'memory_limit_url' => 'http://drupal.org/node/207036', + ), + ); - $requirements['php_memory_limit']['description'] = $description . ' ' . t('For more information, see the online handbook entry for increasing the PHP memory limit.', array('@memory-limit' => 'http://drupal.org/node/207036')); + $requirements['php_memory_limit']['description'] = $description; $requirements['php_memory_limit']['severity'] = REQUIREMENT_WARNING; } } @@ -385,7 +395,8 @@ function system_requirements($phase) { 'title' => t('File system'), ); - $error = ''; + $error_dirs = array(); + // For installer, create the directories if possible. foreach ($directories as $directory) { if (!$directory) { @@ -396,39 +407,64 @@ function system_requirements($phase) { } $is_writable = is_writable($directory); $is_directory = is_dir($directory); + if (!$is_writable || !$is_directory) { - $description = ''; - $requirements['file system']['value'] = t('Not writable'); - if (!$is_directory) { - $error .= t('The directory %directory does not exist.', array('%directory' => $directory)) . ' '; - } - else { - $error .= t('The directory %directory is not writable.', array('%directory' => $directory)) . ' '; - } - // The files directory requirement check is done only during install and runtime. - if ($phase == 'runtime') { - $description = $error . t('You may need to set the correct directory at the file system settings page or change the current directory\'s permissions so that it is writable.', array('@admin-file-system' => url('admin/config/media/file-system'))); - } - elseif ($phase == 'install') { - // For the installer UI, we need different wording. 'value' will - // be treated as version, so provide none there. - $description = $error . t('An automated attempt to create this directory failed, possibly due to a permissions problem. To proceed with the installation, either create the directory and modify its permissions manually or ensure that the installer has the permissions to create it automatically. For more information, see INSTALL.txt or the online handbook.', array('@handbook_url' => 'http://drupal.org/server-permissions')); - $requirements['file system']['value'] = ''; - } - if (!empty($description)) { - $requirements['file system']['description'] = $description; - $requirements['file system']['severity'] = REQUIREMENT_ERROR; - } + $error_dirs[$directory]['is_writable'] = $is_writable; + $error_dirs[$directory]['is_directory'] = $is_directory; + $error_dirs[$directory]['directory'] = $directory; + } + + } + + if (!empty($error_dirs)) { + $requirements['file system']['value'] = t('Not writable'); + + if ($phase == 'install') { + // For the installer UI, we need different wording. 'value' will + // be treated as version, so provide none there. + $requirements['file system']['value'] = ''; + } + + $requirements['file system']['severity'] = REQUIREMENT_ERROR; + + $requirements['file system']['description'] = array( + '#type' => 'inline_template', + '#template' => "{% for directory in directories %} + {% if not directory.is_directory %} + {% trans %} + The directory {{ directory.directory|placeholder }} does not exist. + {% endtrans %} + {% else %} + {% trans %} + The directory {{ directory.directory|placeholder }} is not writable. + {% endtrans %} + {% endif %} + {% endfor %} + {% if phase == 'runtime' %} + {% trans %} + You may need to set the correct directory at the file system settings page or change the current directory's permissions so that it is writable. + {% endtrans %} + {% elseif phase == 'install' %} + {% trans %} + An automated attempt to create this directory failed, possibly due to a permissions problem. To proceed with the installation, either create the directory and modify its permissions manually or ensure that the installer has the permissions to create it automatically. For more information, see INSTALL.txt or the online handbook. + {% endtrans %} + {% endif %}", + '#context' => array( + 'directories' => $error_dirs, + 'phase' => $phase, + 'file_settings_url' => url('system.file_system_settings'), + 'handbook_url' => 'http://drupal.org/server-permissions', + ), + ); + } + else { + // This function can be called before the config_cache table has been + // created. + if ($phase == 'install' || file_default_scheme() == 'public') { + $requirements['file system']['value'] = t('Writable (public download method)'); } else { - // This function can be called before the config_cache table has been - // created. - if ($phase == 'install' || file_default_scheme() == 'public') { - $requirements['file system']['value'] = t('Writable (public download method)'); - } - else { - $requirements['file system']['value'] = t('Writable (private download method)'); - } + $requirements['file system']['value'] = t('Writable (private download method)'); } }