? profiles/simpletest ? sites/default/modules ? sites/default/settings.php Index: includes/locale.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/locale.inc,v retrieving revision 1.195 diff -u -p -r1.195 locale.inc --- includes/locale.inc 16 Nov 2008 19:41:14 -0000 1.195 +++ includes/locale.inc 27 Nov 2008 05:53:21 -0000 @@ -426,7 +426,7 @@ function locale_languages_delete_form_su _locale_rebuild_js($form_state['values']['langcode']); // Remove the language. db_query("DELETE FROM {languages} WHERE language = '%s'", $form_state['values']['langcode']); - db_query("UPDATE {node} SET language = '' WHERE language = '%s'", $form_state['values']['langcode']); + db_query("UPDATE {node} SET language = 'default' WHERE language = '%s'", $form_state['values']['langcode']); $variables = array('%locale' => $languages[$form_state['values']['langcode']]->name); drupal_set_message(t('The language %locale has been removed.', $variables)); watchdog('locale', 'The language %locale has been removed.', $variables); @@ -1215,7 +1215,7 @@ function _locale_import_message($message * @param $group * Text group to import PO file into (eg. 'default' for interface translations) */ -function _locale_import_one_string($op, $value = NULL, $mode = NULL, $lang = NULL, $file = NULL, $group = 'default') { +function _locale_import_one_string($op, $value = NULL, $mode = NULL, $lang = 'default', $file = NULL, $group = 'default') { static $report = array(0, 0, 0); static $headerdone = FALSE; static $strings = array(); Index: includes/path.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/path.inc,v retrieving revision 1.28 diff -u -p -r1.28 path.inc --- includes/path.inc 14 Oct 2008 11:01:08 -0000 1.28 +++ includes/path.inc 27 Nov 2008 05:53:21 -0000 @@ -43,12 +43,12 @@ function drupal_init_path() { * Either a Drupal system path, an aliased path, or FALSE if no path was * found. */ -function drupal_lookup_path($action, $path = '', $path_language = '') { +function drupal_lookup_path($action, $path = '', $path_language = 'default') { global $language; // $map is an array with language keys, holding arrays of Drupal paths to alias relations static $map = array(), $no_src = array(), $count; - $path_language = $path_language ? $path_language : $language->language; + $path_language = ($path_language != 'default') ? $path_language : $language->language; // Use $count to avoid looking up paths in subsequent calls if there simply are no aliases if (!isset($count)) { @@ -66,7 +66,7 @@ function drupal_lookup_path($action, $pa return $map[$path_language][$path]; } // Get the most fitting result falling back with alias without language - $alias = db_result(db_query("SELECT dst FROM {url_alias} WHERE src = '%s' AND language IN('%s', '') ORDER BY language DESC", $path, $path_language)); + $alias = db_result(db_query("SELECT dst FROM {url_alias} WHERE src = '%s' AND language IN('%s', 'default') ORDER BY language DESC", $path, $path_language)); $map[$path_language][$path] = $alias; return $alias; } @@ -77,7 +77,7 @@ function drupal_lookup_path($action, $pa $src = ''; if (!isset($map[$path_language]) || !($src = array_search($path, $map[$path_language]))) { // Get the most fitting result falling back with alias without language - if ($src = db_result(db_query("SELECT src FROM {url_alias} WHERE dst = '%s' AND language IN('%s', '') ORDER BY language DESC", $path, $path_language))) { + if ($src = db_result(db_query("SELECT src FROM {url_alias} WHERE dst = '%s' AND language IN('%s', 'default') ORDER BY language DESC", $path, $path_language))) { $map[$path_language][$src] = $path; } else { @@ -106,7 +106,7 @@ function drupal_lookup_path($action, $pa * An aliased path if one was found, or the original path if no alias was * found. */ -function drupal_get_path_alias($path, $path_language = '') { +function drupal_get_path_alias($path, $path_language = 'default') { $result = $path; if ($alias = drupal_lookup_path('alias', $path, $path_language)) { $result = $alias; @@ -126,7 +126,7 @@ function drupal_get_path_alias($path, $p * The internal path represented by the alias, or the original alias if no * internal path was found. */ -function drupal_get_normal_path($path, $path_language = '') { +function drupal_get_normal_path($path, $path_language = 'default') { $result = $path; if ($src = drupal_lookup_path('source', $path, $path_language)) { $result = $src; Index: modules/locale/locale.install =================================================================== RCS file: /cvs/drupal/drupal/modules/locale/locale.install,v retrieving revision 1.31 diff -u -p -r1.31 locale.install --- modules/locale/locale.install 15 Nov 2008 13:01:07 -0000 1.31 +++ modules/locale/locale.install 27 Nov 2008 05:53:21 -0000 @@ -206,6 +206,54 @@ function locale_update_6005() { */ /** + * @defgroup updates-6.x-to-7.x Locale updates from 6.x to 7.x + * @{ + */ + +/** + * Replace default language from '' to 'default'. + */ +function locale_update_7000() { + $ret = array(); + + $schema['languages'] = array( + 'fields' => array( + 'language' => array( + 'type' => 'varchar', + 'length' => 12, + 'not null' => TRUE, + 'default' => 'default', + ), + ), + ); + + $schema['locales_target'] = array( + 'fields' => array( + 'language' => array( + 'type' => 'varchar', + 'length' => 12, + 'not null' => TRUE, + 'default' => 'default', + ), + ), + ); + + foreach ($schema as $table => $fields) { + foreach ($fields['fields'] as $field => $def) { + db_change_field($ret, $table, $field, $field, $def); + $ret[] = update_sql("UPDATE {" . $table . "} SET " . $field . " = 'default' WHERE " . $field . " = ''"); + } + } + + return $ret; +} + +/** + * @} End of "defgroup updates-6.x-to-7.x" + * The next series of updates should start at 8000. + */ + +/** * Implementation of hook_uninstall(). */ function locale_uninstall() { @@ -232,7 +280,7 @@ function locale_schema() { 'type' => 'varchar', 'length' => 12, 'not null' => TRUE, - 'default' => '', + 'default' => 'default', 'description' => "Language code, e.g. 'de' or 'en-US'.", ), 'name' => array( @@ -369,7 +417,7 @@ function locale_schema() { 'type' => 'varchar', 'length' => 12, 'not null' => TRUE, - 'default' => '', + 'default' => 'default', 'description' => 'Language code. References {languages}.language.', ), 'plid' => array( Index: modules/node/node.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/node/node.admin.inc,v retrieving revision 1.30 diff -u -p -r1.30 node.admin.inc --- modules/node/node.admin.inc 22 Nov 2008 14:09:41 -0000 1.30 +++ modules/node/node.admin.inc 27 Nov 2008 05:53:22 -0000 @@ -452,7 +452,7 @@ function node_admin_content($form_state) function node_admin_nodes() { // Enable language column if translation module is enabled // or if we have any node with language. - $multilanguage = (module_exists('translation') || db_result(db_query("SELECT COUNT(*) FROM {node} WHERE language != ''"))); + $multilanguage = (module_exists('translation') || db_result(db_query("SELECT COUNT(*) FROM {node} WHERE language <> 'default'"))); // Build the sortable table header. $header = array(); Index: modules/node/node.install =================================================================== RCS file: /cvs/drupal/drupal/modules/node/node.install,v retrieving revision 1.8 diff -u -p -r1.8 node.install --- modules/node/node.install 15 Nov 2008 13:01:08 -0000 1.8 +++ modules/node/node.install 27 Nov 2008 05:53:22 -0000 @@ -33,7 +33,7 @@ function node_schema() { 'type' => 'varchar', 'length' => 12, 'not null' => TRUE, - 'default' => '', + 'default' => 'default', ), 'title' => array( 'description' => 'The title of this node, always treated as non-markup plain text.', @@ -382,7 +382,8 @@ function node_schema() { } /** - * Drupal 6.x to 7.x updates + * @defgroup updates-6.x-to-7.x Node updates from 6.x to 7.x + * @{ */ /** @@ -398,5 +399,33 @@ function node_update_7000() { } /** - * End of 6.x to 7.x updates + * Replace default language from '' to 'default'. + */ +function node_update_7001() { + $ret = array(); + + $schema['node'] = array( + 'fields' => array( + 'language' => array( + 'type' => 'varchar', + 'length' => 12, + 'not null' => TRUE, + 'default' => 'default', + ), + ), + ); + + foreach ($schema as $table => $fields) { + foreach ($fields['fields'] as $field => $def) { + db_change_field($ret, $table, $field, $field, $def); + $ret[] = update_sql("UPDATE {" . $table . "} SET " . $field . " = 'default' WHERE " . $field . " = ''"); + } + } + + return $ret; +} + +/** + * @} End of "defgroup updates-6.x-to-7.x" + * The next series of updates should start at 8000. */ Index: modules/node/node.pages.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/node/node.pages.inc,v retrieving revision 1.45 diff -u -p -r1.45 node.pages.inc --- modules/node/node.pages.inc 13 Oct 2008 00:33:03 -0000 1.45 +++ modules/node/node.pages.inc 27 Nov 2008 05:53:22 -0000 @@ -57,7 +57,7 @@ function node_add($type) { // If a node type has been specified, validate its existence. if (isset($types[$type]) && node_access('create', $type)) { // Initialize settings: - $node = array('uid' => $user->uid, 'name' => (isset($user->name) ? $user->name : ''), 'type' => $type, 'language' => ''); + $node = array('uid' => $user->uid, 'name' => (isset($user->name) ? $user->name : ''), 'type' => $type, 'language' => 'default'); drupal_set_title(t('Create @name', array('@name' => $types[$type]->name)), PASS_THROUGH); $output = drupal_get_form($type . '_node_form', $node); Index: modules/path/path.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/path/path.admin.inc,v retrieving revision 1.15 diff -u -p -r1.15 path.admin.inc --- modules/path/path.admin.inc 22 Nov 2008 10:49:01 -0000 1.15 +++ modules/path/path.admin.inc 27 Nov 2008 05:53:22 -0000 @@ -15,7 +15,7 @@ function path_admin_overview($keys = NUL // Add the filter form above the overview table. $output = drupal_get_form('path_admin_filter_form', $keys); // Enable language column if locale is enabled or if we have any alias with language - $count = db_result(db_query("SELECT COUNT(*) FROM {url_alias} WHERE language != ''")); + $count = db_result(db_query("SELECT COUNT(*) FROM {url_alias} WHERE language <> 'default'")); $multilanguage = (module_exists('locale') || $count); if ($keys) { @@ -83,7 +83,7 @@ function path_admin_edit($pid = 0) { * @see path_admin_form_validate() * @see path_admin_form_submit() */ -function path_admin_form(&$form_state, $edit = array('src' => '', 'dst' => '', 'language' => '', 'pid' => NULL)) { +function path_admin_form(&$form_state, $edit = array('src' => '', 'dst' => '', 'language' => 'default', 'pid' => NULL)) { $form['#alias'] = $edit; @@ -132,7 +132,7 @@ function path_admin_form_validate($form, $dst = $form_state['values']['dst']; $pid = isset($form_state['values']['pid']) ? $form_state['values']['pid'] : 0; // Language is only set if locale module is enabled, otherwise save for all languages. - $language = isset($form_state['values']['language']) ? $form_state['values']['language'] : ''; + $language = $form_state['values']['language']; if (db_result(db_query("SELECT COUNT(dst) FROM {url_alias} WHERE pid != %d AND dst = '%s' AND language = '%s'", $pid, $dst, $language))) { form_set_error('dst', t('The alias %alias is already in use in this language.', array('%alias' => $dst))); @@ -148,7 +148,7 @@ function path_admin_form_validate($form, */ function path_admin_form_submit($form, &$form_state) { // Language is only set if locale module is enabled - path_set_alias($form_state['values']['src'], $form_state['values']['dst'], isset($form_state['values']['pid']) ? $form_state['values']['pid'] : 0, isset($form_state['values']['language']) ? $form_state['values']['language'] : ''); + path_set_alias($form_state['values']['src'], $form_state['values']['dst'], isset($form_state['values']['pid']) ? $form_state['values']['pid'] : 0, $form_state['values']['language']); drupal_set_message(t('The alias has been saved.')); $form_state['redirect'] = 'admin/build/path'; Index: modules/path/path.module =================================================================== RCS file: /cvs/drupal/drupal/modules/path/path.module,v retrieving revision 1.150 diff -u -p -r1.150 path.module --- modules/path/path.module 22 Nov 2008 10:49:01 -0000 1.150 +++ modules/path/path.module 27 Nov 2008 05:53:22 -0000 @@ -78,7 +78,7 @@ function path_admin_delete($pid = 0) { /** * Set an aliased path for a given Drupal path, preventing duplicates. */ -function path_set_alias($path = NULL, $alias = NULL, $pid = NULL, $language = '') { +function path_set_alias($path = NULL, $alias = NULL, $pid = NULL, $language = 'default') { $path = urldecode($path); $alias = urldecode($alias); // First we check if we deal with an existing alias and delete or modify it based on pid. @@ -123,7 +123,7 @@ function path_set_alias($path = NULL, $a function path_nodeapi_validate(&$node, $arg) { if (user_access('create url aliases') || user_access('administer url aliases')) { if (isset($node->path)) { - $language = isset($node->language) ? $node->language : ''; + $language = ($node->language != 'default') ? $node->language : 'default'; $node->path = trim($node->path); if (db_result(db_query("SELECT COUNT(dst) FROM {url_alias} WHERE dst = '%s' AND src != '%s' AND language = '%s'", $node->path, "node/$node->nid", $language))) { form_set_error('path', t('The path is already in use.')); @@ -136,7 +136,7 @@ function path_nodeapi_validate(&$node, $ * Implementation of hook_nodeapi_load(). */ function path_nodeapi_load(&$node, $arg) { - $language = isset($node->language) ? $node->language : ''; + $language = ($node->language != 'default') ? $node->language : 'default'; $path = 'node/' . $node->nid; $alias = drupal_get_path_alias($path, $language); if ($path != $alias) { @@ -149,7 +149,7 @@ function path_nodeapi_load(&$node, $arg) */ function path_nodeapi_insert(&$node, $arg) { if (user_access('create url aliases') || user_access('administer url aliases')) { - $language = isset($node->language) ? $node->language : ''; + $language = ($node->language != 'default') ? $node->language : 'default'; // Don't try to insert if path is NULL. We may have already set // the alias ahead of time. if (isset($node->path)) { @@ -163,7 +163,7 @@ function path_nodeapi_insert(&$node, $ar */ function path_nodeapi_update(&$node, $arg) { if (user_access('create url aliases') || user_access('administer url aliases')) { - $language = isset($node->language) ? $node->language : ''; + $language = ($node->language != 'default') ? $node->language : 'default'; path_set_alias('node/' . $node->nid, isset($node->path) ? $node->path : NULL, isset($node->pid) ? $node->pid : NULL, $language); } } @@ -173,7 +173,6 @@ function path_nodeapi_update(&$node, $ar */ function path_nodeapi_delete(&$node, $arg) { if (user_access('create url aliases') || user_access('administer url aliases')) { - $language = isset($node->language) ? $node->language : ''; $path = 'node/' . $node->nid; if (drupal_get_path_alias($path) != $path) { path_set_alias($path); Index: modules/system/system.install =================================================================== RCS file: /cvs/drupal/drupal/modules/system/system.install,v retrieving revision 1.288 diff -u -p -r1.288 system.install --- modules/system/system.install 25 Nov 2008 13:16:39 -0000 1.288 +++ modules/system/system.install 27 Nov 2008 05:53:22 -0000 @@ -1257,11 +1257,11 @@ function system_schema() { 'default' => '', ), 'language' => array( - 'description' => 'The language this alias is for; if blank, the alias will be used for unknown languages. Each Drupal path can have an alias for each supported language.', + 'description' => 'The language this alias is for; if \'default\', the alias will be used for unknown languages. Each Drupal path can have an alias for each supported language.', 'type' => 'varchar', 'length' => 12, 'not null' => TRUE, - 'default' => '', + 'default' => 'default', ), ), 'unique keys' => array( @@ -3143,6 +3143,33 @@ function system_update_7015() { } /** + * Replace default language from '' to 'default'. + */ +function system_update_7016() { + $ret = array(); + + $schema['url_alias'] = array( + 'fields' => array( + 'language' => array( + 'type' => 'varchar', + 'length' => 12, + 'not null' => TRUE, + 'default' => 'default', + ), + ), + ); + + foreach ($schema as $table => $fields) { + foreach ($fields['fields'] as $field => $def) { + db_change_field($ret, $table, $field, $field, $def); + $ret[] = update_sql("UPDATE {" . $table . "} SET " . $field . " = 'default' WHERE " . $field . " = ''"); + } + } + + return $ret; +} + +/** * @} End of "defgroup updates-6.x-to-7.x" * The next series of updates should start at 8000. */ Index: modules/user/user.install =================================================================== RCS file: /cvs/drupal/drupal/modules/user/user.install,v retrieving revision 1.15 diff -u -p -r1.15 user.install --- modules/user/user.install 20 Nov 2008 06:56:17 -0000 1.15 +++ modules/user/user.install 27 Nov 2008 05:53:22 -0000 @@ -166,7 +166,7 @@ function user_schema() { 'type' => 'varchar', 'length' => 12, 'not null' => TRUE, - 'default' => '', + 'default' => 'default', 'description' => "User's default language.", ), 'picture' => array( @@ -230,7 +230,7 @@ function user_schema() { } /** - * @defgroup user-updates-6.x-to-7.x User updates from 6.x to 7.x + * @defgroup updates-6.x-to-7.x User updates from 6.x to 7.x * @{ */ @@ -360,7 +360,33 @@ function user_update_7002(&$sandbox) { } /** - * @} End of "defgroup user-updates-6.x-to-7.x" - * The next series of updates should start at 8000. + * Replace default language from '' to 'default'. */ +function user_update_7003() { + $ret = array(); + + $schema['users'] = array( + 'fields' => array( + 'language' => array( + 'type' => 'varchar', + 'length' => 12, + 'not null' => TRUE, + 'default' => 'default', + ), + ), + ); + foreach ($schema as $table => $fields) { + foreach ($fields['fields'] as $field => $def) { + db_change_field($ret, $table, $field, $field, $def); + $ret[] = update_sql("UPDATE {" . $table . "} SET " . $field . " = 'default' WHERE " . $field . " = ''"); + } + } + + return $ret; +} + +/** + * @} End of "defgroup updates-6.x-to-7.x" + * The next series of updates should start at 8000. + */ Index: modules/user/user.test =================================================================== RCS file: /cvs/drupal/drupal/modules/user/user.test,v retrieving revision 1.22 diff -u -p -r1.22 user.test --- modules/user/user.test 25 Nov 2008 13:14:29 -0000 1.22 +++ modules/user/user.test 27 Nov 2008 05:53:22 -0000 @@ -43,7 +43,7 @@ class UserRegistrationTestCase extends D $this->assertTrue(($user->created > REQUEST_TIME - 20 ), t('Correct creation time.')); $this->assertEqual($user->status, variable_get('user_register', 1) == 1 ? 1 : 0, t('Correct status field.')); $this->assertEqual($user->timezone, variable_get('date_default_timezone', NULL), t('Correct time zone field.')); - $this->assertEqual($user->language, '', t('Correct language field.')); + $this->assertEqual($user->language, 'default', t('Correct language field.')); $this->assertEqual($user->picture, '', t('Correct picture field.')); $this->assertEqual($user->init, $mail, t('Correct init field.'));