From 2934e7834aea1093179f6fbdd715e8b15f3d5e21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A1bor=20Hojtsy?= Date: Thu, 15 Nov 2007 23:12:38 +0000 Subject: #191310 by JirkaRybka, keith.smith: ship with a files directory by default and improve installation error messages checking for all requirements on the same screen, instead of putting the user through individual error screens --- modules/system/system.install | 56 ++++++++++++++++++++++--------------------- 1 file changed, 29 insertions(+), 27 deletions(-) (limited to 'modules/system/system.install') diff --git a/modules/system/system.install b/modules/system/system.install index 625c2e671..f51c2e54c 100644 --- a/modules/system/system.install +++ b/modules/system/system.install @@ -111,37 +111,39 @@ function system_requirements($phase) { } // Test files directory - if ($phase == 'runtime') { - $directory = file_directory_path(); - $is_writable = is_writable($directory); - $is_directory = is_dir($directory); - if (!$is_writable || !$is_directory) { - 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)); - } - $requirements['file system'] = array( - 'value' => $t('Not writable'), - 'severity' => REQUIREMENT_ERROR, - '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/settings/file-system'))), - ); + $directory = file_directory_path(); + $is_writable = is_writable($directory); + $is_directory = is_dir($directory); + if (!$is_writable || !$is_directory) { + if (!$is_directory) { + $error = $t('The directory %directory does not exist.', array('%directory' => $directory)); } else { - if (variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC) == FILE_DOWNLOADS_PUBLIC) { - $requirements['file system'] = array( - 'value' => $t('Writable (public download method)'), - ); - } - else { - $requirements['file system'] = array( - 'value' => $t('Writable (private download method)'), - ); - } + $error = $t('The directory %directory is not writable.', array('%directory' => $directory)); + } + $requirements['file system'] = array( + 'value' => $t('Not writable'), + 'severity' => REQUIREMENT_ERROR, + ); + if ($phase == 'runtime') { + $requirements['file system']['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/settings/file-system'))); + } + else if ($phase == 'install') { + // For the installer UI, we need different wording. 'value' will + // be treated as version, so provide none there. + $requirements['file system']['description'] = $error .' '. $t('To proceed with the installation, please change the %directory directory permissions to allow the installer to write to it. If you are unsure how to do so, please consult the on-line handbook.', array('%directory' => $directory, '@handbook_url' => 'http://drupal.org/getting-started')); + $requirements['file system']['value'] = ''; + } + } + else { + if (variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC) == FILE_DOWNLOADS_PUBLIC) { + $requirements['file system']['value'] = $t('Writable (public download method)'); + } + else { + $requirements['file system']['value'] = $t('Writable (private download method)'); } - $requirements['file system']['title'] = $t('File system'); } + $requirements['file system']['title'] = $t('File system'); // See if updates are available in update.php. if ($phase == 'runtime') { -- cgit v1.2.3