From da5a8ee216e8f596c522bdbf49b4e82a334246d0 Mon Sep 17 00:00:00 2001 From: tbradsha <32492176+tbradsha@users.noreply.github.com> Date: Fri, 13 Dec 2024 16:34:06 -0700 Subject: [PATCH 01/25] Disable lots of tests --- .github/files/generate-ci-matrix.php | 93 ++++++++++--------- .../plugins/jetpack/tests/action-test-php.sh | 2 +- 2 files changed, 48 insertions(+), 47 deletions(-) diff --git a/.github/files/generate-ci-matrix.php b/.github/files/generate-ci-matrix.php index d7531e8eea9a..36c55208e870 100755 --- a/.github/files/generate-ci-matrix.php +++ b/.github/files/generate-ci-matrix.php @@ -59,7 +59,8 @@ $matrix = array(); // Add PHP tests. -foreach ( array( '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4' ) as $php ) { +// foreach ( array( '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4' ) as $php ) { +foreach ( array( '8.2' ) as $php ) { $matrix[] = array( 'name' => "PHP tests: PHP $php WP latest", 'script' => 'test-php', @@ -69,51 +70,51 @@ ); } -foreach ( array( 'previous', 'trunk' ) as $wp ) { - $phpver = $versions['PHP_VERSION']; - $matrix[] = array( - 'name' => "PHP tests: PHP {$phpver} WP $wp", - 'script' => 'test-php', - 'php' => $phpver, - 'wp' => $wp, - 'timeout' => 15, // 2024-11-12: Successful runs seem to take ~7 minutes with PHP 8.2. - ); -} - -// Add WooCommerce tests. -$matrix[] = array( - 'name' => 'PHP tests: PHP 7.4 WP latest with WooCommerce', - 'script' => 'test-php', - 'php' => '7.4', - 'wp' => 'latest', - 'timeout' => 20, - 'with-woocommerce' => true, -); - -// Add wpcomsh tests. -$matrix[] = array( - 'name' => 'PHP tests: PHP 8.1 WP latest with wpcomsh', - 'script' => 'test-php', - 'php' => '8.1', - 'wp' => 'latest', - 'timeout' => 20, - 'with-wpcomsh' => true, -); - -// Add JS tests. -$matrix[] = array( - 'name' => 'JS tests', - 'script' => 'test-js', - 'timeout' => 15, // 2024-11-12: Successful runs seem to take ~5 minutes. -); - -// Add Coverage tests. -$matrix[] = array( - 'name' => 'Code coverage', - 'script' => 'test-coverage', - 'wp' => 'latest', - 'timeout' => 40, // 2024-11-12: Successful runs seem to take ~14 minutes. -); +// foreach ( array( 'previous', 'trunk' ) as $wp ) { +// $phpver = $versions['PHP_VERSION']; +// $matrix[] = array( +// 'name' => "PHP tests: PHP {$phpver} WP $wp", +// 'script' => 'test-php', +// 'php' => $phpver, +// 'wp' => $wp, +// 'timeout' => 15, // 2024-11-12: Successful runs seem to take ~7 minutes with PHP 8.2. +// ); +// } + +// // Add WooCommerce tests. +// $matrix[] = array( +// 'name' => 'PHP tests: PHP 7.4 WP latest with WooCommerce', +// 'script' => 'test-php', +// 'php' => '7.4', +// 'wp' => 'latest', +// 'timeout' => 20, +// 'with-woocommerce' => true, +// ); + +// // Add wpcomsh tests. +// $matrix[] = array( +// 'name' => 'PHP tests: PHP 8.1 WP latest with wpcomsh', +// 'script' => 'test-php', +// 'php' => '8.1', +// 'wp' => 'latest', +// 'timeout' => 20, +// 'with-wpcomsh' => true, +// ); + +// // Add JS tests. +// $matrix[] = array( +// 'name' => 'JS tests', +// 'script' => 'test-js', +// 'timeout' => 15, // 2024-11-12: Successful runs seem to take ~5 minutes. +// ); + +// // Add Coverage tests. +// $matrix[] = array( +// 'name' => 'Code coverage', +// 'script' => 'test-coverage', +// 'wp' => 'latest', +// 'timeout' => 40, // 2024-11-12: Successful runs seem to take ~14 minutes. +// ); // END matrix definitions. // Now, validation. diff --git a/projects/plugins/jetpack/tests/action-test-php.sh b/projects/plugins/jetpack/tests/action-test-php.sh index ce33f626c37a..d5b0e35ddb52 100755 --- a/projects/plugins/jetpack/tests/action-test-php.sh +++ b/projects/plugins/jetpack/tests/action-test-php.sh @@ -16,7 +16,7 @@ if [[ "$WITH_WPCOMSH" == true ]]; then fi echo "::group::Jetpack tests" -phpunit +phpunit --filter WP_Test_Jetpack_Sync_Themes echo "::endgroup::" if [[ "$WP_BRANCH" == "trunk" ]]; then From b62698081b1274c9b253478c9529c86d1210767e Mon Sep 17 00:00:00 2001 From: tbradsha <32492176+tbradsha@users.noreply.github.com> Date: Fri, 13 Dec 2024 16:44:22 -0700 Subject: [PATCH 02/25] asdasgasdgasdg --- .github/files/generate-ci-matrix.php | 36 +++++++++---------- .../plugins/jetpack/tests/php/bootstrap.php | 3 ++ 2 files changed, 21 insertions(+), 18 deletions(-) diff --git a/.github/files/generate-ci-matrix.php b/.github/files/generate-ci-matrix.php index 36c55208e870..2eb7e111475f 100755 --- a/.github/files/generate-ci-matrix.php +++ b/.github/files/generate-ci-matrix.php @@ -60,15 +60,15 @@ // Add PHP tests. // foreach ( array( '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4' ) as $php ) { -foreach ( array( '8.2' ) as $php ) { - $matrix[] = array( - 'name' => "PHP tests: PHP $php WP latest", - 'script' => 'test-php', - 'php' => $php, - 'wp' => 'latest', - 'timeout' => 20, // 2024-11-12: Successful runs seem to take up to ~7 minutes. - ); -} +// foreach ( array( '8.2' ) as $php ) { +// $matrix[] = array( +// 'name' => "PHP tests: PHP $php WP latest", +// 'script' => 'test-php', +// 'php' => $php, +// 'wp' => 'latest', +// 'timeout' => 20, // 2024-11-12: Successful runs seem to take up to ~7 minutes. +// ); +// } // foreach ( array( 'previous', 'trunk' ) as $wp ) { // $phpver = $versions['PHP_VERSION']; @@ -91,15 +91,15 @@ // 'with-woocommerce' => true, // ); -// // Add wpcomsh tests. -// $matrix[] = array( -// 'name' => 'PHP tests: PHP 8.1 WP latest with wpcomsh', -// 'script' => 'test-php', -// 'php' => '8.1', -// 'wp' => 'latest', -// 'timeout' => 20, -// 'with-wpcomsh' => true, -// ); +// Add wpcomsh tests. +$matrix[] = array( + 'name' => 'PHP tests: PHP 8.1 WP latest with wpcomsh', + 'script' => 'test-php', + 'php' => '8.1', + 'wp' => 'latest', + 'timeout' => 20, + 'with-wpcomsh' => true, +); // // Add JS tests. // $matrix[] = array( diff --git a/projects/plugins/jetpack/tests/php/bootstrap.php b/projects/plugins/jetpack/tests/php/bootstrap.php index 2411078bd727..268299e37df7 100644 --- a/projects/plugins/jetpack/tests/php/bootstrap.php +++ b/projects/plugins/jetpack/tests/php/bootstrap.php @@ -145,6 +145,9 @@ function _manually_load_muplugin() { if ( ! is_dir( WPCOMSH_PREMIUM_THEMES_PATH ) ) { mkdir( WPCOMSH_PREMIUM_THEMES_PATH, 0777 ); } + echo 'WPCOMSH_PREMIUM_THEMES_PATH'; + echo WPCOMSH_PREMIUM_THEMES_PATH; + var_dump( scandir( WPCOMSH_PREMIUM_THEMES_PATH ) ); } // If we are running the uninstall tests don't load jetpack. From be09b70b8465c7ea24b03c698d62acab6e0ddffb Mon Sep 17 00:00:00 2001 From: tbradsha <32492176+tbradsha@users.noreply.github.com> Date: Fri, 13 Dec 2024 16:55:03 -0700 Subject: [PATCH 03/25] Update tests.yml --- .github/workflows/tests.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index a18c812be4b0..d2ff0f53af31 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -144,6 +144,9 @@ jobs: SLUG="${DIR#projects/}" fi + if [[ "${SLUG%%/*}" != "plugins" ]]; then + continue; + fi if [[ "${SLUG%%/*}" != "plugins" && "$WP_BRANCH" != 'latest' && "$WP_BRANCH" != 'none' && "$FORCE_PACKAGE_TESTS" != "true" ]]; then echo "Skipping $SLUG, only plugins run for WP_BRANCH = $WP_BRANCH" continue From 54f16bb1576d8a59c7dab8deda594a53a03e689d Mon Sep 17 00:00:00 2001 From: tbradsha <32492176+tbradsha@users.noreply.github.com> Date: Fri, 13 Dec 2024 16:59:18 -0700 Subject: [PATCH 04/25] Update test_class.jetpack-sync-themes.php --- .../tests/php/sync/test_class.jetpack-sync-themes.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-themes.php b/projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-themes.php index 6a779671f29e..9bebfa6b8419 100644 --- a/projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-themes.php +++ b/projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-themes.php @@ -250,8 +250,8 @@ private function perform_network_enable_disable_assertions( $test_themes, $event } public function test_install_edit_delete_theme_sync() { - $theme_slug = 'itek'; - $theme_name = 'iTek'; + $theme_slug = 'twentytwentyfour'; + $theme_name = 'Twenty Twenty-Four'; delete_theme( $theme_slug ); // Ensure theme is not lingering on file system $this->server_event_storage->reset(); @@ -295,7 +295,7 @@ public function test_install_edit_delete_theme_sync() { $event_data = $this->server_event_storage->get_most_recent_event( 'jetpack_deleted_theme' ); - $this->assertEquals( 'itek', $event_data->args[0] ); + $this->assertEquals( 'twentytwentyfour', $event_data->args[0] ); } public function test_update_themes_sync() { From 0a26a19abcbe1f30b4a5cb46b91105239e68c90c Mon Sep 17 00:00:00 2001 From: tbradsha <32492176+tbradsha@users.noreply.github.com> Date: Fri, 13 Dec 2024 17:08:36 -0700 Subject: [PATCH 05/25] Update tests.yml --- .github/workflows/tests.yml | 122 ++++++++++++++++++------------------ 1 file changed, 61 insertions(+), 61 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index d2ff0f53af31..2d84b61c4fd9 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -369,64 +369,64 @@ jobs: tools/check-plugin-monorepo-deps.sh "${ARGS[@]}" # Probably this should be a linting test too, but we don't run linting on trunk or release branches. - phan: - name: Static analysis - runs-on: ubuntu-latest - timeout-minutes: 20 # 2024-05-02: Up to about 8 minutes now that we're running against the old WP stubs too. - steps: - - uses: actions/checkout@v4 - - name: Setup tools - uses: ./.github/actions/tool-setup - - name: Pnpm install - run: pnpm install - - name: Run phan - run: pnpm jetpack phan --all -v --update-baseline --format github - - name: Run phan for previous WP version too - env: - # Don't bother complaining about unused suppressions that may be used with the newer stubs. See .phan/config.base.php for how this gets applied. - NO_PHAN_UNUSED_SUPPRESSION: 1 - run: | - composer update --prefer-lowest php-stubs/wordpress-stubs php-stubs/wordpress-tests-stubs - # Don't re-update baselines here, only check. - pnpm jetpack phan --all -v --format github - - name: Check baselines - run: | - # Anything changed? (with a side of printing the diff) - if git diff --exit-code --ignore-matching-lines='^ // ' -- .phan/baseline.php '*/.phan/baseline.php'; then - exit 0 - fi - - # Collect which projects changed to suggest the right command. - PROJECTS=() - for f in $( git -c core.quotepath=off diff --name-only -- .phan/baseline.php '*/.phan/baseline.php' ); do - # --name-only and --ignore-matching-lines don't combine, so we have to do the check separately. - if git diff --quiet --exit-code --ignore-matching-lines='^ // ' -- "$f"; then - continue - fi - - if [[ "$f" == ".phan/baseline.php" ]]; then - SLUG=monorepo - elif [[ "$f" == projects/*/*/.phan/baseline.php ]]; then - SLUG=${f%/.phan/baseline.php} - SLUG=${SLUG#projects/} - elif SLUG=$( grep -v '^[ \t]*\/\/' .phan/monorepo-pseudo-projects.jsonc | jq -re --arg f "${f%.phan/baseline.php}" 'to_entries[] | select( .value == $f ) | .key' ); then - : # Ok - else - SLUG= - fi - if grep -q 'This baseline has no suppressions' "$f"; then - if [[ -n "$SLUG" ]]; then - echo "::error file=$f::This Phan baseline is now empty (good job!). You may remove it, or if you want to keep it (e.g. if you expect new unfixed issues to be added in the future) you can run \`jetpack phan --update-baseline $SLUG\` to update it." - else - echo "::error file=$f::This Phan baseline is now empty (good job!). You may remove it." - fi - elif [[ -n "$SLUG" ]]; then - PROJECTS+=( "$SLUG" ) - else - echo "::error file=$f::This Phan baseline has changed and should be updated. This Action was unable to determine the command needed to update it; please report this to the Garage team." - fi - done - if [[ ${#PROJECTS[@]} -gt 0 ]]; then - echo "::error::Phan baselines have changed (good job!). Run \`jetpack phan --update-baseline ${PROJECTS[*]}\` to update them." - fi - exit 1 + # phan: + # name: Static analysis + # runs-on: ubuntu-latest + # timeout-minutes: 20 # 2024-05-02: Up to about 8 minutes now that we're running against the old WP stubs too. + # steps: + # - uses: actions/checkout@v4 + # - name: Setup tools + # uses: ./.github/actions/tool-setup + # - name: Pnpm install + # run: pnpm install + # - name: Run phan + # run: pnpm jetpack phan --all -v --update-baseline --format github + # - name: Run phan for previous WP version too + # env: + # # Don't bother complaining about unused suppressions that may be used with the newer stubs. See .phan/config.base.php for how this gets applied. + # NO_PHAN_UNUSED_SUPPRESSION: 1 + # run: | + # composer update --prefer-lowest php-stubs/wordpress-stubs php-stubs/wordpress-tests-stubs + # # Don't re-update baselines here, only check. + # pnpm jetpack phan --all -v --format github + # - name: Check baselines + # run: | + # # Anything changed? (with a side of printing the diff) + # if git diff --exit-code --ignore-matching-lines='^ // ' -- .phan/baseline.php '*/.phan/baseline.php'; then + # exit 0 + # fi + + # # Collect which projects changed to suggest the right command. + # PROJECTS=() + # for f in $( git -c core.quotepath=off diff --name-only -- .phan/baseline.php '*/.phan/baseline.php' ); do + # # --name-only and --ignore-matching-lines don't combine, so we have to do the check separately. + # if git diff --quiet --exit-code --ignore-matching-lines='^ // ' -- "$f"; then + # continue + # fi + + # if [[ "$f" == ".phan/baseline.php" ]]; then + # SLUG=monorepo + # elif [[ "$f" == projects/*/*/.phan/baseline.php ]]; then + # SLUG=${f%/.phan/baseline.php} + # SLUG=${SLUG#projects/} + # elif SLUG=$( grep -v '^[ \t]*\/\/' .phan/monorepo-pseudo-projects.jsonc | jq -re --arg f "${f%.phan/baseline.php}" 'to_entries[] | select( .value == $f ) | .key' ); then + # : # Ok + # else + # SLUG= + # fi + # if grep -q 'This baseline has no suppressions' "$f"; then + # if [[ -n "$SLUG" ]]; then + # echo "::error file=$f::This Phan baseline is now empty (good job!). You may remove it, or if you want to keep it (e.g. if you expect new unfixed issues to be added in the future) you can run \`jetpack phan --update-baseline $SLUG\` to update it." + # else + # echo "::error file=$f::This Phan baseline is now empty (good job!). You may remove it." + # fi + # elif [[ -n "$SLUG" ]]; then + # PROJECTS+=( "$SLUG" ) + # else + # echo "::error file=$f::This Phan baseline has changed and should be updated. This Action was unable to determine the command needed to update it; please report this to the Garage team." + # fi + # done + # if [[ ${#PROJECTS[@]} -gt 0 ]]; then + # echo "::error::Phan baselines have changed (good job!). Run \`jetpack phan --update-baseline ${PROJECTS[*]}\` to update them." + # fi + # exit 1 From c39b89687bd8505af96a20ed18afe806b595ad26 Mon Sep 17 00:00:00 2001 From: tbradsha <32492176+tbradsha@users.noreply.github.com> Date: Fri, 13 Dec 2024 17:12:02 -0700 Subject: [PATCH 06/25] Update test_class.jetpack-sync-themes.php --- .../jetpack/tests/php/sync/test_class.jetpack-sync-themes.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-themes.php b/projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-themes.php index 9bebfa6b8419..428777caef0b 100644 --- a/projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-themes.php +++ b/projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-themes.php @@ -249,7 +249,7 @@ private function perform_network_enable_disable_assertions( $test_themes, $event $this->assertEquals( $event_data->args[1], $enabled_slugs ); } - public function test_install_edit_delete_theme_sync() { + public function test_install_edit_delete_theme_syanc() { $theme_slug = 'twentytwentyfour'; $theme_name = 'Twenty Twenty-Four'; @@ -262,6 +262,8 @@ public function test_install_edit_delete_theme_sync() { $this->sender->do_sync(); $event_data = $this->server_event_storage->get_most_recent_event( 'jetpack_installed_theme' ); + echo 'asdf'; + var_dump($event_data); $this->assertEquals( $event_data->args[0], $theme_slug ); $this->assertEquals( $event_data->args[1]['name'], $theme_name ); From 8bf7753a4abc9cee7b8c5186a910ec3b7d537715 Mon Sep 17 00:00:00 2001 From: tbradsha <32492176+tbradsha@users.noreply.github.com> Date: Mon, 16 Dec 2024 12:09:53 -0700 Subject: [PATCH 07/25] gasdgasdgs --- .github/workflows/tests.yml | 4 +++- .../tests/php/sync/test_class.jetpack-sync-themes.php | 6 +++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 2d84b61c4fd9..4a91852204d6 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -171,7 +171,9 @@ jobs: continue fi fi - + if [[ $SLUG != 'plugins/jetpack' ]]; then + continue; + fi echo "Running tests for $SLUG" { # Composer install, if appropriate. Note setup-wordpress-env.sh did it already for plugins. diff --git a/projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-themes.php b/projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-themes.php index 428777caef0b..146630e43889 100644 --- a/projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-themes.php +++ b/projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-themes.php @@ -263,7 +263,7 @@ public function test_install_edit_delete_theme_syanc() { $event_data = $this->server_event_storage->get_most_recent_event( 'jetpack_installed_theme' ); echo 'asdf'; - var_dump($event_data); + var_dump( $event_data ); $this->assertEquals( $event_data->args[0], $theme_slug ); $this->assertEquals( $event_data->args[1]['name'], $theme_name ); @@ -484,8 +484,12 @@ private function install_theme( $slug ) { if ( is_wp_error( $api ) ) { wp_die( $api ); } + error_log( var_export( 'api', true ) ); + error_log( var_export( $api, true ) ); $upgrader = new Theme_Upgrader( new Silent_Upgrader_Skin() ); + error_log( var_export( 'upgrader', true ) ); + error_log( var_export( $upgrader, true ) ); add_filter( 'pre_http_request', array( 'WP_Test_Jetpack_Sync_Base', 'pre_http_request_wordpress_org_updates' ), 10, 3 ); $upgrader->install( $api->download_link, array( 'overwrite_package' => $overwrite ) ); remove_filter( 'pre_http_request', array( 'WP_Test_Jetpack_Sync_Base', 'pre_http_request_wordpress_org_updates' ) ); From 9ed067507715d608f795cec047a11d1fd91640bf Mon Sep 17 00:00:00 2001 From: tbradsha <32492176+tbradsha@users.noreply.github.com> Date: Mon, 16 Dec 2024 12:11:21 -0700 Subject: [PATCH 08/25] Create fix-old_theme --- projects/plugins/jetpack/changelog/fix-old_theme | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 projects/plugins/jetpack/changelog/fix-old_theme diff --git a/projects/plugins/jetpack/changelog/fix-old_theme b/projects/plugins/jetpack/changelog/fix-old_theme new file mode 100644 index 000000000000..1ef8afea050a --- /dev/null +++ b/projects/plugins/jetpack/changelog/fix-old_theme @@ -0,0 +1,4 @@ +Significance: patch +Type: other + + From 11a1d5cb31f863416e05ff9f497c49ba87e302cf Mon Sep 17 00:00:00 2001 From: tbradsha <32492176+tbradsha@users.noreply.github.com> Date: Mon, 16 Dec 2024 12:21:50 -0700 Subject: [PATCH 09/25] Update managed-themes.php --- projects/plugins/wpcomsh/feature-plugins/managed-themes.php | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/plugins/wpcomsh/feature-plugins/managed-themes.php b/projects/plugins/wpcomsh/feature-plugins/managed-themes.php index 7d31ca8bc3b9..8569df5e4815 100644 --- a/projects/plugins/wpcomsh/feature-plugins/managed-themes.php +++ b/projects/plugins/wpcomsh/feature-plugins/managed-themes.php @@ -126,6 +126,7 @@ function () use ( $was_theme_symlinked ) { * @return bool */ function wpcomsh_jetpack_wpcom_theme_delete( $use_alternative_delete_method, $theme_slug ) { + error_log( var_export( 'deleting', true ) ); // phpcs:ignore if ( ! wpcomsh_is_wpcom_theme( $theme_slug ) || ! wpcomsh_is_theme_symlinked( $theme_slug ) ) { return false; } From aa2dcb3c40824a76b28074fc94284f1630085ed0 Mon Sep 17 00:00:00 2001 From: tbradsha <32492176+tbradsha@users.noreply.github.com> Date: Mon, 16 Dec 2024 12:22:19 -0700 Subject: [PATCH 10/25] Create fix-old_theme --- projects/plugins/wpcomsh/changelog/fix-old_theme | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 projects/plugins/wpcomsh/changelog/fix-old_theme diff --git a/projects/plugins/wpcomsh/changelog/fix-old_theme b/projects/plugins/wpcomsh/changelog/fix-old_theme new file mode 100644 index 000000000000..05ffe09f19e6 --- /dev/null +++ b/projects/plugins/wpcomsh/changelog/fix-old_theme @@ -0,0 +1,4 @@ +Significance: patch +Type: changed + + From 02f8f2d5d3cbe0870e7319d79c0c3c74cc31338b Mon Sep 17 00:00:00 2001 From: tbradsha <32492176+tbradsha@users.noreply.github.com> Date: Mon, 16 Dec 2024 12:29:51 -0700 Subject: [PATCH 11/25] asdgasdg --- .../sync/test_class.jetpack-sync-themes.php | 57 +++++++++++++++++-- projects/plugins/wpcomsh/functions.php | 10 +++- 2 files changed, 61 insertions(+), 6 deletions(-) diff --git a/projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-themes.php b/projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-themes.php index 146630e43889..f54851ef97d1 100644 --- a/projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-themes.php +++ b/projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-themes.php @@ -249,6 +249,57 @@ private function perform_network_enable_disable_assertions( $test_themes, $event $this->assertEquals( $event_data->args[1], $enabled_slugs ); } + public function test_install_edit_delete_theme_sync() { + $theme_slug = 'itek'; + $theme_name = 'iTek'; + + delete_theme( $theme_slug ); // Ensure theme is not lingering on file system + $this->server_event_storage->reset(); + + // Test Install Theme + + $this->install_theme( $theme_slug ); + $this->sender->do_sync(); + + $event_data = $this->server_event_storage->get_most_recent_event( 'jetpack_installed_theme' ); + echo 'asdf'; + var_dump( $event_data ); + + $this->assertEquals( $event_data->args[0], $theme_slug ); + $this->assertEquals( $event_data->args[1]['name'], $theme_name ); + $this->assertTrue( (bool) $event_data->args[1]['version'] ); + $this->assertTrue( (bool) $event_data->args[1]['uri'] ); + + // Test Edit Theme + + /** + * This filter is already documented in wp-includes/pluggable.php + * + * @since 1.5.1 + */ + $_POST['newcontent'] = 'foo'; + apply_filters( 'wp_redirect', 'theme-editor.php?file=style.css&theme=' . $theme_slug . '&scrollto=0&updated=true' ); + $this->sender->do_sync(); + + $event_data = $this->server_event_storage->get_most_recent_event( 'jetpack_edited_theme' ); + + $this->assertEquals( $event_data->args[0], $theme_slug ); + $this->assertEquals( $event_data->args[1]['name'], $theme_name ); + $this->assertTrue( (bool) $event_data->args[1]['version'] ); + $this->assertTrue( (bool) $event_data->args[1]['uri'] ); + + unset( $_POST['newcontent'] ); + + // Test Delete Theme + + delete_theme( $theme_slug ); + $this->sender->do_sync(); + + $event_data = $this->server_event_storage->get_most_recent_event( 'jetpack_deleted_theme' ); + + $this->assertEquals( $theme_slug, $event_data->args[0] ); + } + public function test_install_edit_delete_theme_syanc() { $theme_slug = 'twentytwentyfour'; $theme_name = 'Twenty Twenty-Four'; @@ -297,7 +348,7 @@ public function test_install_edit_delete_theme_syanc() { $event_data = $this->server_event_storage->get_most_recent_event( 'jetpack_deleted_theme' ); - $this->assertEquals( 'twentytwentyfour', $event_data->args[0] ); + $this->assertEquals( $theme_slug, $event_data->args[0] ); } public function test_update_themes_sync() { @@ -484,12 +535,8 @@ private function install_theme( $slug ) { if ( is_wp_error( $api ) ) { wp_die( $api ); } - error_log( var_export( 'api', true ) ); - error_log( var_export( $api, true ) ); $upgrader = new Theme_Upgrader( new Silent_Upgrader_Skin() ); - error_log( var_export( 'upgrader', true ) ); - error_log( var_export( $upgrader, true ) ); add_filter( 'pre_http_request', array( 'WP_Test_Jetpack_Sync_Base', 'pre_http_request_wordpress_org_updates' ), 10, 3 ); $upgrader->install( $api->download_link, array( 'overwrite_package' => $overwrite ) ); remove_filter( 'pre_http_request', array( 'WP_Test_Jetpack_Sync_Base', 'pre_http_request_wordpress_org_updates' ) ); diff --git a/projects/plugins/wpcomsh/functions.php b/projects/plugins/wpcomsh/functions.php index ca9a94601217..7cadcf24ab36 100644 --- a/projects/plugins/wpcomsh/functions.php +++ b/projects/plugins/wpcomsh/functions.php @@ -1,4 +1,4 @@ - Date: Mon, 16 Dec 2024 12:59:30 -0700 Subject: [PATCH 12/25] asdgasg --- .../php/sync/test_class.jetpack-sync-themes.php | 8 ++++---- .../wpcomsh/feature-plugins/managed-themes.php | 2 +- projects/plugins/wpcomsh/functions.php | 16 ++++++++-------- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-themes.php b/projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-themes.php index f54851ef97d1..3b5e9dd2840c 100644 --- a/projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-themes.php +++ b/projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-themes.php @@ -1,4 +1,4 @@ -assertEquals( $theme_slug, $event_data->args[0] ); } - public function test_install_edit_delete_theme_syanc() { - $theme_slug = 'twentytwentyfour'; - $theme_name = 'Twenty Twenty-Four'; + public function test_install_edit_delete_theme_synac() { + $theme_slug = 'itek'; + $theme_name = 'iTek'; delete_theme( $theme_slug ); // Ensure theme is not lingering on file system $this->server_event_storage->reset(); diff --git a/projects/plugins/wpcomsh/feature-plugins/managed-themes.php b/projects/plugins/wpcomsh/feature-plugins/managed-themes.php index 8569df5e4815..9f9cf1d74a15 100644 --- a/projects/plugins/wpcomsh/feature-plugins/managed-themes.php +++ b/projects/plugins/wpcomsh/feature-plugins/managed-themes.php @@ -126,7 +126,7 @@ function () use ( $was_theme_symlinked ) { * @return bool */ function wpcomsh_jetpack_wpcom_theme_delete( $use_alternative_delete_method, $theme_slug ) { - error_log( var_export( 'deleting', true ) ); // phpcs:ignore + var_dump( 'deleting' ); // phpcs:ignore if ( ! wpcomsh_is_wpcom_theme( $theme_slug ) || ! wpcomsh_is_theme_symlinked( $theme_slug ) ) { return false; } diff --git a/projects/plugins/wpcomsh/functions.php b/projects/plugins/wpcomsh/functions.php index 7cadcf24ab36..8d3983f364a3 100644 --- a/projects/plugins/wpcomsh/functions.php +++ b/projects/plugins/wpcomsh/functions.php @@ -12,8 +12,8 @@ * @return bool */ function wpcomsh_is_wpcom_theme( $theme_slug ) { - error_log( var_export( 'wpcomsh_is_wpcom_theme', true ) ); - error_log( var_export( $theme_slug, true ) ); + var_dump( 'wpcomsh_is_wpcom_theme' ); + var_dump( $theme_slug ); return wpcomsh_is_wpcom_premium_theme( $theme_slug ) || wpcomsh_is_wpcom_pub_theme( $theme_slug ); } @@ -24,9 +24,9 @@ function wpcomsh_is_wpcom_theme( $theme_slug ) { * @return bool */ function wpcomsh_is_wpcom_premium_theme( $theme_slug ) { - error_log( var_export( 'wpcomsh_is_wpcom_premium_theme', true ) ); - error_log( var_export( $theme_slug, true ) ); - error_log( var_export( WPCOMSH_PREMIUM_THEMES_PATH, true ) ); + var_dump( 'wpcomsh_is_wpcom_premium_theme' ); + var_dump( $theme_slug ); + var_dump( WPCOMSH_PREMIUM_THEMES_PATH ); if ( ! defined( 'WPCOMSH_PREMIUM_THEMES_PATH' ) || ! file_exists( WPCOMSH_PREMIUM_THEMES_PATH ) @@ -52,9 +52,9 @@ function wpcomsh_is_wpcom_premium_theme( $theme_slug ) { * @return bool */ function wpcomsh_is_wpcom_pub_theme( $theme_slug ) { - error_log( var_export( 'wpcomsh_is_wpcom_pub_theme', true ) ); - error_log( var_export( $theme_slug, true ) ); - error_log( var_export( WPCOMSH_PUB_THEMES_PATH, true ) ); + var_dump( 'wpcomsh_is_wpcom_pub_theme' ); + var_dump( $theme_slug ); + var_dump( WPCOMSH_PUB_THEMES_PATH ); if ( ! defined( 'WPCOMSH_PUB_THEMES_PATH' ) || ! file_exists( WPCOMSH_PUB_THEMES_PATH ) From 6cb34d6579454375e69150f5381d29f8034c1581 Mon Sep 17 00:00:00 2001 From: tbradsha <32492176+tbradsha@users.noreply.github.com> Date: Mon, 16 Dec 2024 13:00:18 -0700 Subject: [PATCH 13/25] Update test_class.jetpack-sync-themes.php --- .../jetpack/tests/php/sync/test_class.jetpack-sync-themes.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-themes.php b/projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-themes.php index 3b5e9dd2840c..b4b4d0b76160 100644 --- a/projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-themes.php +++ b/projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-themes.php @@ -301,8 +301,8 @@ public function test_install_edit_delete_theme_sync() { } public function test_install_edit_delete_theme_synac() { - $theme_slug = 'itek'; - $theme_name = 'iTek'; + $theme_slug = 'twentytwentyfour'; + $theme_name = 'Twenty Twenty-Four'; delete_theme( $theme_slug ); // Ensure theme is not lingering on file system $this->server_event_storage->reset(); From 87621aa4c0d698b019aad78ae0ae31e31232c689 Mon Sep 17 00:00:00 2001 From: tbradsha <32492176+tbradsha@users.noreply.github.com> Date: Mon, 16 Dec 2024 13:10:08 -0700 Subject: [PATCH 14/25] adgasdgsdg --- projects/plugins/wpcomsh/feature-plugins/managed-themes.php | 5 ++++- projects/plugins/wpcomsh/functions.php | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/projects/plugins/wpcomsh/feature-plugins/managed-themes.php b/projects/plugins/wpcomsh/feature-plugins/managed-themes.php index 9f9cf1d74a15..6f4d9018cab9 100644 --- a/projects/plugins/wpcomsh/feature-plugins/managed-themes.php +++ b/projects/plugins/wpcomsh/feature-plugins/managed-themes.php @@ -1,4 +1,4 @@ -get_stylesheet(); + error_log( var_export( $stylesheet, true ) ); if ( wpcomsh_is_theme_symlinked( $stylesheet ) && wpcomsh_is_wpcom_premium_theme( $stylesheet ) ) { return sprintf( 'premium/%s', $stylesheet ); @@ -70,6 +72,7 @@ function wpcomsh_handle_atomic_premium_theme_option() { * @return bool|\WP_Error */ function wpcomsh_jetpack_wpcom_theme_skip_download( $skip_download_filter_result, $theme_slug ) { + error_log( var_export( 'wpcomsh_jetpack_wpcom_theme_skip_download', true ) ); $theme_type = wpcomsh_get_wpcom_theme_type( $theme_slug ); // If we are dealing with a non WPCom theme, don't interfere. diff --git a/projects/plugins/wpcomsh/functions.php b/projects/plugins/wpcomsh/functions.php index 8d3983f364a3..f176b6a9bb89 100644 --- a/projects/plugins/wpcomsh/functions.php +++ b/projects/plugins/wpcomsh/functions.php @@ -222,6 +222,7 @@ function wpcomsh_count_child_themes( $template ) { * @return bool|WP_Error */ function wpcomsh_symlink_parent_theme( $stylesheet ) { + error_log(var_export('wpcomsh_symlink_parent_theme', true)); $theme = wp_get_theme( $stylesheet ); $template = $theme->get_template(); From c528e43c2a7a4593fa8c1c259f44835a6ea72a9d Mon Sep 17 00:00:00 2001 From: tbradsha <32492176+tbradsha@users.noreply.github.com> Date: Mon, 16 Dec 2024 13:17:20 -0700 Subject: [PATCH 15/25] oaergoij --- .github/workflows/tests.yml | 3 +++ .../tests/php/sync/test_class.jetpack-sync-themes.php | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 4a91852204d6..e1eec0fb5f6d 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -147,6 +147,9 @@ jobs: if [[ "${SLUG%%/*}" != "plugins" ]]; then continue; fi + if [[ $SLUG != "plugins/jetpack" && $SLUG != "plugins/wpcomsh" ]]; then + continue + fi if [[ "${SLUG%%/*}" != "plugins" && "$WP_BRANCH" != 'latest' && "$WP_BRANCH" != 'none' && "$FORCE_PACKAGE_TESTS" != "true" ]]; then echo "Skipping $SLUG, only plugins run for WP_BRANCH = $WP_BRANCH" continue diff --git a/projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-themes.php b/projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-themes.php index b4b4d0b76160..9a1cd9e2f280 100644 --- a/projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-themes.php +++ b/projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-themes.php @@ -253,12 +253,15 @@ public function test_install_edit_delete_theme_sync() { $theme_slug = 'itek'; $theme_name = 'iTek'; + error_log(var_export('delete_theme', true)); delete_theme( $theme_slug ); // Ensure theme is not lingering on file system + error_log(var_export('end_delete_theme', true)); $this->server_event_storage->reset(); // Test Install Theme - + error_log(var_export('install_theme', true)); $this->install_theme( $theme_slug ); + error_log(var_export('end_install_theme', true)); $this->sender->do_sync(); $event_data = $this->server_event_storage->get_most_recent_event( 'jetpack_installed_theme' ); From fd0cab5c84a9eb79cdfbd6bd10dc07e2e17ab033 Mon Sep 17 00:00:00 2001 From: tbradsha <32492176+tbradsha@users.noreply.github.com> Date: Mon, 16 Dec 2024 13:23:27 -0700 Subject: [PATCH 16/25] asdgadsg --- .../tests/php/sync/test_class.jetpack-sync-themes.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-themes.php b/projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-themes.php index 9a1cd9e2f280..b1ee4dca2e8a 100644 --- a/projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-themes.php +++ b/projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-themes.php @@ -250,6 +250,7 @@ private function perform_network_enable_disable_assertions( $test_themes, $event } public function test_install_edit_delete_theme_sync() { + error_log(var_export('test_install_edit_delete_theme_sync', true)); $theme_slug = 'itek'; $theme_name = 'iTek'; @@ -304,15 +305,19 @@ public function test_install_edit_delete_theme_sync() { } public function test_install_edit_delete_theme_synac() { + error_log(var_export('test_install_edit_delete_theme_synac', true)); $theme_slug = 'twentytwentyfour'; $theme_name = 'Twenty Twenty-Four'; + error_log(var_export('delete_theme', true)); delete_theme( $theme_slug ); // Ensure theme is not lingering on file system + error_log(var_export('end_delete_theme', true)); $this->server_event_storage->reset(); // Test Install Theme - + error_log(var_export('install_theme', true)); $this->install_theme( $theme_slug ); + error_log(var_export('end_install_theme', true)); $this->sender->do_sync(); $event_data = $this->server_event_storage->get_most_recent_event( 'jetpack_installed_theme' ); From 247803ff777182a5eea04fce407444a6e38c8b6f Mon Sep 17 00:00:00 2001 From: tbradsha <32492176+tbradsha@users.noreply.github.com> Date: Mon, 16 Dec 2024 13:29:38 -0700 Subject: [PATCH 17/25] awegaewg --- .github/files/setup-wordpress-env.sh | 3 +++ .../tests/php/sync/test_class.jetpack-sync-themes.php | 5 +---- projects/plugins/wpcomsh/wpcom-themes/themes.php | 5 +++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/files/setup-wordpress-env.sh b/.github/files/setup-wordpress-env.sh index d344df4b17f5..7a33af0ede8b 100755 --- a/.github/files/setup-wordpress-env.sh +++ b/.github/files/setup-wordpress-env.sh @@ -51,6 +51,9 @@ for PLUGIN in projects/plugins/*/composer.json; do NAME="$(basename "$DIR")" echo "::group::Installing plugin $NAME into WordPress" + if [[ $NAME != 'jetpack' ]]; then + continue; + fi if php -r 'exit( preg_match( "/^>=\\s*(\\d+\\.\\d+)$/", $argv[1], $m ) && version_compare( PHP_VERSION, $m[1], "<" ) ? 0 : 1 );' "$( jq -r '.require.php // ""' "$DIR/composer.json" )"; then echo "::endgroup::" diff --git a/projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-themes.php b/projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-themes.php index b1ee4dca2e8a..d3bb43660cfd 100644 --- a/projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-themes.php +++ b/projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-themes.php @@ -254,9 +254,7 @@ public function test_install_edit_delete_theme_sync() { $theme_slug = 'itek'; $theme_name = 'iTek'; - error_log(var_export('delete_theme', true)); delete_theme( $theme_slug ); // Ensure theme is not lingering on file system - error_log(var_export('end_delete_theme', true)); $this->server_event_storage->reset(); // Test Install Theme @@ -309,9 +307,7 @@ public function test_install_edit_delete_theme_synac() { $theme_slug = 'twentytwentyfour'; $theme_name = 'Twenty Twenty-Four'; - error_log(var_export('delete_theme', true)); delete_theme( $theme_slug ); // Ensure theme is not lingering on file system - error_log(var_export('end_delete_theme', true)); $this->server_event_storage->reset(); // Test Install Theme @@ -543,6 +539,7 @@ private function install_theme( $slug ) { if ( is_wp_error( $api ) ) { wp_die( $api ); } + error_log(var_export($api, true)); $upgrader = new Theme_Upgrader( new Silent_Upgrader_Skin() ); add_filter( 'pre_http_request', array( 'WP_Test_Jetpack_Sync_Base', 'pre_http_request_wordpress_org_updates' ), 10, 3 ); diff --git a/projects/plugins/wpcomsh/wpcom-themes/themes.php b/projects/plugins/wpcomsh/wpcom-themes/themes.php index 5bf88df18049..da8f7053d0eb 100644 --- a/projects/plugins/wpcomsh/wpcom-themes/themes.php +++ b/projects/plugins/wpcomsh/wpcom-themes/themes.php @@ -1,4 +1,4 @@ -get_theme( $package ); - + error_log( var_export( 'wpcom_theme', true ) ); + error_log( var_export( $wpcom_theme, true ) ); if ( ! $wpcom_theme ) { return $reply; } From a50e3f79e22d7a44fa22a3fa6448d1e0f7a951ed Mon Sep 17 00:00:00 2001 From: tbradsha <32492176+tbradsha@users.noreply.github.com> Date: Mon, 16 Dec 2024 13:32:43 -0700 Subject: [PATCH 18/25] Update setup-wordpress-env.sh --- .github/files/setup-wordpress-env.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/files/setup-wordpress-env.sh b/.github/files/setup-wordpress-env.sh index 7a33af0ede8b..68116cff2876 100755 --- a/.github/files/setup-wordpress-env.sh +++ b/.github/files/setup-wordpress-env.sh @@ -51,7 +51,7 @@ for PLUGIN in projects/plugins/*/composer.json; do NAME="$(basename "$DIR")" echo "::group::Installing plugin $NAME into WordPress" - if [[ $NAME != 'jetpack' ]]; then + if [[ $NAME != 'jetpack' || $NAME != 'wpcomsh' ]]; then continue; fi From 5d16a1594fc86df993cdbe4a5562b2060e3bf30d Mon Sep 17 00:00:00 2001 From: tbradsha <32492176+tbradsha@users.noreply.github.com> Date: Mon, 16 Dec 2024 13:36:13 -0700 Subject: [PATCH 19/25] Update setup-wordpress-env.sh --- .github/files/setup-wordpress-env.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/files/setup-wordpress-env.sh b/.github/files/setup-wordpress-env.sh index 68116cff2876..4d0f90438056 100755 --- a/.github/files/setup-wordpress-env.sh +++ b/.github/files/setup-wordpress-env.sh @@ -49,12 +49,12 @@ EXIT=0 for PLUGIN in projects/plugins/*/composer.json; do DIR="${PLUGIN%/composer.json}" NAME="$(basename "$DIR")" - - echo "::group::Installing plugin $NAME into WordPress" - if [[ $NAME != 'jetpack' || $NAME != 'wpcomsh' ]]; then + if [[ $NAME != 'jetpack' && $NAME != 'wpcomsh' ]]; then continue; fi + echo "::group::Installing plugin $NAME into WordPress" + if php -r 'exit( preg_match( "/^>=\\s*(\\d+\\.\\d+)$/", $argv[1], $m ) && version_compare( PHP_VERSION, $m[1], "<" ) ? 0 : 1 );' "$( jq -r '.require.php // ""' "$DIR/composer.json" )"; then echo "::endgroup::" echo "Skipping install of plugin $NAME, requires PHP $( jq -r '.require.php // ""' "$DIR/composer.json" )" From 09229884899dcc391e8112037d2fa9395eee3cce Mon Sep 17 00:00:00 2001 From: tbradsha <32492176+tbradsha@users.noreply.github.com> Date: Mon, 16 Dec 2024 13:42:47 -0700 Subject: [PATCH 20/25] Update class-wpcom-themes-service.php --- .../wpcom-themes/includes/class-wpcom-themes-service.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/projects/plugins/wpcomsh/wpcom-themes/includes/class-wpcom-themes-service.php b/projects/plugins/wpcomsh/wpcom-themes/includes/class-wpcom-themes-service.php index 15f1ee210bfd..b737ea16295e 100644 --- a/projects/plugins/wpcomsh/wpcom-themes/includes/class-wpcom-themes-service.php +++ b/projects/plugins/wpcomsh/wpcom-themes/includes/class-wpcom-themes-service.php @@ -1,4 +1,4 @@ -api->fetch_theme( $slug ); + error_log( var_export( $wpcom_theme, true ) ); if ( ! $wpcom_theme ) { return null; From 98b6e182186545b0fd2362a3b62298239b682ccc Mon Sep 17 00:00:00 2001 From: tbradsha <32492176+tbradsha@users.noreply.github.com> Date: Mon, 16 Dec 2024 13:45:16 -0700 Subject: [PATCH 21/25] Update class-wpcom-themes-api.php --- .../wpcom-themes/includes/class-wpcom-themes-api.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/projects/plugins/wpcomsh/wpcom-themes/includes/class-wpcom-themes-api.php b/projects/plugins/wpcomsh/wpcom-themes/includes/class-wpcom-themes-api.php index 56d54843ee5c..63d09dc03300 100644 --- a/projects/plugins/wpcomsh/wpcom-themes/includes/class-wpcom-themes-api.php +++ b/projects/plugins/wpcomsh/wpcom-themes/includes/class-wpcom-themes-api.php @@ -1,4 +1,4 @@ -cache->run_cached( 'wpcom-themes-' . $slug, fn() => $this->handle_request( $url ) ); + error_log( var_export( $theme, true ) ); if ( ! $theme || isset( $theme->error ) ) { return null; From cd3f6d1e425f6947976e4e3624e724de435d3866 Mon Sep 17 00:00:00 2001 From: tbradsha <32492176+tbradsha@users.noreply.github.com> Date: Mon, 16 Dec 2024 13:46:48 -0700 Subject: [PATCH 22/25] Update class-wpcom-themes-service.php --- .../wpcom-themes/includes/class-wpcom-themes-service.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/projects/plugins/wpcomsh/wpcom-themes/includes/class-wpcom-themes-service.php b/projects/plugins/wpcomsh/wpcom-themes/includes/class-wpcom-themes-service.php index b737ea16295e..a4aa065ee3d8 100644 --- a/projects/plugins/wpcomsh/wpcom-themes/includes/class-wpcom-themes-service.php +++ b/projects/plugins/wpcomsh/wpcom-themes/includes/class-wpcom-themes-service.php @@ -126,9 +126,7 @@ protected function has_valid_theme_tier( stdClass $theme ): bool { * @return stdClass|null The theme object if found, null otherwise. */ public function get_theme( string $slug ): ?stdClass { - error_log( var_export( $slug, true ) ); $wpcom_theme = $this->api->fetch_theme( $slug ); - error_log( var_export( $wpcom_theme, true ) ); if ( ! $wpcom_theme ) { return null; From 23bd9f2a6715841c69ff0045e5fc275aefde2e05 Mon Sep 17 00:00:00 2001 From: tbradsha <32492176+tbradsha@users.noreply.github.com> Date: Mon, 16 Dec 2024 13:49:56 -0700 Subject: [PATCH 23/25] Update class-wpcom-themes-api.php --- .../wpcomsh/wpcom-themes/includes/class-wpcom-themes-api.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/plugins/wpcomsh/wpcom-themes/includes/class-wpcom-themes-api.php b/projects/plugins/wpcomsh/wpcom-themes/includes/class-wpcom-themes-api.php index 63d09dc03300..c789ffb2cfbe 100644 --- a/projects/plugins/wpcomsh/wpcom-themes/includes/class-wpcom-themes-api.php +++ b/projects/plugins/wpcomsh/wpcom-themes/includes/class-wpcom-themes-api.php @@ -93,7 +93,7 @@ public function fetch_all_non_delisted_themes(): array { */ public function fetch_theme( string $slug ): ?stdClass { error_log( var_export( 'fetch_theme', true ) ); - error_log( var_export( $url, $slug ) ); + error_log( var_export( $slug, true ) ); $url = sprintf( self::WP_COM_THEME_API_URL, $slug ); error_log( var_export( $url, true ) ); From 0dbd8152485296b619b10ea7a737fdf6fa9f08dc Mon Sep 17 00:00:00 2001 From: tbradsha <32492176+tbradsha@users.noreply.github.com> Date: Mon, 16 Dec 2024 13:57:59 -0700 Subject: [PATCH 24/25] ahaeh --- .../tests/php/sync/test_class.jetpack-sync-themes.php | 3 ++- projects/plugins/wpcomsh/functions.php | 1 - .../wpcom-themes/includes/class-wpcom-themes-api.php | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-themes.php b/projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-themes.php index d3bb43660cfd..68acafb459fc 100644 --- a/projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-themes.php +++ b/projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-themes.php @@ -535,11 +535,12 @@ private function install_theme( $slug ) { ) ); $overwrite = ''; + error_log(var_export('$api', true)); + error_log(var_export(!!$api, true)); if ( is_wp_error( $api ) ) { wp_die( $api ); } - error_log(var_export($api, true)); $upgrader = new Theme_Upgrader( new Silent_Upgrader_Skin() ); add_filter( 'pre_http_request', array( 'WP_Test_Jetpack_Sync_Base', 'pre_http_request_wordpress_org_updates' ), 10, 3 ); diff --git a/projects/plugins/wpcomsh/functions.php b/projects/plugins/wpcomsh/functions.php index f176b6a9bb89..8d3983f364a3 100644 --- a/projects/plugins/wpcomsh/functions.php +++ b/projects/plugins/wpcomsh/functions.php @@ -222,7 +222,6 @@ function wpcomsh_count_child_themes( $template ) { * @return bool|WP_Error */ function wpcomsh_symlink_parent_theme( $stylesheet ) { - error_log(var_export('wpcomsh_symlink_parent_theme', true)); $theme = wp_get_theme( $stylesheet ); $template = $theme->get_template(); diff --git a/projects/plugins/wpcomsh/wpcom-themes/includes/class-wpcom-themes-api.php b/projects/plugins/wpcomsh/wpcom-themes/includes/class-wpcom-themes-api.php index c789ffb2cfbe..bb2792f702fc 100644 --- a/projects/plugins/wpcomsh/wpcom-themes/includes/class-wpcom-themes-api.php +++ b/projects/plugins/wpcomsh/wpcom-themes/includes/class-wpcom-themes-api.php @@ -93,15 +93,15 @@ public function fetch_all_non_delisted_themes(): array { */ public function fetch_theme( string $slug ): ?stdClass { error_log( var_export( 'fetch_theme', true ) ); - error_log( var_export( $slug, true ) ); + error_log( var_export( ['slug',$slug], true ) ); $url = sprintf( self::WP_COM_THEME_API_URL, $slug ); - error_log( var_export( $url, true ) ); + error_log( var_export( ['url',$url], true ) ); $theme = $this->cache->run_cached( 'wpcom-themes-' . $slug, fn() => $this->handle_request( $url ) ); - error_log( var_export( $theme, true ) ); + error_log( var_export( ['theme',$theme], true ) ); if ( ! $theme || isset( $theme->error ) ) { return null; From 5a3704301a32fed2d1a865f727dd803d51a44c79 Mon Sep 17 00:00:00 2001 From: tbradsha <32492176+tbradsha@users.noreply.github.com> Date: Mon, 16 Dec 2024 14:07:16 -0700 Subject: [PATCH 25/25] Update test_class.jetpack-sync-themes.php --- .../jetpack/tests/php/sync/test_class.jetpack-sync-themes.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-themes.php b/projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-themes.php index 68acafb459fc..4787a80f08c5 100644 --- a/projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-themes.php +++ b/projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-themes.php @@ -304,8 +304,8 @@ public function test_install_edit_delete_theme_sync() { public function test_install_edit_delete_theme_synac() { error_log(var_export('test_install_edit_delete_theme_synac', true)); - $theme_slug = 'twentytwentyfour'; - $theme_name = 'Twenty Twenty-Four'; + $theme_slug = 'astra'; + $theme_name = 'Astra'; delete_theme( $theme_slug ); // Ensure theme is not lingering on file system $this->server_event_storage->reset();