Esempio n. 1
0
function acf_update_550()
{
    //acf_log('acf_update_550');
    // action for 3rd party
    do_action('acf/update_550');
    // bail early if no table
    if (!acf_isset_termmeta()) {
        update_option('acf_update_550_termmeta', 1);
        echo __('Term meta upgrade not possible (termmeta table does not exist)', 'acf');
        return;
    }
    // termmeta
    acf_update_550_termmeta();
    // version
    acf_update_db_version('5.5.0');
}
Esempio n. 2
0
 function ajax_db_update()
 {
     // options
     $options = wp_parse_args($_POST, array('nonce' => '', 'blog_id' => ''));
     // validate
     if (!wp_verify_nonce($options['nonce'], 'acf_db_update')) {
         wp_send_json_error(array('message' => __('Error validating request', 'acf')));
     }
     // switch blog
     if ($options['blog_id']) {
         switch_to_blog($options['blog_id']);
     }
     // vars
     $updates = acf_get_db_updates();
     $message = '';
     // bail early if no updates
     if (empty($updates)) {
         wp_send_json_error(array('message' => __('No updates available.', 'acf')));
     }
     // install updates
     foreach ($updates as $version => $callback) {
         $message .= $this->run_update($callback);
     }
     // updates complete
     acf_update_db_version();
     // return
     wp_send_json_success(array('message' => $message));
 }