Error when backing up root site

I am getting database errors when I attempt to backup the root site of a 250 site network. Here are the errors that I get:

[05-Jun-2013 15:55:33 UTC] WordPress database error Table 'pages.wp_2_options' doesn't exist for query SELECT option_value FROM wp_2_options WHERE option_name = 'wp_2_user_roles' LIMIT 1 made by do_action_ref_array, call_user_func_array, WPMUDEVSnapshot->snapshot_backup_cron_proc, WPMUDEVSnapshot->snapshot_ajax_backup_init, WPMUDEVSnapshot->snapshot_gather_item_files, snapshot_utility_get_blog_upload_path, switch_to_blog, WP_Roles->reinit, get_option
[05-Jun-2013 15:55:33 UTC] WordPress database error Table 'pages.wp_2_options' doesn't exist for query SELECT option_value FROM wp_2_options WHERE option_name = 'siteurl' LIMIT 1 made by do_action_ref_array, call_user_func_array, WPMUDEVSnapshot->snapshot_backup_cron_proc, WPMUDEVSnapshot->snapshot_ajax_backup_init, WPMUDEVSnapshot->snapshot_gather_item_files, snapshot_utility_get_blog_upload_path, wp_upload_dir, get_option
[05-Jun-2013 15:55:33 UTC] WordPress database error Table 'pages.wp_2_options' doesn't exist for query SELECT option_value FROM wp_2_options WHERE option_name = 'upload_path' LIMIT 1 made by do_action_ref_array, call_user_func_array, WPMUDEVSnapshot->snapshot_backup_cron_proc, WPMUDEVSnapshot->snapshot_ajax_backup_init, WPMUDEVSnapshot->snapshot_gather_item_files, snapshot_utility_get_blog_upload_path, wp_upload_dir, get_option
[05-Jun-2013 15:55:33 UTC] WordPress database error Table 'pages.wp_2_options' doesn't exist for query SELECT option_value FROM wp_2_options WHERE option_name = 'upload_url_path' LIMIT 1 made by do_action_ref_array, call_user_func_array, WPMUDEVSnapshot->snapshot_backup_cron_proc, WPMUDEVSnapshot->snapshot_ajax_backup_init, WPMUDEVSnapshot->snapshot_gather_item_files, snapshot_utility_get_blog_upload_path, wp_upload_dir, get_option
[05-Jun-2013 15:55:33 UTC] WordPress database error Table 'pages.wp_2_options' doesn't exist for query SELECT option_value FROM wp_2_options WHERE option_name = 'uploads_use_yearmonth_folders' LIMIT 1 made by do_action_ref_array, call_user_func_array, WPMUDEVSnapshot->snapshot_backup_cron_proc, WPMUDEVSnapshot->snapshot_ajax_backup_init, WPMUDEVSnapshot->snapshot_gather_item_files, snapshot_utility_get_blog_upload_path, wp_upload_dir, get_option

As you can see, the problem is that it is trying to backup tables that do not exist. The root site has an id of '1' and the table names should begin with "wp_1_". There is no site with id '2'. Subsites seem to backup just fine. I tried deleting the Snapshot and recreating it but the same errors occur.

This problem is on IIS7 with WordPress 3.5.

  • aristath

    Hello there @Terry, I hope you're well today!

    I haven't seen this issue before and it looks kind of weird... However I admit I've never used an IIS server so I don't know if there's an issue there.

    I have just notified the plugin developer about your issue, hopefully he'll be able to shed some light here.
    Please note though that plugin developers have a lot of responsibilities so this might take a bit longer than a normal ticket.

    Cheers,
    Ari.

  • Paul

    @Terry,

    I've seen this before and the user didn't want to work with me to figure out the issue.

    So deconstructing the first error (since they all are pretty much the same). The error provides the call stack of the PHP function involved. Starting with 'do_action_ref_array'. There is the sequence:

    do_action_ref_array -> (WP function)
    call_user_func_array -> (WP function)
    WPMUDEVSnapshot->snapshot_backup_cron_proc -> (Snapshot)
    WPMUDEVSnapshot->snapshot_ajax_backup_init -> (Snapshot)
    WPMUDEVSnapshot->snapshot_gather_item_files -> (Snapshot)
    snapshot_utility_get_blog_upload_path -> (Snapshot) Leave to call WP function
    switch_to_blog -> (WP function)
    WP_Roles->reinit -> (??? function)
    get_option (WP function) (abort)

    So what happens is the WP_Cron engine (the first two function lines) kick off and call the Snapshot function snapshot_backup_cron_proc. This starts the Snapshot archive creation processing. During that process initialization it needs to determine the upload path for the selected site. This should be the primary site. So Snapshot calls the WP internal functions 'switch_to_blog' which will in turn call 'wp_upload_dir'. Eventually the WP function get_option is failing with the SQL error.

    So really I'm not sure what is going on. I see the 'WP_Roles->reinit' I know this is not a WP function. Nor part of Snapshot. I'm guessing you are using a Roles mgmt plugin. I don't want to suggest you need to disable the plugin.

    Have you tried deleting the snapshot configuration for the primary site? And recreate? I'm assuming the backup attempts fail to produce a zip archive for the primary site.

  • Terry

    We are not using a role management plugin. There is indeed a WP_Roles class in WordPress core with a "reinit" method: http://phpdoc.wordpress.org/trunk/WordPress/User/WP_Roles.html

    That particular method is new in WordPress 3.5, if I'm reading the documentation correctly.

    I have tried removing the root snapshot configuration and recreating it but the same errors and behavior occur. No zip file is created when it runs. The only sign that it attempted to backup at all are the PHP errors that I reported previously.

    At this point I have no idea what to do to solve the problem. Let me know if there is any information I can provide that would be helpful.

  • Paul

    @Terry,

    Ok. Time to dig into this. so you are running IIS7. Not a suspect so far. What other plugins are you running? I've checked the logs for three of my development sites and don't see those errors. Want to try first and setup a matched site similar as possible to yours.

    1. Plugins active
    2. On the Snapshot > Settings page there is a section System Info showing various pieces of information about your setup. PHP version, MySQL version, various PHP settings.

  • Terry

    I have attached the requested system info. The following plugins are active on the root site: Akismet, CSS, Jetpack by WordPress.com, Multisite Privacy, Snapshot (of course), WPMU DEV Dashboard, WPMU Ldap Authentication, WPMU Plugin Stats, WPMU Theme Info, Google Analyticator, Graceful Pull-Quotes, Simple Footnotes.

    As you can see there are a lot of plugins active on the root site. This a production environment so I cannot turn them off for the most part.

    The problem seems to be even more complicated than I first thought.

    I setup Snapshot on a completely different install of WordPress that is nearly identical to the one that first presented this error. I figured that it would either work fine or exhibit the same problem. What I actually got was somewhere in between. I still get the same db table related errors in the php error log but the backup does finish.

    My next step is to setup a completely virgin WP network and see what happens without any other plugins installed.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.