diff -urpN --strip-trailing-cr ../drupal-6.x-dev/files/README.txt ./files/README.txt
--- ../drupal-6.x-dev/files/README.txt 1970-01-01 01:00:00.000000000 +0100
+++ ./files/README.txt 2007-11-11 16:20:42.000000000 +0100
@@ -0,0 +1,13 @@
+// $Id: $
+
+This is the default directory used for all your uploaded files,
+as well as some temporary files created by Drupal. It is highly
+recommended to consider whether this location is matching your needs,
+especially if you are going to run multiple sites from the same
+codebase, and adjust the setting at admin/settings/file-system
+accordingly before uploading any files to your new site. After
+doing so, you will be able to remove this directory, if no more
+in use. Changing the setting later might cause problems.
+
+Since this directory is used while installing Drupal, you need
+to make it writable, before you can start the installation.
diff -urpN --strip-trailing-cr ../drupal-6.x-dev/includes/bootstrap.inc ./includes/bootstrap.inc
--- ../drupal-6.x-dev/includes/bootstrap.inc 2007-10-25 17:38:24.000000000 +0200
+++ ./includes/bootstrap.inc 2007-11-11 16:22:19.000000000 +0100
@@ -1083,7 +1083,7 @@ function language_list($field = 'languag
* Optional property of the language object to return
*/
function language_default($property = NULL) {
- $language = variable_get('language_default', (object) array('language' => 'en', 'name' => 'English', 'native' => 'English', 'direction' => 0, 'enabled' => 1, 'plurals' => 0, 'formula' => '', 'domain' => '', 'prefix' => '', 'weight' => 0));
+ $language = variable_get('language_default', (object) array('language' => 'en', 'name' => 'English', 'native' => 'English', 'direction' => 0, 'enabled' => 1, 'plurals' => 0, 'formula' => '', 'domain' => '', 'prefix' => '', 'weight' => 0, 'javascript' => ''));
return $property ? $language->$property : $language;
}
diff -urpN --strip-trailing-cr ../drupal-6.x-dev/includes/form.inc ./includes/form.inc
--- ../drupal-6.x-dev/includes/form.inc 2007-11-09 08:40:55.000000000 +0100
+++ ./includes/form.inc 2007-11-11 16:22:19.000000000 +0100
@@ -565,6 +565,9 @@ function drupal_redirect_form($form, $re
* theming, and hook_form_alter functions.
*/
function _form_validate($elements, &$form_state, $form_id = NULL) {
+ // Also used in the installer, pre-database setup.
+ $t = get_t();
+
// Recurse through all children.
foreach (element_children($elements) as $key) {
if (isset($elements[$key]) && $elements[$key]) {
@@ -578,12 +581,12 @@ function _form_validate($elements, &$for
// and a textfield could return '0' and empty('0') returns TRUE so we
// need a special check for the '0' string.
if ($elements['#required'] && empty($elements['#value']) && $elements['#value'] !== '0') {
- form_error($elements, t('!name field is required.', array('!name' => $elements['#title'])));
+ form_error($elements, $t('!name field is required.', array('!name' => $elements['#title'])));
}
// Verify that the value is not longer than #maxlength.
if (isset($elements['#maxlength']) && drupal_strlen($elements['#value']) > $elements['#maxlength']) {
- form_error($elements, t('!name cannot be longer than %max characters but is currently %length characters long.', array('!name' => empty($elements['#title']) ? $elements['#parents'][0] : $elements['#title'], '%max' => $elements['#maxlength'], '%length' => drupal_strlen($elements['#value']))));
+ form_error($elements, $t('!name cannot be longer than %max characters but is currently %length characters long.', array('!name' => empty($elements['#title']) ? $elements['#parents'][0] : $elements['#title'], '%max' => $elements['#maxlength'], '%length' => drupal_strlen($elements['#value']))));
}
if (isset($elements['#options']) && isset($elements['#value'])) {
@@ -597,13 +600,13 @@ function _form_validate($elements, &$for
$value = $elements['#type'] == 'checkboxes' ? array_keys(array_filter($elements['#value'])) : $elements['#value'];
foreach ($value as $v) {
if (!isset($options[$v])) {
- form_error($elements, t('An illegal choice has been detected. Please contact the site administrator.'));
+ form_error($elements, $t('An illegal choice has been detected. Please contact the site administrator.'));
watchdog('form', 'Illegal choice %choice in !name element.', array('%choice' => $v, '!name' => empty($elements['#title']) ? $elements['#parents'][0] : $elements['#title']), WATCHDOG_ERROR);
}
}
}
elseif (!isset($options[$elements['#value']])) {
- form_error($elements, t('An illegal choice has been detected. Please contact the site administrator.'));
+ form_error($elements, $t('An illegal choice has been detected. Please contact the site administrator.'));
watchdog('form', 'Illegal choice %choice in %name element.', array('%choice' => $elements['#value'], '%name' => empty($elements['#title']) ? $elements['#parents'][0] : $elements['#title']), WATCHDOG_ERROR);
}
}
@@ -1969,20 +1972,23 @@ function theme_file($element) {
* A string representing the form element.
*/
function theme_form_element($element, $value) {
+ // This is also used in the installer, pre-database setup.
+ $t = get_t();
+
$output = '
*' : '';
+ $required = !empty($element['#required']) ? '*' : '';
if (!empty($element['#title'])) {
$title = $element['#title'];
if (!empty($element['#id'])) {
- $output .= ' \n";
+ $output .= ' \n";
}
else {
- $output .= ' \n";
+ $output .= ' \n";
}
}
diff -urpN --strip-trailing-cr ../drupal-6.x-dev/includes/install.inc ./includes/install.inc
--- ../drupal-6.x-dev/includes/install.inc 2007-09-07 12:48:24.000000000 +0200
+++ ./includes/install.inc 2007-11-11 16:22:19.000000000 +0100
@@ -595,8 +595,9 @@ function install_goto($path) {
}
/**
- * Hardcoded function for doing the equivalent of theme('placeholder')
- * when the theme system is not available.
+ * Hardcoded function for doing the equivalent of t() during
+ * the install process, when database, theme, and localization
+ * system is possibly not yet available.
*/
function st($string, $args = array()) {
static $locale_strings = NULL;
diff -urpN --strip-trailing-cr ../drupal-6.x-dev/includes/locale.inc ./includes/locale.inc
--- ../drupal-6.x-dev/includes/locale.inc 2007-10-15 21:51:06.000000000 +0200
+++ ./includes/locale.inc 2007-11-11 16:22:19.000000000 +0100
@@ -917,7 +917,7 @@ function locale_add_language($langcode,
// Only set it as default if enabled.
if ($enabled && $default) {
- variable_set('language_default', (object) array('language' => $langcode, 'name' => $name, 'native' => $native, 'direction' => $direction, 'enabled' => (int) $enabled, 'plurals' => 0, 'formula' => '', 'domain' => '', 'prefix' => $prefix, 'weight' => 0));
+ variable_set('language_default', (object) array('language' => $langcode, 'name' => $name, 'native' => $native, 'direction' => $direction, 'enabled' => (int) $enabled, 'plurals' => 0, 'formula' => '', 'domain' => '', 'prefix' => $prefix, 'weight' => 0, 'javascript' => ''));
}
if ($enabled) {
@@ -2542,7 +2542,7 @@ function _locale_batch_language_finished
* Advance installer task to the finished screen.
*/
function _locale_batch_installer_finished($success, $results) {
- variable_set('install_task', 'finished');
+ variable_set('install_task', 'configure');
}
/**
diff -urpN --strip-trailing-cr ../drupal-6.x-dev/install.php ./install.php
--- ../drupal-6.x-dev/install.php 2007-11-11 07:56:44.000000000 +0100
+++ ./install.php 2007-11-11 16:02:33.000000000 +0100
@@ -27,6 +27,9 @@ function install_main() {
// Ensure correct page headers are sent (e.g. caching)
drupal_page_header();
+ // Set up $language, so t() caller functions will still work.
+ drupal_init_language();
+
// Check existing settings.php.
$verify = install_verify_settings();
@@ -544,6 +547,19 @@ function install_select_locale($profilen
return FALSE;
}
else {
+ // Allow profile to pre-select the language.
+ $function = $profilename .'_profile_details';
+ if (function_exists($function)) {
+ $details = $function();
+ if (isset($details['language'])) {
+ foreach ($locales as $locale) {
+ if ($details['language'] == $locale->name) {
+ return $locale->name;
+ }
+ }
+ }
+ }
+
foreach ($locales as $locale) {
if ($_POST['locale'] == $locale->name) {
return $locale->name;
@@ -631,16 +647,47 @@ function install_tasks($profile, $task)
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
$_SESSION['messages'] = $messages;
- // Build a page for a final task.
+ // Build a page for final tasks.
drupal_maintenance_theme();
if (empty($task)) {
- variable_set('install_task', 'configure');
- $task = 'configure';
+ variable_set('install_task', 'locale-import');
+ $task = 'locale-import';
}
// We are using a list of if constructs here to allow for
// passing from one task to the other in the same request.
+ // Import interface translations for the enabled modules.
+ if ($task == 'locale-import') {
+ if (!empty($install_locale) && ($install_locale != 'en')) {
+ include_once 'includes/locale.inc';
+ // Enable installation language as default site language.
+ locale_add_language($install_locale, NULL, NULL, NULL, NULL, NULL, 1, TRUE);
+ // Collect files to import for this language.
+ $batch = locale_batch_by_language($install_locale);
+ if (!empty($batch)) {
+ // Start a batch, switch to 'locale-batch' task. We need to
+ // set the variable here, because batch_process() redirects.
+ variable_set('install_task', 'locale-batch');
+ batch_set($batch);
+ $path = $base_url .'/install.php?locale='. $install_locale .'&profile='. $profile;
+ batch_process($path, $path);
+ }
+ }
+ // Found nothing to import or not foreign language, go to next task.
+ $task = 'configure';
+ }
+
+ // We are running a batch import of interface translation files.
+ // This might run in multiple HTTP requests, constantly redirecting
+ // to the same address, until the batch finished callback is invoked
+ // and the task advances to 'configure'.
+ if ($task == 'locale-batch') {
+ include_once 'includes/batch.inc';
+ include_once 'includes/locale.inc';
+ $output = _batch_page();
+ }
+
if ($task == 'configure') {
drupal_set_title(st('Configure site'));
@@ -679,51 +726,26 @@ function install_tasks($profile, $task)
if (!in_array($task, install_reserved_tasks())) {
$function = $profile .'_profile_tasks';
if (function_exists($function)) {
+ // Remove the page title of 'Configure site' task.
+ drupal_set_title('');
// The profile needs to run more code, maybe even more tasks.
// $task is sent through as a reference and may be changed!
- $output = $function($task);
+ $output = $function($task, $base_url .'/install.php?locale='. $install_locale .'&profile='. $profile);
}
// If the profile doesn't move on to a new task we assume
- // that it is done: we let the installer regain control and
- // proceed with the locale import.
+ // that it is done.
if ($task == 'profile') {
- $task = 'locale-import';
+ $task = 'profile-finished';
}
}
- // Import interface translations for the enabled modules, after
- // any changes made by the profile through the profile forms.
- if ($task == 'locale-import') {
- if (!empty($install_locale) && ($install_locale != 'en')) {
- include_once 'includes/locale.inc';
- // Enable installation language as default site language.
- locale_add_language($install_locale, NULL, NULL, NULL, NULL, NULL, 1, TRUE);
- // Collect files to import for this language.
- $batch = locale_batch_by_language($install_locale);
- if (!empty($batch)) {
- // Start a batch, switch to 'locale-batch' task. We need to
- // set the variable here, because batch_process() redirects.
- variable_set('install_task', 'locale-batch');
- batch_set($batch);
- $path = $base_url .'/install.php?locale='. $install_locale .'&profile='. $profile;
- batch_process($path, $path);
- }
- }
- // Found nothing to import or not foreign language, go to next task.
+ // Profile custom tasks are done, so let the installer regain
+ // control and proceed with the final page.
+ if ($task == 'profile-finished') {
$task = 'finished';
}
- // We are running a batch import of interface translation files.
- // This might run in multiple HTTP requests, constantly redirecting
- // to the same address, until the batch finished callback is invoked
- // and the task advances to 'finished'.
- if ($task == 'locale-batch') {
- include_once 'includes/batch.inc';
- include_once 'includes/locale.inc';
- $output = _batch_page();
- }
-
// Display a 'finished' page to user.
if ($task == 'finished') {
drupal_set_title(st('@drupal installation complete', array('@drupal' => drupal_install_profile_name())));
@@ -760,7 +782,7 @@ function install_tasks($profile, $task)
* The list of reserved tasks to run in the installer.
*/
function install_reserved_tasks() {
- return array('configure', 'locale-import', 'locale-batch', 'finished', 'done');
+ return array('configure', 'locale-import', 'locale-batch', 'profile-finished', 'finished', 'done');
}
/**
@@ -777,11 +799,15 @@ function install_check_requirements($pro
foreach ($requirements as $requirement) {
if (isset($requirement['severity']) && $requirement['severity'] == REQUIREMENT_ERROR) {
- drupal_set_message($requirement['description'] .' ('. st('Currently using !item !version', array('!item' => $requirement['title'], '!version' => $requirement['value'])) .')', 'error');
+ $message = $requirement['description'];
+ if ($requirement['value']) {
+ $message .= ' ('. st('Currently using !item !version', array('!item' => $requirement['title'], '!version' => $requirement['value'])) .')';
+ }
+ drupal_set_message($message, 'error');
}
}
- drupal_set_title(st('Incompatible environment'));
+ drupal_set_title(st('Requirements problem'));
print theme('install_page', '');
exit;
}
@@ -797,6 +823,7 @@ function install_task_list($active = NUL
'locale-select' => st('Choose language'),
'requirements' => st('Verify requirements'),
'database' => st('Setup database'),
+ 'locale-batch' => st('Import translations'),
'configure' => st('Configure site'),
);
@@ -820,11 +847,9 @@ function install_task_list($active = NUL
}
}
- // If necessary, add translation import to the task list.
- if (count($locales) > 1 && !empty($_GET['locale']) && $_GET['locale'] != 'en') {
- $tasks += array(
- 'locale-batch' => st('Import translations'),
- );
+ // If not required, remove translation import from the task list.
+ if (count($locales) < 2 || empty($_GET['locale']) || $_GET['locale'] == 'en') {
+ unset($tasks['locale-batch']);
}
// Add finished step as the last task.
diff -urpN --strip-trailing-cr ../drupal-6.x-dev/modules/system/system.install ./modules/system/system.install
--- ../drupal-6.x-dev/modules/system/system.install 2007-11-11 09:48:22.000000000 +0100
+++ ./modules/system/system.install 2007-11-11 16:01:00.000000000 +0100
@@ -111,37 +111,43 @@ 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));
- }
+ $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,
+ );
+ 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 a different wording. 'value' will
+ // be treated as version, so provide none here.
+ $requirements['file system']['description'] = $error .' '. $t("You need to provide a writable %directory directory by changing it's permissions or creating a new one, before you can proceed with the installation.", array('%directory' => $directory));
+ $requirements['file system']['value'] = '';
+ }
+ }
+ else {
+ if (variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC) == FILE_DOWNLOADS_PUBLIC) {
$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'))),
+ 'value' => $t('Writable (public download method)'),
);
}
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)'),
- );
- }
+ $requirements['file system'] = array(
+ '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') {
diff -urpN --strip-trailing-cr ../drupal-6.x-dev/profiles/default/default.profile ./profiles/default/default.profile
--- ../drupal-6.x-dev/profiles/default/default.profile 2007-11-06 10:00:31.000000000 +0100
+++ ./profiles/default/default.profile 2007-11-11 16:22:19.000000000 +0100
@@ -15,12 +15,15 @@ function default_profile_modules() {
* Return a description of the profile for the initial installation screen.
*
* @return
- * An array with keys 'name' and 'description' describing this profile.
+ * An array with keys 'name' and 'description' describing this profile,
+ * and optional 'language' to override the install-language selection
+ * for language-specific profiles.
*/
function default_profile_details() {
return array(
'name' => 'Drupal',
- 'description' => 'Select this profile to enable some basic Drupal functionality and the default theme.'
+ 'description' => 'Select this profile to enable some basic Drupal functionality and the default theme.',
+// 'language' => 'en',
);
}
@@ -39,20 +42,24 @@ function default_profile_task_list() {
/**
* Perform any final installation tasks for this profile.
*
- * The installer goes through the configure -> locale-import ->
- * locale-batch -> finished -> done tasks in this order, if you
+ * The installer goes through the locale-import -> locale-batch
+ * -> configure -> finished -> done tasks in this order, if you
* don't implement this function in your profile.
*
* If this function is implemented, you can have any number of
- * custom tasks to perform, implementing a state machine here to
- * walk the user through those tasks, by setting $task to something
- * other then the reserved tasks listed in install_reserved_tasks()
- * and the 'profile' task this function gets called with for first
- * time. If you implement your custom tasks, this function will get called
- * in every HTTP request (for form processing, printing your
- * information screens and so on) until you advance to the
- * 'locale-import' task, with which you hand control back to the
- * installer.
+ * custom tasks to perform after 'configure', implementing a state
+ * machine here to walk the user through those tasks. First time,
+ * this function get called with $task set to 'profile', and you
+ * can advance to further tasks by setting $task to your tasks'
+ * identifiers, used as array keys in the hook_profile_task_list()
+ * above. You must avoid the reserved tasks listed in
+ * install_reserved_tasks(). If you implement your custom tasks,
+ * this function will get called in every HTTP request (for form
+ * processing, printing your information screens and so on) until
+ * you advance to the 'profile-finished' task, with which you
+ * hand control back to the installer. Each custom page you
+ * return needs to provide a way to continue, such as form-submit
+ * or a link.
*
* You should define the list of custom tasks you implement by
* returning an array of them in hook_profile_task_list().
@@ -65,12 +72,15 @@ function default_profile_task_list() {
* @param $task
* The current $task of the install system. When hook_profile_tasks()
* is first called, this is 'profile'.
+ * @param $url
+ * Complete URL to be used for a link or form action on a custom page,
+ * if providing any, to allow the user to proceed with the installation.
*
* @return
* An optional HTML string to display to the user. Only used if you
* modify the $task, otherwise discarded.
*/
-function default_profile_tasks(&$task) {
+function default_profile_tasks(&$task, $url) {
// Insert default user-defined node types into the database. For a complete
// list of available node type attributes, refer to the node type API