Skip to content

Instantly share code, notes, and snippets.

@PhilETaylor
Last active November 7, 2016 16:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save PhilETaylor/8737e58ebba822ca72fe053e2b4f1047 to your computer and use it in GitHub Desktop.
Save PhilETaylor/8737e58ebba822ca72fe053e2b4f1047 to your computer and use it in GitHub Desktop.
Fix for corrupt JSON strings in Joomla database
-- Phil Taylor <phil@phil-taylor.com>
-- @see https://github.com/joomla/joomla-cms/issues/12460
-- replace jos_ with your database prefix (left as jos and not #__ for syntax highlighting)
-- This is not a COMPLETE fix, this only fixes SOME of the core columns in tables that contain JSON.
-- BACKUP YOUR DATABASE BEFORE RUNNING THIS!!!!!!
UPDATE jos_modules SET params = "{}" WHERE params = "" OR params = '{\"\"}' OR params = '{\\\"\\\"}';
UPDATE jos_menu SET params = "{}" WHERE params = "" OR params = '{\"\"}' OR params = '{\\\"\\\"}';
UPDATE jos_extensions SET params = "{}" WHERE params = "" OR params = '{\"\"}' OR params = '{\\\"\\\"}';
UPDATE jos_assets SET rules = "{}" WHERE rules = "" OR rules = '{\"\"}' OR rules = '{\\\"\\\"}';
-- Run the above SQL FIRST and see if that fixes your site - if not continue and run these additional sql queries, you may not need these!
-- DO NOT run this if you are using Widgetkit because they stupidly have json, within json...
UPDATE jos_modules SET params = REPLACE(params, '\\"', '"');
UPDATE jos_menu SET params = REPLACE(params, '\\"', '"');
UPDATE jos_extensions SET params = REPLACE(params, '\\"', '"');
UPDATE jos_assets SET rules = REPLACE(rules, '\\"', '"');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment