Support

Account

Home Forums ACF PRO Database upgrade for multisite

Solved

Database upgrade for multisite

  • Is there any way to perform ACF PRO database upgrade for every site on a multisite instead of having to manually do it for each site?

    I have over 200 sites and it is very time consuming to do it manually. (WordPress itself has a nice feature to run database upgrades for all sites.)

  • I don’t think that there is a good way to do this. If you looked at the upgrade code in ACF you could probably create a cron that could do the work, but I think that it would take you as long to code this as it would to do the work manually for the sites. Luckily, DB upgrades for ACF happen rarely. The current upgrade is due to the change for using term meta. It could be that the reason it does not try to upgrade all sites at once could be because it can be a time consuming process, depending on the sites and if you have a lot of fields associated with terms. There is a possibility that it can time out. There have been reports of this happening on single site installations where there are a very large number of terms.

    Sorry I can’t help you more.

  • Oh, well then I’ll just bite the bullet this time, I guess. Thanks anyway for the informative answer, it’s nice to know it won’t happen too often. I’ll go ahead and mark this solved with your answer, even though it wasn’t the answer I was hoping for 🙂

  • You could also open a new support ticket https://support.advancedcustomfields.com/new-ticket/, this is a more direct path to get the attention of the developer. I do know that he was in a hurry to get 5.5 released, it was actually several months later that he wanted it to be. He might consider making this more friendly in the future. I do know that he plans on releasing a free version of ACF this year, at least that’s what his most recent blog states. https://www.advancedcustomfields.com/blog/acf-2016-year-review/. When upgrading from 4 to 5 there will be 2 big DB upgrades that need to be done. The original from 4 to 5 and then this one that deals with term meta.

  • I think this feature already exists, need to visit

    /wp-admin/network/index.php?page=acf-upgrade-network

  • That would have been great, if it worked.

    When I try to access that page I only see “You do not have sufficient permissions to access this page.” (and I am a super admin).

    Digging into this I found this thread that had a slightly different URL:
    /wp-admin/network/update-core.php?page=acf-upgrade
    but the result is the same (and that is what that thread is about).

  • When I did the update on one of my multisite installs is worked. Make sure that you’re in the main site when you try to access that page. If that doesn’t work, I’m not sure. There have been topics about not being able to get to that page but I don’t know what causes the issue.

  • I’ve tried from the main site as well. Wonder if it has anything to do with WordPress being installed in a sub directory?

    Anyway, as you said earlier, I should probably open a support ticket instead, I am a paying customer after all.

  • In your OP I didn’t realize that you could not even get to the upgrade page. On that page there is a list of sites and you can choose which to upgrade.

    More than likely this does have something to do with being installed in a sub directory and in that case it is definitely a bug that you should submit a ticket for.

  • @adrian-b

    You likely already have this solved but since I had the same issue I wanted to explain my solution.

    Please note I am not a programmer and this was just to fix this for my needs.

    In /advanced-custom-fields/admin/install-network.php on line 257 there is reference to the function get_sites():
    $_sites = get_sites();

    This function has a default value of 100 unless otherwise specified. Source: https://developer.wordpress.org/reference/functions/get_sites/

    If you replace line 257 with the below, you have more control over how many sites can be listed by the updater.

    $_sites = get_sites( 
    		[
    			'public'  => 1,
    			'number'  => 500,
    			'orderby' => 'id',
    			'order'   => 'ASC',
    			// 'offset'   => 500,
    		]
    );

    This will change the number of sites loaded from the default of 100 to 500. If the page shows a blank, you can lower this number. You can also raise it if your server settings can handle more.

    In your case you were getting a “Sorry, you are not allowed to access this page.”-type message. For me, I overrode the checker on line 45 from:
    $prompt = false;
    to
    $prompt = true;

    If you are not able to load all of your sites still, you can use the “offset” parameter to set which site the function will begin with. For example, the above will run the first 500 sites, uncomment the “offset” line and it will do 500-1000. Change to 1000 and it will then run 1000-1500.

    Once your updates are done you can undo the above changes.

    Hope this helps anyone else searching for an answer.

Viewing 10 posts - 1 through 10 (of 10 total)

The topic ‘Database upgrade for multisite’ is closed to new replies.