This is an unusual migration and will need two process plugins, one for all, one for configurable. This is the pseudocode that needs to run:

$default = // .. copypaste from https://api.drupal.org/api/drupal/modules%21locale%21locale.module/function/locale_language_types_info/7
$language_types = variable_get('language_types', $default);
\Drupal::config('system.language.types')
  ->set('all', array_keys($language_types);
  ->set('configurable', array_keys(array_filter($language_types))
  ->save();

Comments

chx’s picture

Assigned: Unassigned » Gábor Hojtsy

talked to penyaskito briefly on IRC, this indeed makes no sense. Let's see what Gabor remembers of this.

Gábor Hojtsy’s picture

Title: system_update_8059 makes no sense » system_update_8059 converts the wrong old variables
Assigned: Gábor Hojtsy » Unassigned
Issue tags: +D8MI, +language-base

Looking at the blame, this update seems to be attempting to convert the 'language_interface', 'language_url' etc. variable table values to be values under the 'system.language.types' config file under a 'configurable' key. system.language.types's configurable key seems to be used extensively in the new code.

It is true that the removed code only contains variables 'language_types' and "language_negotiation_$language_type", although there are still uses left of "language_negotiation_$language_type" (at least in this patch itself).

So looks like the variables being converted don't actually exist. I think the intent was to convert 'language_types' based on this diff:

 function language_types_get_all() {
-  return array_keys(variable_get('language_types', language_types_get_default()));
+  $types = \Drupal::config('system.language.types')->get('all');
+  return $types ? $types : array_keys(language_types_get_default());
 }
chx’s picture

So, I do not know anything about this nor do I intend to learn every crazyness we stuffed in the variable table beforehands. I just need a config file name, seems system.language.types plus an array in the format of $destination => $source where $source is the D7 variable_get($source) and $destination is the $config->get($destination) . For a better description, read the https://drupal.org/node/2127611 Migration handbook especially the https://drupal.org/node/2129651 process plugin (unlike me who doesn't need custom language negotiation, you will need to learn migration eventually :P )

chx’s picture

OK, so we are migrating the variable language_types. The default of this variable is locale_language_types_info.

The resulting config file is system.language.types . This has two top level keys: all and configurable. What needs to run, in pseudocode (because this would be broken in migrate and upgrade both):

$default = // .. copypaste.
$language_types = variable_get('language_types', $default);
\Drupal::config('system.language.types')
  ->set('all', array_keys($language_types);
  ->set('configurable', array_keys(array_filter($language_types))
  ->save();
Gábor Hojtsy’s picture

Looks good, we figured this out based on http://drupalcode.org/project/drupal.git/commitdiff/d5d172e3c8b639c565f4... essentially.

chx’s picture

Status: Active » Closed (fixed)
chx’s picture

Title: system_update_8059 converts the wrong old variables » Variable to config system.language.types [d7]
Component: language system » migration system
Category: Bug report » Task
Priority: Major » Normal
Issue summary: View changes
Status: Closed (fixed) » Postponed
eliza411’s picture

Project: Drupal core » IMP
Version: 8.x-dev »
Component: migration system » Code
eliza411’s picture

Status: Postponed » Active