Skip to content

Commit

Permalink
Merge pull request #5025 from Automattic/develop
Browse files Browse the repository at this point in the history
Staging release: v20231114.1
  • Loading branch information
WPprodigy authored Nov 14, 2023
2 parents f9260a7 + f32eb16 commit 9cd3091
Show file tree
Hide file tree
Showing 17 changed files with 109 additions and 25 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Request to build Docker image
uses: actions/github-script@v6
uses: actions/github-script@v7
with:
github-token: ${{ secrets.WPCOM_VIP_BOT_TOKEN }}
script: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/changelog-summary-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ jobs:
uses: actions/checkout@v4.1.1

- name: Setup PHP
uses: shivammathur/setup-php@2.27.0
uses: shivammathur/setup-php@2.27.1
with:
php-version: '7.4'

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/changelog-summary-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
uses: actions/checkout@v4.1.1

- name: Setup PHP
uses: shivammathur/setup-php@2.27.0
uses: shivammathur/setup-php@2.27.1
with:
php-version: '7.4'

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/core-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ jobs:
cache-dependency-path: 'wordpress/package-lock.json'

- name: Set up PHP
uses: shivammathur/setup-php@2.27.0
uses: shivammathur/setup-php@2.27.1
with:
php-version: 8.0
coverage: none
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
uses: actions/checkout@v4.1.1

- name: Set up PHP
uses: shivammathur/setup-php@2.27.0
uses: shivammathur/setup-php@2.27.1
with:
coverage: none
php-version: "8.0"
Expand Down
19 changes: 19 additions & 0 deletions __tests__/e2e/lib/pages/wp-editor-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ const selectors = {
desktopEditorSidebarButton: 'button[aria-label="Block editor sidebar"]:visible',
desktopDashboardLink: 'a[aria-description="Returns to the dashboard"]:visible',
mobileDashboardLink: 'a[aria-current="page"]:visible',

// Choose a pattern
choosePatternCloseButton: '.components-modal__screen-overlay .components-modal__header button',
};

export class EditorPage {
Expand Down Expand Up @@ -81,6 +84,22 @@ export class EditorPage {
} );
}

async dismissPatternSelector(): Promise<void> {
try {
await this.page.waitForSelector( selectors.choosePatternCloseButton, {
state: 'visible',
timeout: 5000,
} );
} catch ( err ) {
return;
}

const closeButton = this.page.locator( selectors.choosePatternCloseButton );
return closeButton.click( {
delay: 20,
} );
}

/**
* Enter Title of page or post
*
Expand Down
1 change: 1 addition & 0 deletions __tests__/e2e/specs/page__publish.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ test( 'publish a Page', async ( { page } ) => {

await test.step( 'Write Page', async () => {
editorPage = new EditorPage( page );
await editorPage.dismissPatternSelector();
await editorPage.enterTitle( titleText );
await editorPage.enterText( bodyText );
await editorPage.addImage( 'test_media/image_01.jpg' );
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"erusev/parsedown": "1.7.4",
"dms/phpunit-arraysubset-asserts": "0.5.0",
"yoast/phpunit-polyfills": "2.0.0",
"johnpbloch/wordpress-core": "6.3.2",
"johnpbloch/wordpress-core": "6.4.1",
"wp-phpunit/wp-phpunit": "6.3.1",
"wp-cli/wp-cli": "2.9.0"
},
Expand Down
16 changes: 8 additions & 8 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 25 additions & 5 deletions files/class-wp-filesystem-vip.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
require_once __DIR__ . '/class-api-client.php';

use WP_Error;
use WP_Filesystem_Base;
use WP_Filesystem_Direct;

class WP_Filesystem_VIP extends \WP_Filesystem_Base {
Expand All @@ -24,6 +25,10 @@ public function __construct( $dependencies ) {
$this->method = 'vip';
$this->errors = new WP_Error();

if ( ! is_array( $dependencies ) || 2 !== count( $dependencies ) ) {
$dependencies = request_filesystem_credentials( site_url() );
}

list( $filesystem_uploads, $filesystem_direct ) = $dependencies;

$this->uploads = $filesystem_uploads;
Expand Down Expand Up @@ -218,6 +223,10 @@ public function copy( $source, $destination, $overwrite = false, $mode = false )
return false;
}

if ( $source_transport instanceof WP_Filesystem_Direct && $destination_transport instanceof WP_Filesystem_Direct ) {
return $source_transport->copy( $source, $destination, $overwrite, $mode );
}

$destination_exists = $destination_transport->exists( $destination );
if ( ! $overwrite && $destination_exists ) {
/* translators: 1: destination file path 2: overwrite param 3: `true` boolean value */
Expand Down Expand Up @@ -248,13 +257,24 @@ public function copy( $source, $destination, $overwrite = false, $mode = false )
* @return bool
*/
public function move( $source, $destination, $overwrite = false ) {
$copy_results = $this->copy( $source, $destination, $overwrite );
if ( false === $copy_results ) {
return false;
$source_transport = $this->get_transport_for_path( $source );
$destination_transport = $this->get_transport_for_path( $destination, 'write' );
if ( $source_transport instanceof WP_Filesystem_Direct && $destination_transport instanceof WP_Filesystem_Direct ) {
return $source_transport->move( $source, $destination, $overwrite );
}

// We don't need to set the errors here since delete() will take care of it
return $this->delete( $source );
// WP_Filesystem_Direct::get_contents() invoked by copy() will return '' for directories; this will result in directories being copied as empty files.
if ( $source_transport instanceof WP_Filesystem_Base && $source_transport->is_file( $source ) ) {
$copy_results = $this->copy( $source, $destination, $overwrite );
if ( false === $copy_results ) {
return false;
}

// We don't need to set the errors here since delete() will take care of it
return $this->delete( $source );
}

return false;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion jetpack
Submodule jetpack updated 421 files
4 changes: 2 additions & 2 deletions jetpack.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Plugin URI: https://jetpack.com
* Description: Security, performance, and marketing tools made by WordPress experts. Jetpack keeps your site protected so you can focus on more important things.
* Author: Automattic
* Version: 12.7.1
* Version: 12.8
* Author URI: https://jetpack.com
* License: GPL2+
* Text Domain: jetpack
Expand Down Expand Up @@ -34,7 +34,7 @@ function vip_default_jetpack_version() {
return '12.5';
} else {
// WordPress 6.2 and newer.
return '12.7.1';
return '12.8';
}
}

Expand Down
28 changes: 28 additions & 0 deletions tests/files/test-wp-filesystem-vip.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@

use Automattic\Test\Constant_Mocker;
use ErrorException;
use WP_Filesystem_Base;
use WP_Filesystem_Direct;
use WP_Filesystem_VIP;
use WP_UnitTestCase;

require_once __DIR__ . '/../../files/class-wp-filesystem-vip.php';
Expand Down Expand Up @@ -351,4 +353,30 @@ public function test__get_transport_for_path__non_vip_go_env() {
$lang_install_result = $get_transport_for_path->invokeArgs( $this->filesystem, [ WP_CONTENT_DIR . '/languages/test.file', 'write' ] );
$this->assertEquals( $lang_install_result, $this->fs_direct_mock );
}

public function test_move_with_no_filesystem(): void {
global $wp_filesystem;
$save_wp_filesystem = $wp_filesystem;

try {
// phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited -- This is the point of the test.
$wp_filesystem = null;

$ok = WP_Filesystem();
self::assertTrue( $ok );

self::assertInstanceOf( WP_Filesystem_VIP::class, $wp_filesystem );
/** @var WP_Filesystem_Base $wp_filesystem */

$tmp = get_temp_dir();
$source = $tmp . 'source.txt';
$dest = $tmp . 'dest.txt';

$actual = $wp_filesystem->move( $source, $dest );
self::assertFalse( $actual );
} finally {
// phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited
$wp_filesystem = $save_wp_filesystem;
}
}
}
2 changes: 1 addition & 1 deletion tests/test-jetpack.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ public function test__vip_default_jetpack_version() {
global $wp_version;
$saved_wp_version = $wp_version;

$latest = '12.7.1';
$latest = '12.8';

$versions_map = [
// WordPress version => Jetpack version
Expand Down
17 changes: 16 additions & 1 deletion vip-helpers/vip-caching.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,11 @@ function wp_flush_get_term_by_cache( $term_id, $taxonomy ) {
*/

function wpcom_vip_term_exists( $term, $taxonomy = '', $parent = null ) {
global $wp_version;
if ( version_compare( $wp_version, '6.0', '<' ) ) {
_deprecated_function( __FUNCTION__, '6.0', 'term_exists' );
}

// If $parent is not null, let's skip the cache.
if ( null !== $parent ) {
return term_exists( $term, $taxonomy, $parent );
Expand Down Expand Up @@ -166,6 +171,11 @@ function wpcom_vip_get_term_link( $term, $taxonomy = null ) {
* @link https://docs.wpvip.com/technical-references/caching/uncached-functions/ Uncached Functions
*/
function wpcom_vip_get_page_by_title( $title, $output = OBJECT, $post_type = 'page' ) {
global $wp_version;
if ( version_compare( $wp_version, '6.2', '<' ) ) {
_deprecated_function( __FUNCTION__, '6.2', 'WP_Query' );
}

$cache_key = $post_type . '_' . sanitize_key( $title );
$page_id = wp_cache_get( $cache_key, 'get_page_by_title' );

Expand Down Expand Up @@ -210,7 +220,12 @@ function wpcom_vip_get_page_by_title( $title, $output = OBJECT, $post_type = 'pa
* @link https://docs.wpvip.com/technical-references/caching/uncached-functions/ Uncached Functions
*/
function wpcom_vip_get_page_by_path( $page_path, $output = OBJECT, $post_type = 'page' ) {
// phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.serialize_serialize
global $wp_version;
if ( version_compare( $wp_version, '6.1', '<' ) ) {
_deprecated_function( __FUNCTION__, '6.1', 'get_page_by_path' );
}

// phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.serialize_serialize
$cache_key = md5( $page_path . serialize( $post_type ) );
$page_id = wp_cache_get( $cache_key, 'wpcom_vip_get_page_by_path' );

Expand Down
2 changes: 1 addition & 1 deletion wp-parsely
Submodule wp-parsely updated 116 files
1 change: 1 addition & 0 deletions wp-parsely.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
* The default version is the first entry in the SUPPORTED_VERSIONS list.
*/
const SUPPORTED_VERSIONS = [
'3.11',
'3.10',
'3.9',
'3.8',
Expand Down

0 comments on commit 9cd3091

Please sign in to comment.