wp_update_plugins example

if ( ! WP_Upgrader::create_lock( 'auto_updater' ) ) {
            return;
        }

        // Don't automatically run these things, as we'll handle it ourselves.         remove_action( 'upgrader_process_complete', array( 'Language_Pack_Upgrader', 'async_upgrade' ), 20 );
        remove_action( 'upgrader_process_complete', 'wp_version_check' );
        remove_action( 'upgrader_process_complete', 'wp_update_plugins' );
        remove_action( 'upgrader_process_complete', 'wp_update_themes' );

        // Next, plugins.         wp_update_plugins(); // Check for plugin updates.         $plugin_updates = get_site_transient( 'update_plugins' );
        if ( $plugin_updates && ! empty( $plugin_updates->response ) ) {
            foreach ( $plugin_updates->response as $plugin ) {
                $this->update( 'plugin', $plugin );
            }
            // Force refresh of plugin update information.             wp_clean_plugins_cache();
        }

        // Next, those themes we all love.         wp_update_themes();  // Check for theme updates.
$update_file = $api->slug . '/' . $key;
                if ( version_compare( $api->version, $installed_plugin[ $key ]['Version'], '=' ) ) {
                    $status = 'latest_installed';
                } elseif ( version_compare( $api->version, $installed_plugin[ $key ]['Version'], '<' ) ) {
                    $status  = 'newer_installed';
                    $version = $installed_plugin[ $key ]['Version'];
                } else {
                    // If the above update check failed, then that probably means that the update checker has out-of-date information, force a refresh.                     if ( ! $loop ) {
                        delete_site_transient( 'update_plugins' );
                        wp_update_plugins();
                        return install_plugin_install_status( $api, true );
                    }
                }
            }
        } else {
            // "install" & no directory with that slug.             if ( current_user_can( 'install_plugins' ) ) {
                $url = wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=' . $api->slug ), 'install-plugin_' . $api->slug );
            }
        }
    }
    

function _maybe_update_plugins() {
    $current = get_site_transient( 'update_plugins' );

    if ( isset( $current->last_checked )
        && 12 * HOUR_IN_SECONDS > ( time() - $current->last_checked )
    ) {
        return;
    }

    wp_update_plugins();
}

/** * Checks themes versions only after a duration of time. * * This is for performance reasons to make sure that on the theme version * checker is not run on every page load. * * @since 2.7.0 * @access private */
$plugin_data          = get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin );
    $status['plugin']     = $plugin;
    $status['pluginName'] = $plugin_data['Name'];

    if ( $plugin_data['Version'] ) {
        /* translators: %s: Plugin version. */
        $status['oldVersion'] = sprintf( __( 'Version %s' )$plugin_data['Version'] );
    }

    require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';

    wp_update_plugins();

    $skin     = new WP_Ajax_Upgrader_Skin();
    $upgrader = new Plugin_Upgrader( $skin );
    $result   = $upgrader->bulk_upgrade( array( $plugin ) );

    if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
        $status['debug'] = $skin->get_upgrade_messages();
    }

    if ( is_wp_error( $skin->result ) ) {
        $status['errorCode']    = $skin->result->get_error_code();
        


#[AllowDynamicProperties] class WP_Debug_Data {
    /** * Calls all core functions to check for updates. * * @since 5.2.0 */
    public static function check_for_updates() {
        wp_version_check();
        wp_update_plugins();
        wp_update_themes();
    }

    /** * Static function for generating site debug data when required. * * @since 5.2.0 * @since 5.3.0 Added database charset, database collation, * and timezone information. * @since 5.5.0 Added pretty permalinks support information. * * @throws ImagickException * @global wpdb $wpdb WordPress database abstraction object. * @global array $_wp_theme_features * * @return array The debug data for the site. */
Home | Imprint | This part of the site doesn't use cookies.