Skip to content

Instantly share code, notes, and snippets.

@ckng
Created April 14, 2014 08:04
Show Gist options
  • Save ckng/10626186 to your computer and use it in GitHub Desktop.
Save ckng/10626186 to your computer and use it in GitHub Desktop.
Drupal 7: revert language column to "und" on locale uninstallation, this is not for site with multilanguage, only for site with unused/unconfigured locale
<?php
// Use this to identify possible table needs to be updated
// SELECT DISTINCT TABLE_NAME
// FROM INFORMATION_SCHEMA.COLUMNS
// WHERE COLUMN_NAME IN ('language')
// AND TABLE_SCHEMA='<YOUR_DATABASE>';
// include other custom fields
$tables = array(
'node',
'url_alias',
'field_data_body',
'field_data_comment_body',
'field_revision_body',
'field_revision_comment_body',
);
foreach ($tables as $table) {
db_update($table)
->fields(array(
'language' => 'und',
))
->execute();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment