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

General: remove deprecated core get_page_by_title #29460

Merged
merged 5 commits into from
Mar 23, 2023

Conversation

jeherve
Copy link
Member

@jeherve jeherve commented Mar 14, 2023

Proposed changes:

See #27795

Let's use direct WP queries instead, as recommended:
https://make.wordpress.org/core/2023/03/06/get_page_by_title-deprecated/

Other information:

  • Have you written new tests for your changes, if applicable?
  • Have you checked the E2E test CI results, and verified that your changes do not break them?
  • Have you tested your changes on WordPress.com, if applicable (if so, you'll see a generated comment below with a script to run)?

Jetpack product discussion

  • N/A

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

  • No

Testing instructions:

The changes in Jetpack's functions.global.php are not really used anymore. We could probably get rid of all that logic at this point; the code exists to facilitate the migration from our own widget (

class Jetpack_Image_Widget extends WP_Widget {
) to the Core widget (see #7103). This happened in WP 4.8, so we could probably remove our widget and the logic. Created #29458 to keep track of that.

The change to the Debug Helper like so;

  • Activate the Jetpack Debug plugin
  • Go to /wp-admin/admin.php?page=jetpack-debug-tools
  • Activate the "Jetpack Scan Helper" module
  • Go to /wp-admin/admin.php?page=scan-helper
  • Activate each threat and validate that it is added to the site, via the Protect plugin.
  • Deactivate each threat and validate that it is removed from the site.

@jeherve jeherve added [Status] Needs Review To request a review from fellow Jetpack developers. Label will be renamed soon. [Type] Janitorial [Pri] Normal labels Mar 14, 2023
@jeherve jeherve self-assigned this Mar 14, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Mar 14, 2023

Are you an Automattician? You can now test your Pull Request on WordPress.com. On your sandbox, run

bin/jetpack-downloader test jetpack fix/deprecated-get-page-by-title

to get started. More details: p9dueE-5Nn-p2

@github-actions github-actions bot added [Plugin] Debug Helper Debug Tools plugin [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ labels Mar 14, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Mar 14, 2023

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ⚠️ All commits were linted before commit.
  • ✅ Add a "[Status]" label (In Progress, Needs Team Review, ...).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖


The e2e test report can be found here. Please note that it can take a few minutes after the e2e tests checks are complete for the report to be available.


Once your PR is ready for review, check one last time that all required checks (other than "Required review") appearing at the bottom of this PR are passing or skipped.
Then, add the "[Status] Needs Team review" label and ask someone from your team review the code.
Once you’ve done so, switch to the "[Status] Needs Review" label; someone from Jetpack Crew will then review this PR and merge it to be included in the next Jetpack release.


Jetpack plugin:

  • Next scheduled release: April 4, 2023.
  • Scheduled code freeze: March 28, 2023.

Debug Helper plugin:

  • Next scheduled release: April 4, 2023.
  • Scheduled code freeze: March 27, 2023.

@jeherve jeherve enabled auto-merge (squash) March 15, 2023 09:38
@oskosk
Copy link
Contributor

oskosk commented Mar 15, 2023

This looks good. I'm going through the testing instructions right now. Waiting for Protect to come back to me. One question. Do we have a preference on WP_Query over get_posts()

@oskosk
Copy link
Contributor

oskosk commented Mar 15, 2023

I'm not able to trigger the code path for testing this. The Scan debug helper, with all the checkboxes active, makes Protect only report the EICAR Threat to me
image

@jeherve
Copy link
Member Author

jeherve commented Mar 15, 2023

One question. Do we have a preference on WP_Query over get_posts()

I suppose get_posts() would work just as well in this scenario, I only picked WP_Query because of personal preference. Happy to change if that's a problem.

The Scan debug helper, with all the checkboxes active, makes Protect only report the EICAR Threat to me

Same thing for me. That may be a better question for @nateweller ; in my testing I sticked to checking that the Scan test post could be added and removed when toggling the option.

@nateweller
Copy link
Contributor

nateweller commented Mar 15, 2023

I end up with seven identified threats, but it does not include the database threat. The scan tester post is added correctly, but we aren't detecting it as a threat. The scan team will have to look into this further (tasked: 1201069996155224-as-1204188299254038). Thanks for tagging!

One potential thing to check - have you previously ignored these threats? Can check here: https://cloud.jetpack.com/scan/history/example.com/ignored

The changes in this PR that affect the scan debug helper LGTM :shipit:

Screenshot 2023-03-15 at 12 34 30 PM

@jeherve jeherve merged commit 9986300 into trunk Mar 23, 2023
@jeherve jeherve deleted the fix/deprecated-get-page-by-title branch March 23, 2023 13:30
@bindlegirl bindlegirl removed the [Status] Needs Review To request a review from fellow Jetpack developers. Label will be renamed soon. label Mar 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Plugin] Debug Helper Debug Tools plugin [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Pri] Normal [Type] Janitorial
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants