New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moved Sites, Lost Settings #77

Closed
vanpop opened this Issue Oct 20, 2011 · 16 comments

Comments

Projects
None yet
5 participants
@vanpop
Contributor

vanpop commented Oct 20, 2011

Exported a multisite DB that has options framework plugin working on many sites. Imported the SQL, but only see default settings for each site on it's settings page. I found that the DB has the data after the import, and it looks correct, but once I visit a subsite's options framework settings page, the values are overwritten in the DB by the defaults.

If I comment out the "optionsframework_setdefaults();" line at around 152 in options-framework.php, the settings aren't overwritten in the DB after visiting the site settings page, but they aren't displayed on the settings page either.

@devinsays

This comment has been minimized.

Show comment
Hide comment
@devinsays

devinsays Oct 20, 2011

Owner

Interesting. I would assume the SQL export would be exactly the same.

The code checks to see if the theme name (or unique theme id) is already saved in the options framework settings:

$optionsframework_settings = get_option('optionsframework');
$option_name = $optionsframework_settings['id'];

If it's not there yet (or if it's empty because the settings have been deleted), it sets the defaults.

It might be an order of operations issue. What happens if you deactive the plugin, import the database, and then reactivate the plugin? Can you verify that the plugin and theme options are exactly the same at that point? Then, when you reactivate, is that the point where options are deleted?

Owner

devinsays commented Oct 20, 2011

Interesting. I would assume the SQL export would be exactly the same.

The code checks to see if the theme name (or unique theme id) is already saved in the options framework settings:

$optionsframework_settings = get_option('optionsframework');
$option_name = $optionsframework_settings['id'];

If it's not there yet (or if it's empty because the settings have been deleted), it sets the defaults.

It might be an order of operations issue. What happens if you deactive the plugin, import the database, and then reactivate the plugin? Can you verify that the plugin and theme options are exactly the same at that point? Then, when you reactivate, is that the point where options are deleted?

@vanpop

This comment has been minimized.

Show comment
Hide comment
@vanpop

vanpop Oct 20, 2011

Contributor

Yeah, same here. It's been driving me crazy all day. The SQL import does look exactly the same. The unique theme ID is there, all of the data is there. So weird.

I'm going to try the deactivating/reactivating now. I'll let you know how it goes.

Contributor

vanpop commented Oct 20, 2011

Yeah, same here. It's been driving me crazy all day. The SQL import does look exactly the same. The unique theme ID is there, all of the data is there. So weird.

I'm going to try the deactivating/reactivating now. I'll let you know how it goes.

@vanpop

This comment has been minimized.

Show comment
Hide comment
@vanpop

vanpop Oct 20, 2011

Contributor

Actually, just realized, the plugin is activated in the full import. I'll have to deactivate, export, and then re-import.

Contributor

vanpop commented Oct 20, 2011

Actually, just realized, the plugin is activated in the full import. I'll have to deactivate, export, and then re-import.

@devinsays

This comment has been minimized.

Show comment
Hide comment
@devinsays

devinsays Oct 20, 2011

Owner

Yes, or just rename it in the directory of the new site so it can't activate.

Owner

devinsays commented Oct 20, 2011

Yes, or just rename it in the directory of the new site so it can't activate.

@vanpop

This comment has been minimized.

Show comment
Hide comment
@vanpop

vanpop Oct 20, 2011

Contributor

Ha. Right. Good thinking!

Ok, I imported the DB with the plugin disabled, and the options framework stuff looked good in the DB.

After network activating the plugin, the DB settings still look correct. It isn't until I visit the subsite's dashboard (or of settings page) that the settings are set to the defaults in the DB.

Contributor

vanpop commented Oct 20, 2011

Ha. Right. Good thinking!

Ok, I imported the DB with the plugin disabled, and the options framework stuff looked good in the DB.

After network activating the plugin, the DB settings still look correct. It isn't until I visit the subsite's dashboard (or of settings page) that the settings are set to the defaults in the DB.

@devinsays

This comment has been minimized.

Show comment
Hide comment
@devinsays

devinsays Oct 20, 2011

Owner

That's really strange. Sorry it's causing you issues. I'm headed to bed right now, but I'll look through the functions tomorrow to see if there's anything that might be triggering it. At the moment I have no idea why it would overwrite.

You have the exact same themes activated in the new install right, same code?

Owner

devinsays commented Oct 20, 2011

That's really strange. Sorry it's causing you issues. I'm headed to bed right now, but I'll look through the functions tomorrow to see if there's anything that might be triggering it. At the moment I have no idea why it would overwrite.

You have the exact same themes activated in the new install right, same code?

@vanpop

This comment has been minimized.

Show comment
Hide comment
@vanpop

vanpop Oct 20, 2011

Contributor

No problem! I'm headed to bed also. Thanks for the great plugin and all of your help. I'll be playing with it again tomorrow-And yes, same theme, same exact code.

On Oct 20, 2011, at 12:27 AM, Devin Pricereply@reply.github.com wrote:

That's really strange. Sorry it's causing you issues. I'm headed to bed right now, but I'll look through the functions tomorrow to see if there's anything that might be triggering it. At the moment I have no idea why it would overwrite.

You have the exact same themes activated in the new install right, same code?

Reply to this email directly or view it on GitHub:
#77 (comment)

Contributor

vanpop commented Oct 20, 2011

No problem! I'm headed to bed also. Thanks for the great plugin and all of your help. I'll be playing with it again tomorrow-And yes, same theme, same exact code.

On Oct 20, 2011, at 12:27 AM, Devin Pricereply@reply.github.com wrote:

That's really strange. Sorry it's causing you issues. I'm headed to bed right now, but I'll look through the functions tomorrow to see if there's anything that might be triggering it. At the moment I have no idea why it would overwrite.

You have the exact same themes activated in the new install right, same code?

Reply to this email directly or view it on GitHub:
#77 (comment)

@vanpop

This comment has been minimized.

Show comment
Hide comment
@vanpop

vanpop Oct 20, 2011

Contributor

Actually just realized, it doesn't reset the DB with defaults if you visit the dashboard, my mistake. Only happens when loading the of settings screen. -- Scratch that. It does set to defaults when viewing dashboard

Contributor

vanpop commented Oct 20, 2011

Actually just realized, it doesn't reset the DB with defaults if you visit the dashboard, my mistake. Only happens when loading the of settings screen. -- Scratch that. It does set to defaults when viewing dashboard

@devinsays

This comment has been minimized.

Show comment
Hide comment
@devinsays

devinsays Oct 20, 2011

Owner

Okay, that helps to close in on it.

So, after the SQL import you can visit the site and all the options appear to be set correctly? You can get a var_dump of all the saved options and they are able to be accessed?

Then, when you visit the options framework admin page for the first time after the import- that's when the reset happens?

Owner

devinsays commented Oct 20, 2011

Okay, that helps to close in on it.

So, after the SQL import you can visit the site and all the options appear to be set correctly? You can get a var_dump of all the saved options and they are able to be accessed?

Then, when you visit the options framework admin page for the first time after the import- that's when the reset happens?

@vanpop

This comment has been minimized.

Show comment
Hide comment
@vanpop

vanpop Oct 20, 2011

Contributor

Further experimenting led me to find that the uploaded file field url's seem to be what is stopping $settings = get_option($option_name); from returning a value. It looks like the serialization is broken when importing (even though I'm doing a straight SQL import, not through WP). The character counts are incorrect.

Contributor

vanpop commented Oct 20, 2011

Further experimenting led me to find that the uploaded file field url's seem to be what is stopping $settings = get_option($option_name); from returning a value. It looks like the serialization is broken when importing (even though I'm doing a straight SQL import, not through WP). The character counts are incorrect.

@vanpop

This comment has been minimized.

Show comment
Hide comment
@vanpop

vanpop Oct 20, 2011

Contributor

Verified by running this script, which did fix the serialization, and then saved settings showed:

http://davidcoveney.com/575/php-serialization-fix-for-wordpress-migrations/

Contributor

vanpop commented Oct 20, 2011

Verified by running this script, which did fix the serialization, and then saved settings showed:

http://davidcoveney.com/575/php-serialization-fix-for-wordpress-migrations/

@vanpop

This comment has been minimized.

Show comment
Hide comment
@vanpop

vanpop Oct 21, 2011

Contributor

Figured it out. The issue that occurs is that when the find and replace is run on the sql dump to switch to the new domain, the string is changed in the array, but not the character count that accompanies it, rendering them incorrect.

Contributor

vanpop commented Oct 21, 2011

Figured it out. The issue that occurs is that when the find and replace is run on the sql dump to switch to the new domain, the string is changed in the array, but not the character count that accompanies it, rendering them incorrect.

@vanpop vanpop closed this Oct 21, 2011

@jahvi

This comment has been minimized.

Show comment
Hide comment
@jahvi

jahvi Oct 21, 2011

I was having the same problem, glad to know what was causing it thanks!

jahvi commented Oct 21, 2011

I was having the same problem, glad to know what was causing it thanks!

@devinsays

This comment has been minimized.

Show comment
Hide comment
@devinsays

devinsays Oct 22, 2011

Owner

Glad you figured it out. I posted a link from the plugin page in case anyone else has the issue.

Owner

devinsays commented Oct 22, 2011

Glad you figured it out. I posted a link from the plugin page in case anyone else has the issue.

@stueynet

This comment has been minimized.

Show comment
Hide comment
@stueynet

stueynet Oct 27, 2011

Yeah that script works. Thanks everyone!

stueynet commented Oct 27, 2011

Yeah that script works. Thanks everyone!

@swaranan

This comment has been minimized.

Show comment
Hide comment
@swaranan

swaranan May 27, 2015

i have a problem ..When i deactivate the plugin the whole option panel got disappear...

swaranan commented May 27, 2015

i have a problem ..When i deactivate the plugin the whole option panel got disappear...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment