Problem
On Drupal 7 the connectors page only flips the enabled flag of a connector; its directory, limit and cron settings stay, and the configure link is there before the connector is enabled, so a connector can be set up first and switched on after.
On 3.0.x unchecking a connector on the connectors page deletes its whole settings subtree (ConnectorManager::removePluginConfigurationMultiple()), so enabling it again starts from the defaults. The configure operation is only offered for enabled connectors, and only when the source plugin has settings, although the Drupal packages connector has a setting of its own. On top of that l10n_server.settings:connectors has no config schema at all: the configuration form writes it with setData(), functional tests with strict schema checking cannot save it, and the values are stored with the types the form gives (strings for numbers, integers for booleans).
Proposed resolution
- Disabling a connector keeps its settings; the removal methods go from the connector manager.
- The configure operation is offered for every connector with settings, enabled or not, like Drupal 7; scan and parse stay for enabled ones.
- Config schema for the connector settings: a sequence by connector id with the source settings typed by source id and the connector settings by base id, extensible by connector modules (the Drupal packages connector declares its home link setting). The plugin bases cast the form values to the types of their defaults.
- The "Release files max filesize" setting of the drupal.org source is removed: nothing read it on 3.0.x, and nothing read it on Drupal 7 either.
Tests
Drupal 7 first: L10nServerConnectorSettingsTestCase configures the local packages connector before enabling it, enables, disables and enables it again through the connectors page and checks the settings form each time. Ported as ConnectorSettingsTest, which also checks the stored settings. The kernel tests of the Drupal packages connector run with strict config schema checking again.
LLM disclosure
LLM was used to find, diagnose explain and fix this issue. With human review.
Comments
Comment #4
gábor hojtsy