/** * WPMU postmeta upgrade function * * Hooked to 'wpmu_upgrade_site' * * This function is run when Site Admin performs Site Admin Upgrade * Hooked into 'wpmu_upgrade_site', this is run once per Blog * Tests if Blog needs upgrading and, if so, runs the postmeta upgrade function * * @param int $id WPMU Blog ID * @uses dfcg_update_postmeta() * @since 3.2 */ function dfcg_admin_postmeta_upgrade_wpmu($id) { $upgrade = get_blog_option($id, 'dfcg_plugin_postmeta_upgrade'); if ($upgrade['upgraded'] !== 'completed') { $data = dfcg_update_postmeta(); $data['upgraded'] = 'completed'; update_blog_option($id, 'dfcg_plugin_postmeta_upgrade', $data, false); echo 'Dynamic Content Gallery v3.2 postmeta upgrade completed for blog ID: ' . $id; } else { echo 'Dynamic Content Gallery v3.2 postmeta upgrade not required for blog ID: ' . $id; } }
dfcg_load_textdomain(); // Load Settings Page JS dfcg_options_js(); // Handle the form submission Page 1 if (isset($_POST['dfcg_upgrade_1'])) { // Is the user allowed to do this? if (function_exists('current_user_can') && !current_user_can('manage_options')) { die(__('Sorry. You do not have permission to do this.')); } // check the nonce check_admin_referer('dfcg_plugin_postmeta_upgrade'); // build the array from input (1 item) $input = $_POST['dfcg_plugin_postmeta_upgrade']; // Make sure we only run this once if ($input['upgraded'] == 'started') { $data = dfcg_update_postmeta(); if ($data) { // Update the $input array with results from dfcg_update_postmeta() function $input['postmetas'] = $data['postmetas']; $input['modified'] = $data['modified']; $input['deleted'] = $data['deleted']; $input['dfcg-image'] = $data['dfcg-image']; $input['dfcg-desc'] = $data['dfcg-desc']; $input['dfcg-link'] = $data['dfcg-link']; } // Update the db options update_option('dfcg_plugin_postmeta_upgrade', $input); } } // Get the updated db options $dfcg_postmeta_upgrade = get_option('dfcg_plugin_postmeta_upgrade');