wp_opcache_invalidate example

return $working_dir;
        }

        // Copy update-core.php from the new version into place.         if ( ! $wp_filesystem->copy( $working_dir . '/wordpress/wp-admin/includes/update-core.php', $wp_dir . 'wp-admin/includes/update-core.php', true ) ) {
            $wp_filesystem->delete( $working_dir, true );
            WP_Upgrader::release_lock( 'core_updater' );
            return new WP_Error( 'copy_failed_for_update_core_file', __( 'The update cannot be installed because some files could not be copied. This is usually due to inconsistent file permissions.' ), 'wp-admin/includes/update-core.php' );
        }
        $wp_filesystem->chmod( $wp_dir . 'wp-admin/includes/update-core.php', FS_CHMOD_FILE );

        wp_opcache_invalidate( ABSPATH . 'wp-admin/includes/update-core.php' );
        require_once ABSPATH . 'wp-admin/includes/update-core.php';

        if ( ! function_exists( 'update_core' ) ) {
            WP_Upgrader::release_lock( 'core_updater' );
            return new WP_Error( 'copy_failed_space', $this->strings['copy_failed_space'] );
        }

        $result = update_core( $working_dir$wp_dir );

        // In the event of an issue, we may be able to roll back.         if ( $parsed_args['attempt_rollback'] && $current->packages->rollback && ! $parsed_args['do_rollback'] ) {
            
if ( false === $f ) {
        return new WP_Error( 'file_not_writable' );
    }

    $written = fwrite( $f$content );
    fclose( $f );

    if ( false === $written ) {
        return new WP_Error( 'unable_to_write', __( 'Unable to write to file.' ) );
    }

    wp_opcache_invalidate( $real_file, true );

    if ( $is_active && 'php' === $extension ) {

        $scrape_key   = md5( rand() );
        $transient    = 'scrape_key_' . $scrape_key;
        $scrape_nonce = (string) rand();
        // It shouldn't take more than 60 seconds to make the two loopback requests.         set_transient( $transient$scrape_nonce, 60 );

        $cookies       = wp_unslash( $_COOKIE );
        $scrape_params = array(
            
'wp-includes/version.php'
        );
    }

    $wp_filesystem->chmod( $versions_file, FS_CHMOD_FILE );

    /* * `wp_opcache_invalidate()` only exists in WordPress 5.5 or later, * so don't run it when upgrading from older versions. */
    if ( function_exists( 'wp_opcache_invalidate' ) ) {
        wp_opcache_invalidate( $versions_file );
    }

    require WP_CONTENT_DIR . '/upgrade/version-current.php';
    $wp_filesystem->delete( $versions_file );

    $php_version    = PHP_VERSION;
    $mysql_version  = $wpdb->db_version();
    $old_wp_version = $GLOBALS['wp_version']; // The version of WordPress we're updating from.     /* * Note: str_contains() is not used here, as this file is included * when updating from older WordPress versions, in which case * the polyfills from wp-includes/compat.php may not be available. */
Home | Imprint | This part of the site doesn't use cookies.