Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(esp-sync): broken CLI sync command #3762

Merged
merged 1 commit into from
Feb 18, 2025
Merged

Conversation

dkoo
Copy link
Contributor

@dkoo dkoo commented Feb 18, 2025

All Submissions:

Changes proposed in this Pull Request:

There must have been a bad merge recently which broke the wp newspack esp sync CLI command.

How to test the changes in this Pull Request:

  1. On release, run wp newspack esp sync via CLI and observe an error:
Warning: Undefined variable $customer in /wordpress/plugins/newspack-plugin/5.14.0/includes/reader-activation/sync/class-esp-sync.php on line 241
Fatal error: Uncaught Error: Call to a member function get_email() on null in /wordpress/plugins/newspack-plugin/5.14.0/includes/reader-activation/sync/class-esp-sync.php:241
Stack trace:
#0 /wordpress/plugins/newspack-plugin/5.14.0/includes/cli/class-ras-esp-sync.php(223): Newspack\Reader_Activation\ESP_Sync::sync_contact('10612', true)
#1 /wordpress/plugins/newspack-plugin/5.14.0/includes/cli/class-ras-esp-sync.php(394): Newspack\CLI\RAS_ESP_Sync::sync_contacts(Array)
#2 [internal function]: Newspack\CLI\RAS_ESP_Sync::cli_sync_contacts(Array, Array)
#3 phar:///usr/local/bin/wp-cli/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/CommandFactory.php(100): call_user_func(Array, Array, Array)
#4 [internal function]: WP_CLI\Dispatcher\CommandFactory::WP_CLI\Dispatcher\{closure}(Array, Array)
#5 phar:///usr/local/bin/wp-cli/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/Subcommand.php(497): call_user_func(Object(Closure), Array, Array)
#6 phar:///usr/local/bin/wp-cli/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(441): WP_CLI\Dispatcher\Subcommand->invoke(Array, Array, Array)
#7 phar:///usr/local/bin/wp-cli/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(464): WP_CLI\Runner->run_command(Array, Array)
#8 phar:///usr/local/bin/wp-cli/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1295): WP_CLI\Runner->run_command_and_exit()
#9 phar:///usr/local/bin/wp-cli/vendor/wp-cli/wp-cli/php/WP_CLI/Bootstrap/LaunchRunner.php(28): WP_CLI\Runner->start()
#10 phar:///usr/local/bin/wp-cli/vendor/wp-cli/wp-cli/php/bootstrap.php(83): WP_CLI\Bootstrap\LaunchRunner->process(Object(WP_CLI\Bootstrap\BootstrapState))
#11 phar:///usr/local/bin/wp-cli/vendor/wp-cli/wp-cli/php/wp-cli.php(32): WP_CLI\bootstrap()
#12 phar:///usr/local/bin/wp-cli/php/boot-phar.php(20): include('phar:///usr/loc...')
#13 /usr/local/bin/wp-cli(4): include('phar:///usr/loc...')
#14 {main}
  thrown in /wordpress/plugins/newspack-plugin/5.14.0/includes/reader-activation/sync/class-esp-sync.php on line 241
Error: There has been a critical error on this website.Learn more about troubleshooting WordPress. There has been a critical error on this website.
  1. Check out this branch, re-run, and confirm that it succeeds.

Other information:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes, as applicable?
  • Have you successfully ran tests with your changes locally?

@dkoo dkoo added the [Status] Needs Review The issue or pull request needs to be reviewed label Feb 18, 2025
@dkoo dkoo self-assigned this Feb 18, 2025
@dkoo dkoo requested a review from a team as a code owner February 18, 2025 18:34
Copy link
Member

@miguelpeixe miguelpeixe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issue was caused by the sync_contact() method decoupling from #3661. It missed updating this variable in the CLI context.

I think the processed count should work either way, given it's static from an inherited class. Still, your change is better.

@github-actions github-actions bot added [Status] Approved The pull request has been reviewed and is ready to merge and removed [Status] Needs Review The issue or pull request needs to be reviewed labels Feb 18, 2025
@dkoo dkoo merged commit f609670 into release Feb 18, 2025
10 checks passed
@dkoo dkoo deleted the hotfix/ras-esp-sync-cli branch February 18, 2025 19:28
matticbot pushed a commit that referenced this pull request Feb 18, 2025
## [5.14.1](v5.14.0...v5.14.1) (2025-02-18)

### Bug Fixes

* **esp-sync:** broken CLI sync command ([#3762](#3762)) ([f609670](f609670))
@matticbot
Copy link
Contributor

🎉 This PR is included in version 5.14.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
released [Status] Approved The pull request has been reviewed and is ready to merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants