diff options
author | Gábor Hojtsy <gabor@hojtsy.hu> | 2007-12-27 17:25:28 +0000 |
---|---|---|
committer | Gábor Hojtsy <gabor@hojtsy.hu> | 2007-12-27 17:25:28 +0000 |
commit | 9b2bf38e836632e0395cd2673fc397dfcccc4630 (patch) | |
tree | 5b8663b007981de0df34ac7aafe240ff144345be | |
parent | 79d927f7aa76dc0b0eaf103d5e7bfb9072247b47 (diff) | |
download | brdo-9b2bf38e836632e0395cd2673fc397dfcccc4630.tar.gz brdo-9b2bf38e836632e0395cd2673fc397dfcccc4630.tar.bz2 |
#194369 by lots of contributors: move default files directory to sites/default/files which can be created automatically on install, so no need to bug the user about it, making the install process easier
-rw-r--r-- | INSTALL.txt | 44 | ||||
-rw-r--r-- | includes/file.inc | 2 | ||||
-rw-r--r-- | install.php | 36 | ||||
-rw-r--r-- | modules/system/system.install | 8 |
4 files changed, 46 insertions, 44 deletions
diff --git a/INSTALL.txt b/INSTALL.txt index d914a6ea5..b4f3cfcf3 100644 --- a/INSTALL.txt +++ b/INSTALL.txt @@ -83,18 +83,7 @@ INSTALLATION chmod o+w sites/default -3. CREATE AND GRANT WRITE PERMISSIONS TO FILES DIRECTORY - - Drupal requires the files directory be present and writable during - the installation (the location of the files directory can be changed - after Drupal is installed). Use the following commands (from the - installation directory) to create this directory and grant the - web server write privileges to it: - - mkdir files - chmod o+w files - -4. CREATE THE DRUPAL DATABASE +3. CREATE THE DRUPAL DATABASE Drupal requires access to a database in order to be installed. Your database user will need sufficient privileges to run Drupal. Additional information @@ -108,7 +97,7 @@ INSTALLATION Take note of the username, password, database name and hostname as you create the database. You will enter these items in the install script. -5. RUN THE INSTALL SCRIPT +4. RUN THE INSTALL SCRIPT To run the install script point your browser to the base URL of your website (i.e. http://www.example.com). @@ -117,6 +106,16 @@ INSTALLATION create tables, add the first user account and provide basic web site settings. + The install script will attempt to create a files storage directory + in the default location at sites/default/files (the location of the + files directory may be changed after Drupal is installed). In some + cases, you may need to create the directory and modify its permissions + manually. Use the following commands (from the installation directory) + to create the files directory and grant the web server write privileges to it: + + mkdir sites/default/files + chmod o+w sites/default/files + The install script will attempt to write-protect the sites/default directory after creating the settings.php file. If you make manual changes to that file later, be sure to protect it again after making @@ -125,7 +124,7 @@ INSTALLATION file is at sites/default/settings.php, it may be in another location if you use the multi-site setup, as explained below. -6. CONFIGURE DRUPAL +5. CONFIGURE DRUPAL When the install script succeeds, you will be directed to the "Welcome" page, and you will be logged in as the administrator already. Proceed with @@ -137,9 +136,9 @@ INSTALLATION running FastCGI can run into problems if the $base_url variable is left commented out (see http://bugs.php.net/bug.php?id=19656). -7. REVIEW FILE SYSTEM STORAGE SETTINGS +6. REVIEW FILE SYSTEM STORAGE SETTINGS - The files directory created in step 3 is the default file system path used + The files directory created in step 4 is the default file system path used to store all uploaded files, as well as some temporary files created by Drupal. After installation, the settings for the file system path may be modified to store uploaded files in a different location. @@ -148,16 +147,11 @@ INSTALLATION * your site runs multiple Drupal installations from a single codebase (modify the file system path of each installation to a different - directory so that uploads do not overlap between installations); + directory so that uploads do not overlap between installations); or, * your site runs a number of web server front-ends behind a load balancer or reverse proxy (modify the file system path on each - server to point to a shared file repository); or, - - * your site policies specify that all site-related files are stored - under the sites directory in order to simplify backup and restore - operations (modify the file system path to point to a newly-created - directory underneath sites). + server to point to a shared file repository). To modify the file system path: @@ -188,7 +182,7 @@ INSTALLATION on an existing site, remember to copy all files from the original location to the new location. -8. CRON MAINTENANCE TASKS +7. CRON MAINTENANCE TASKS Many Drupal modules have periodic tasks that must be triggered by a cron maintenance task, including search module (to build and update the index @@ -297,7 +291,7 @@ NOTE: for more information about multiple virtual hosts or the configuration settings, consult the Drupal handbook at drupal.org. For more information on configuring Drupal's file system path in a multi-site -configuration, see files/README.txt. +configuration, see step 6 above. MORE INFORMATION ---------------- diff --git a/includes/file.inc b/includes/file.inc index 452ffec1f..384bd1ef4 100644 --- a/includes/file.inc +++ b/includes/file.inc @@ -959,7 +959,7 @@ function file_directory_temp() { * @return A string containing the path to Drupal's 'files' directory. */ function file_directory_path() { - return variable_get('file_directory_path', 'files'); + return variable_get('file_directory_path', 'sites/default/files'); } /** diff --git a/install.php b/install.php index d0c7dd925..70087c883 100644 --- a/install.php +++ b/install.php @@ -858,24 +858,8 @@ function install_reserved_tasks() { * Check installation requirements and report any errors. */ function install_check_requirements($profile, $verify) { - $requirements = drupal_check_profile($profile); - $severity = drupal_requirements_severity($requirements); - - // If there are issues, report them. - if ($severity == REQUIREMENT_ERROR) { - foreach ($requirements as $requirement) { - if (isset($requirement['severity']) && $requirement['severity'] == REQUIREMENT_ERROR) { - $message = $requirement['description']; - if (isset($requirement['value']) && $requirement['value']) { - $message .= ' ('. st('Currently using !item !version', array('!item' => $requirement['title'], '!version' => $requirement['value'])) .')'; - } - drupal_set_message($message, 'error'); - } - } - } - - // If Drupal is not set up already, we also need to create a settings file. + // If Drupal is not set up already, we need to create a settings file. if (!$verify) { $writable = FALSE; $conf_path = './'. conf_path(); @@ -899,6 +883,24 @@ function install_check_requirements($profile, $verify) { drupal_set_message(st('The @drupal installer requires write permissions to %file during the installation process. If you are unsure how to grant file permissions, please consult the <a href="@handbook_url">on-line handbook</a>.', array('@drupal' => drupal_install_profile_name(), '%file' => $file, '@handbook_url' => 'http://drupal.org/server-permissions')), 'error'); } } + + // Check the other requirements. + $requirements = drupal_check_profile($profile); + $severity = drupal_requirements_severity($requirements); + + // If there are issues, report them. + if ($severity == REQUIREMENT_ERROR) { + + foreach ($requirements as $requirement) { + if (isset($requirement['severity']) && $requirement['severity'] == REQUIREMENT_ERROR) { + $message = $requirement['description']; + if (isset($requirement['value']) && $requirement['value']) { + $message .= ' ('. st('Currently using !item !version', array('!item' => $requirement['title'], '!version' => $requirement['value'])) .')'; + } + drupal_set_message($message, 'error'); + } + } + } } /** diff --git a/modules/system/system.install b/modules/system/system.install index c23bfddee..980524561 100644 --- a/modules/system/system.install +++ b/modules/system/system.install @@ -151,6 +151,12 @@ function system_requirements($phase) { // Test files directory $directory = file_directory_path(); + + // For installer, create the directory if possible. + if ($phase == 'install' && !is_dir($directory) && @mkdir($directory)) { + @chmod($directory, 0775); // Necessary for non-webserver users. + } + $is_writable = is_writable($directory); $is_directory = is_dir($directory); if (!$is_writable || !$is_directory) { @@ -170,7 +176,7 @@ function system_requirements($phase) { 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 ensure that the files directory exists and is writable by the installer. If you are unsure how to create this directory and modify its permissions, please consult the <a href="@handbook_url">on-line handbook</a> or INSTALL.txt.', array('%directory' => $directory, '@handbook_url' => 'http://drupal.org/server-permissions')); + $requirements['file system']['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, please see INSTALL.txt or the <a href="@handbook_url">on-line handbook</a>.', array('@handbook_url' => 'http://drupal.org/server-permissions')); $requirements['file system']['value'] = ''; } } |