Skip to content

Conversation

@leogermani
Copy link
Contributor

This PR changes the token used by the stats module to make a request to the updateBlog XMLRPC endpoint. It drops the use of the "Master user" token and uses the blog token instead.

Jetpack product discussion

p9dueE-1Dv-p2#comment-2838

Does this pull request change what data or activity we track or use?

No

Testing instructions:

  • Open modules/stats.php file

  • At line 25 change the STATS_VERSIONvalue to a higher number, for example:
    define( 'STATS_VERSION', '10' );

  • This will force a call to the updateBlog endpoint

  • Browse the admin panel. Just viewing a page is enough

  • Check the stats_options option on the cache site and confirm the value for the version option key was updated :)

  • Now revert the change.

  • Undo the change to the constant value in the stats.php file.

  • On your local environment:

wp shell
$options = get_option( 'stats_options' );
unset($options['version']);
update_option( 'stats_options', $options );
  • Visit the dashboard
  • Check tha value of the option in the cache site is back to normal

Proposed changelog entry for your changes:

  • Use blog token to request the jetpack.updateBlog XMLRPC endpoint

@leogermani leogermani added this to the 8.9 milestone Aug 3, 2020
@leogermani leogermani self-assigned this Aug 3, 2020
Copy link

@test-case-reminder test-case-reminder bot left a comment

Choose a reason for hiding this comment

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

Here are some suggested test cases for this PR.

Stats

  • Visit home page, make sure that page view is recorded in stats
  • Visit home page in AMP view
  • Visit post page in non-AMP and AMP view

If you think that suggestions should be improved please edit the configuration file here. You can also modify/add test-suites to be used in the configuration file.

@jeherve jeherve added Connect Flow Connection banners, buttons, ... [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it [Status] In Progress labels Aug 4, 2020
@leogermani leogermani force-pushed the add/xmlrpc-async-call-lib branch from 56c669e to 8afe88b Compare August 4, 2020 14:05
@leogermani leogermani force-pushed the update/update_site_use_blog_token branch from 9ab6cb5 to 1ef9f66 Compare August 4, 2020 14:14
Base automatically changed from add/xmlrpc-async-call-lib to master August 5, 2020 17:05
@leogermani leogermani force-pushed the update/update_site_use_blog_token branch from 1ef9f66 to f4b64de Compare August 5, 2020 18:47
@jetpackbot
Copy link
Collaborator

Warnings
⚠️

The PR is missing at least one [Status] label. Suggestions: [Status] In Progress, [Status] Needs Review

This is an automated check which relies on PULL_REQUEST_TEMPLATE. We encourage you to follow that template as it helps Jetpack maintainers do their job. If you think 'Testing instructions' or 'Proposed changelog entry' are not needed for your PR - please explain why you think so. Thanks for cooperation 🤖

E2E results is available here (for debugging purposes): https://jetpack-e2e-dashboard.herokuapp.com/pr-16698

Generated by 🚫 dangerJS against f4b64de

@leogermani leogermani added the [Status] Needs Review This PR is ready for review. label Aug 12, 2020
@fgiannar fgiannar self-requested a review August 19, 2020 13:45
Copy link
Contributor

@fgiannar fgiannar left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@leogermani leogermani added [Status] Ready to Merge Go ahead, you can push that green button! and removed [Status] Needs Review This PR is ready for review. labels Aug 19, 2020
@leogermani leogermani merged commit 6e2e236 into master Aug 19, 2020
@leogermani leogermani deleted the update/update_site_use_blog_token branch August 19, 2020 18:47
@matticbot matticbot added [Status] Needs Changelog and removed [Status] Ready to Merge Go ahead, you can push that green button! labels Aug 19, 2020
davidlonjon added a commit that referenced this pull request Aug 20, 2020
* master: (23 commits)
  Premium Blocks: set blocks availability (#16898)
  Compat Package: Fix method declaration compatibility (#16900)
  Jetpack Dashboard: More meaningful error notices. (#16883)
  Connection REST API: Unit test for the `remote_authorize` request. (#16879)
  use blog token to request jetpack.updateBlog (#16698)
  Improve Story block media loading (#16663)
  Simplify error notices for broken connections (#16655)
  Use new heartbeat package (#16285)
  wrap-paid-block: remove component. deprecated. (#16895)
  Social Previews: improve preview description handling (#16889)
  Stats module use blog token (#16727)
  Form Block: add a new Consent Field, a new Newsletter setting, and a new newsletter variation (#16808)
  AAG: Backup card, fall back to VP content in case of /rewind API error. (#16867)
  Donations: Fix dependencies (#16892)
  Creative Mail: update option to lowercase (#16861)
  Premium Blocks: Implement the new design (#16611)
  Requests to Stats CSV use the blog token (#16716)
  Update spacing around sharing buttons to avoid no bottom margin below the customize link. (#16811)
  Jetpack SSO: Cleaning up the `requestNonce` API request. (#16830)
  Donations: Update plans when currency changes (#16844)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Connect Flow Connection banners, buttons, ... [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants