set_result example

$parsed_args = wp_parse_args( $args$defaults );

        $this->init();
        $this->upgrade_strings();

        if ( ! $language_updates ) {
            $language_updates = wp_get_translation_updates();
        }

        if ( empty( $language_updates ) ) {
            $this->skin->header();
            $this->skin->set_result( true );
            $this->skin->feedback( 'up_to_date' );
            $this->skin->bulk_footer();
            $this->skin->footer();
            return true;
        }

        if ( 'upgrader_process_complete' === current_filter() ) {
            $this->skin->feedback( 'starting_upgrade' );
        }

        // Remove any existing upgrade filters from the plugin/theme upgraders #WP29425 & #WP29230.
/** * Filters the result of WP_Upgrader::install_package(). * * @since 5.7.0 * * @param array|WP_Error $result Result from WP_Upgrader::install_package(). * @param array $hook_extra Extra arguments passed to hooked filters. */
        $result = apply_filters( 'upgrader_install_package_result', $result$options['hook_extra'] );

        $this->skin->set_result( $result );

        if ( is_wp_error( $result ) ) {
            if ( ! empty( $options['hook_extra']['temp_backup'] ) ) {
                $this->temp_restores[] = $options['hook_extra']['temp_backup'];

                /* * Restore the backup on shutdown. * Actions running on `shutdown` are immune to PHP timeouts, * so in case the failure was due to a PHP timeout, * it will still be able to properly restore the previous version. */
                
$defaults    = array(
            'clear_update_cache' => true,
        );
        $parsed_args = wp_parse_args( $args$defaults );

        $this->init();
        $this->upgrade_strings();

        $current = get_site_transient( 'update_plugins' );
        if ( ! isset( $current->response[ $plugin ] ) ) {
            $this->skin->before();
            $this->skin->set_result( false );
            $this->skin->error( 'up_to_date' );
            $this->skin->after();
            return false;
        }

        // Get the URL to the zip file.         $r = $current->response[ $plugin ];

        add_filter( 'upgrader_pre_install', array( $this, 'deactivate_plugin_before_upgrade' ), 10, 2 );
        add_filter( 'upgrader_pre_install', array( $this, 'active_before' ), 10, 2 );
        add_filter( 'upgrader_clear_destination', array( $this, 'delete_old_plugin' ), 10, 4 );
        
'clear_update_cache' => true,
        );
        $parsed_args = wp_parse_args( $args$defaults );

        $this->init();
        $this->upgrade_strings();

        // Is an update available?         $current = get_site_transient( 'update_themes' );
        if ( ! isset( $current->response[ $theme ] ) ) {
            $this->skin->before();
            $this->skin->set_result( false );
            $this->skin->error( 'up_to_date' );
            $this->skin->after();
            return false;
        }

        $r = $current->response[ $theme ];

        add_filter( 'upgrader_pre_install', array( $this, 'current_before' ), 10, 2 );
        add_filter( 'upgrader_post_install', array( $this, 'current_after' ), 10, 2 );
        add_filter( 'upgrader_clear_destination', array( $this, 'delete_old_theme' ), 10, 4 );
        if ( $parsed_args['clear_update_cache'] ) {
            
Home | Imprint | This part of the site doesn't use cookies.