[wp-hackers] How do you store multiple plugin options
mikeschinkel at newclarity.net
Wed Mar 24 19:34:59 UTC 2010
On Mar 24, 2010, at 2:42 PM, Otto wrote:
> MySQL has search and replace capabilities which work very nicely,
> actually, and they can search and replace inside serialized data just
> as easily as they can in non-serialized data. You don't need a
> developer to adjust things.
I'm not wading into this debate but am curious how MySQL can replace data back into the database for PHP serialized data? Let's take, for example, the option for the Twenty Ten template (line break in the email are only for clarity):
Now if I run this in MySQL:
SET option_value = REPLACE(option_value,'/header.png','/new-header.png')
WHERE option_name='mods_Twenty Ten'
...it will corrupt the data from PHP's unserialize perspective because the string lengths will no longer be correct.
Is there some other way to update PHP Serialized arrays directly in MySQL that I do not know about?
More information about the wp-hackers