Make WordPress Core

Ticket #51686: fake_update.4.diff

File fake_update.4.diff, 3.2 KB (added by kirasong, 5 years ago)

Example of how to test this change. Includes allowing the testing of dev update-core.php rather than the update package's one.

  • src/wp-admin/includes/class-core-upgrader.php

    diff --git src/wp-admin/includes/class-core-upgrader.php src/wp-admin/includes/class-core-upgrader.php
    index 7acbaaed49..2d3c4cbb85 100644
    class Core_Upgrader extends WP_Upgrader { 
    153153                        return $working_dir;
    154154                }
    155155
     156/*
    156157                // Copy update-core.php from the new version into place.
    157158                if ( ! $wp_filesystem->copy( $working_dir . '/wordpress/wp-admin/includes/update-core.php', $wp_dir . 'wp-admin/includes/update-core.php', true ) ) {
    158159                        $wp_filesystem->delete( $working_dir, true );
    class Core_Upgrader extends WP_Upgrader { 
    160161                        return new WP_Error( 'copy_failed_for_update_core_file', __( 'The update cannot be installed because we will be unable to copy some files. This is usually due to inconsistent file permissions.' ), 'wp-admin/includes/update-core.php' );
    161162                }
    162163                $wp_filesystem->chmod( $wp_dir . 'wp-admin/includes/update-core.php', FS_CHMOD_FILE );
     164*/
    163165
    164166                wp_opcache_invalidate( ABSPATH . 'wp-admin/includes/update-core.php' );
    165167                require_once ABSPATH . 'wp-admin/includes/update-core.php';
  • src/wp-admin/includes/update-core.php

    diff --git src/wp-admin/includes/update-core.php src/wp-admin/includes/update-core.php
    index 6d9d243ddd..9d0452dbcb 100644
    function update_core( $from, $to ) { 
    946946        }
    947947
    948948        $wp_filesystem->chmod( $versions_file, FS_CHMOD_FILE );
     949
     950        /*
     951         * `wp_opcache_invalidate()` only exists in WordPress 5.5 or later,
     952         * so don't run it when upgrading from older versions.
     953         */
     954        if ( function_exists( 'wp_opcache_invalidate' ) ) {
     955                wp_opcache_invalidate( $versions_file );
     956        }
     957
    949958        require WP_CONTENT_DIR . '/upgrade/version-current.php';
    950959        $wp_filesystem->delete( $versions_file );
    951960
    function update_core( $from, $to ) { 
    11171126                        $result = new WP_Error( 'copy_failed_for_version_file', __( 'The update cannot be installed because we will be unable to copy some files. This is usually due to inconsistent file permissions.' ), 'wp-includes/version.php' );
    11181127                }
    11191128                $wp_filesystem->chmod( $to . 'wp-includes/version.php', FS_CHMOD_FILE );
     1129
     1130                /*
     1131                 * `wp_opcache_invalidate()` only exists in WordPress 5.5 or later,
     1132                 * so don't run it when upgrading from older versions.
     1133                 */
     1134                if ( function_exists( 'wp_opcache_invalidate' ) ) {
     1135                        wp_opcache_invalidate( $to . 'wp-includes/version.php' );
     1136                }
    11201137        }
    11211138
    11221139        // Check to make sure everything copied correctly, ignoring the contents of wp-content.
  • src/wp-includes/version.php

    diff --git src/wp-includes/version.php src/wp-includes/version.php
    index 566625f027..37d8cfba67 100644
     
    1313 *
    1414 * @global string $wp_version
    1515 */
    16 $wp_version = '5.8-alpha-50427-src';
     16$wp_version = '5.5-alpha-50427-src';
    1717
    1818/**
    1919 * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
  • tools/local-env/php-config.ini

    diff --git tools/local-env/php-config.ini tools/local-env/php-config.ini
    index 1f385e924c..d8aa4622d1 100644
     
    11upload_max_filesize = 1G
    22post_max_size = 1G
     3opcache.enable = 1
     4opcache.validate_timestamps = 0