Skip to content

Instantly share code, notes, and snippets.

@doublejosh
Last active October 3, 2015 02:28
Show Gist options
  • Save doublejosh/2371881 to your computer and use it in GitHub Desktop.
Save doublejosh/2371881 to your computer and use it in GitHub Desktop.
Move core block settings across to a new theme
# Reset blocks to remove standard placements.
UPDATE block SET status = 0, region = -1 WHERE theme = 'OLD-THEME';
# Pull data across.
UPDATE block AS export_blocks
INNER JOIN block AS import_blocks
ON import_blocks.module = export_blocks.module
AND import_blocks.delta = export_blocks.delta
SET
export_blocks.weight = import_blocks.weight,
export_blocks.region = REPLACE( REPLACE(import_blocks.region, 'OLD-REGION1', 'NEW-REGION1'), 'OLD-REGION2', 'NEW-REGION2'),
export_blocks.visibility = import_blocks.visibility,
export_blocks.pages = import_blocks.pages,
export_blocks.title = import_blocks.title,
export_blocks.status = import_blocks.status
WHERE export_blocks.theme = 'NEW-THEME'
AND import_blocks.theme = 'OLD-THEME';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment