Commit fdca0419 authored by Dries's avatar Dries

- Patch #1357918 by Gábor Hojtsy, swentel, sun, no_commit_credit: missing...

- Patch #1357918 by Gábor Hojtsy, swentel, sun, no_commit_credit: missing update for language_default() in language langcode update.
parent c94f4a05
......@@ -2745,16 +2745,13 @@ function language_name($langcode) {
* A language object.
*/
function language_default() {
$default = variable_get(
'language_default',
(object) array(
'langcode' => 'en',
'name' => 'English',
'direction' => 0,
'enabled' => 1,
'weight' => 0,
)
);
$default = variable_get('language_default', (object) array(
'langcode' => 'en',
'name' => 'English',
'direction' => 0,
'enabled' => 1,
'weight' => 0,
));
$default->default = TRUE;
return $default;
}
......
......@@ -119,7 +119,7 @@ function update_prepare_d8_bootstrap() {
'type' => 'varchar',
'length' => 12,
'not null' => TRUE,
'default' => '',
'default' => '',
);
$langcode_indexes = array('indexes' =>
array(
......@@ -183,17 +183,6 @@ function update_prepare_d8_language() {
db_drop_field('languages', 'domain');
db_drop_field('languages', 'native');
// Rename language column to langcode and set it again as the primary key.
db_drop_primary_key('languages');
$langcode_spec = array(
'type' => 'varchar',
'length' => 12,
'not null' => TRUE,
'default' => '',
'description' => "Language code, e.g. 'de' or 'en-US'.",
);
db_change_field('languages', 'language', 'langcode', $langcode_spec, array('primary key' => array('langcode')));
// Rename the languages table to language.
db_rename_table('languages', 'language');
......@@ -203,6 +192,10 @@ function update_prepare_d8_language() {
$modules = array('language');
update_module_add_to_system($modules);
update_module_enable($modules);
// Rename 'language' column to 'langcode'.
require_once DRUPAL_ROOT . '/core/modules/language/language.install';
language_update_8000();
}
}
......
......@@ -73,3 +73,31 @@ function language_schema() {
);
return $schema;
}
/**
* Rename {language}.language to {language}.langcode.
*
* @see update_prepare_d8_language()
*/
function language_update_8000() {
// Rename language column to langcode and set it again as the primary key.
if (db_field_exists('language', 'language')) {
db_drop_primary_key('language');
$langcode_spec = array(
'type' => 'varchar',
'length' => 12,
'not null' => TRUE,
'default' => '',
'description' => "Language code, e.g. 'de' or 'en-US'.",
);
db_change_field('language', 'language', 'langcode', $langcode_spec, array('primary key' => array('langcode')));
}
// Update the 'language_default' system variable, if configured.
$language_default = variable_get('language_default');
if (!empty($language_default) && isset($language_default->language)) {
$language_default->langcode = $language_default->language;
unset($language_default->language);
variable_set('language_default', $language_default);
}
}
......@@ -40,3 +40,4 @@ files[] = tests/xmlrpc.test
files[] = tests/upgrade/upgrade.test
files[] = tests/upgrade/upgrade_bare.test
files[] = tests/upgrade/upgrade_filled.test
files[] = tests/upgrade/upgrade.language.test
......@@ -243,9 +243,9 @@ abstract class UpgradePathTestCase extends DrupalWebTestCase {
* TRUE if the upgrade succeeded, FALSE otherwise.
*/
protected function performUpgrade($register_errors = TRUE) {
$update_url = $GLOBALS['base_url'] . '/core/update.php';
// Load the first update screen.
$update_url = $GLOBALS['base_url'] . '/core/update.php';
$this->drupalGet($update_url, array('external' => TRUE));
if (!$this->assertResponse(200)) {
return FALSE;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment