Problem/Motivation

Per the Drupal coding standards, words in persistent variables should be separated with an underscore. Variable names with dashes seem to cause PDO errors when exported with Strongarm:

pdoexception.gif

Proposed resolution

  • Sanitize the variable names.
  • Update hook to fix existing variable names.

Remaining tasks

  • Patch
  • Testing

User interface changes

None

API changes

None

Data model changes

None

Comments

stefan.r’s picture

Issue summary: View changes

Anyone willing to provide a patch for this? We'd want an update hook that renames all current variables and we want to replace hyphens with underscores in variable_gets and variable_sets.

gold’s picture

Version: 7.x-3.0-alpha5 » 7.x-3.x-dev
Issue summary: View changes
Status: Active » Needs review
StatusFileSize
new4.33 KB

Have added a sanitization function that is called so all (currently just the one) transforms on the name can be done in one place.

Have added an update hook that copies existing vars to the new format.

Have added tests that validate the new variable names.

Have performed code standards updates to the functions touched.

Testing needed.

Status: Needs review » Needs work
gold’s picture

Status: Needs work » Active

Hmm... The CI appears to be broken. Will requeue for testing again later.

Error response from daemon: Get https://registry-1.docker.io/v2/drupalci/php-7.1-apache/manifests/production: received unexpected HTTP status: 503 Service Unavailable

gold’s picture

Status: Active » Needs review

Looking good :)

philltran’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new160.6 KB

The patch applied cleanly to dev version of module.

The update script renamed existing keys to use "_" instead of "-".

I testing creating new field after patch and key name also correctly used "_".

Screenshot of Variable Table

@Gold thanks for the addressing this issue.

andrey.troeglazov’s picture

Assigned: Unassigned » andrey.troeglazov

  • Gold authored 547a05f on 7.x-3.x
    Issue #1368916 by Gold, philltran: Use underscores instead of dashes in...
andrey.troeglazov’s picture

Status: Reviewed & tested by the community » Fixed
Issue tags: +HS release 7.x-3.0-beta10

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.