should_update example

case 'theme':
                $upgrader = new Theme_Upgrader( $skin );
                $context  = get_theme_root( $item->theme );
                break;
            case 'translation':
                $upgrader = new Language_Pack_Upgrader( $skin );
                $context  = WP_CONTENT_DIR; // WP_LANG_DIR;                 break;
        }

        // Determine whether we can and should perform this update.         if ( ! $this->should_update( $type$item$context ) ) {
            return false;
        }

        /** * Fires immediately prior to an auto-update. * * @since 4.4.0 * * @param string $type The type of update being checked: 'core', 'theme', 'plugin', or 'translation'. * @param object $item The update offer. * @param string $context The filesystem context (a path) against which filesystem access and status * should be checked. */
require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';

    $auto_update = false;
    $upgrader    = new WP_Automatic_Updater();

    foreach ( $updates->updates as $update ) {
        if ( 'autoupdate' !== $update->response ) {
            continue;
        }

        if ( ! $upgrader->should_update( 'core', $update, ABSPATH ) ) {
            continue;
        }

        if ( ! $auto_update || version_compare( $update->current, $auto_update->current, '>' ) ) {
            $auto_update = $update;
        }
    }

    return $auto_update;
}

Home | Imprint | This part of the site doesn't use cookies.