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

Feature: Add compatibility layer and compatibility status output #48

Merged

Conversation

al-esc
Copy link
Contributor

@al-esc al-esc commented May 31, 2024


Adds automated compatibility fixes & reports on compatibility status for the following plugins:

  • AMP for WP – Accelerated Mobile Pages
  • Auth0
  • Autoptimize
  • Better Search Replace
  • Broken Link Checker
  • Contact Form 7
  • Event Espresso
  • Facebook for WordPress (official-facebook-pixel)
  • Fast Velocity Minify
  • Force Login
  • PolyLang
  • Redirection
  • Revive Old Post
  • Self-Updating Themes
  • Slider Revolution
  • WooZone
  • WP Rocket
  • YITH WooCommerce Extensions with MPDF Library

Reports on required manual plugin compatibility fixes:

  • Big File Uploads
  • Jetpack
  • Wordfence
  • WPML - The WordPress Multilingual Plugin

Reports on plugins with known compatibility issues that need review (are either incompatible or partially compatible):

  • AdThrive Ads
  • All-in-One WP Migration
  • Bookly
  • Coming Soon
  • Disable REST API and Require JWT / OAuth Authentication
  • Divi WordPress Theme & Visual Page Builder
  • Elementor
  • FacetWP
  • GDPR Cookie Consent
  • H5P
  • HM Require Login
  • Hummingbird
  • HyperDB
  • InfiniteWP
  • Instashow
  • Maintenance Mode
  • ManageWP worker
  • Monarch Social Sharing
  • New Relic Reporting for WordPress
  • Object Sync for Salesforce
  • One Click Demo Import
  • Posts 2 Posts
  • Query Monitor
  • Site24x7
  • Smush Pro
  • Solid Security (Previously: iThemes Security)
  • Unbounce Landing Pages
  • Unyson Theme Framework
  • Updraft / Updraft Plus Backup
  • Weather Station
  • WebP Express
  • WooCommerce
  • WordPress Download Manager
  • WP All Import / Export
  • WP Migrate DB
  • WP phpMyAdmin
  • WP Reset
  • WP-Ban
  • WPFront Notification Bar
  • Yoast Indexables
  • Yoast SEO

Reports compatibility status in a new tab on the Site Health admin page (screenshot attached)

SCR-20240531-eajt

@al-esc al-esc requested a review from a team as a code owner May 31, 2024 00:44
Copy link

guardrails bot commented May 31, 2024

⚠️ We detected 1 security issue in this pull request:

Insecure Access Control (1)
Severity Details Docs
Low Title: Insecure HTTP redirect
header( 'Location: ' . $redirect_header_value );
📚

More info on how to fix Insecure Access Control in PHP.


👉 Go to the dashboard for detailed results.

📥 Happy? Share your feedback with us.

@al-esc
Copy link
Contributor Author

al-esc commented May 31, 2024

@scottbuscemi compatibility layer PR here ^

@pwtyler pwtyler requested a review from jazzsequence May 31, 2024 04:16
Copy link
Contributor

@jazzsequence jazzsequence left a comment

Choose a reason for hiding this comment

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

Thanks for the PR! I've left some comments. A couple thoughts before really digging in...


I use the 🔢 emoji throughout to indicate "this is a comment that applies elsewhere in the code". It should be pretty obvious in the context but I'm not saying "this only needs to be changed in this file", I'm saying "anywhere there is code that is like this, it should be fixed there, too".

I would expect any new major functionality added to the mu-plugin to add equivalent tests for that functionality. We have WPUnit tests running against the plugin and, with this big of a change, I would expect at least some tests. (Unfortunately, forks don't trigger the GitHub actions, but we can manually trigger them ad hoc if necessary, which I did for this PR.) While I don't think you necessarily need to test every compatibility and fix class, it is at least worth writing tests for the base class with example/test compatibility checks/fixes.

We don't fully support translations in the mu-plugin, but all of our code should be internationalized with the expectation that at some point in the future, we could. There are a lot of plain text strings here that are not i18nized or not using the correct textdomain. The current codebase isn't consistent with what that is, but any new code should use 'pantheon' as the textdomain.

Many functions lack docblocks. For future maintainability, I would expect those to exist at least in the base class(es) and factory class.

Everything else looks great. Happy to chat next week if necessary to go into any of the fine grain details.

pantheon.php Outdated Show resolved Hide resolved
composer.json Outdated Show resolved Hide resolved
inc/compatibility/base.php Outdated Show resolved Hide resolved
inc/compatibility/class-acceleratedmobilepages.php Outdated Show resolved Hide resolved
inc/compatibility/class-compatibilityfactory.php Outdated Show resolved Hide resolved
inc/compatibility/fixes/class-selfupdatingthemesfix.php Outdated Show resolved Hide resolved
inc/compatibility/class-compatibilityfactory.php Outdated Show resolved Hide resolved
inc/compatibility/fixes/class-setserverportfix.php Outdated Show resolved Hide resolved
inc/compatibility/fixes/class-sliderrevolutionfix.php Outdated Show resolved Hide resolved
@al-esc
Copy link
Contributor Author

al-esc commented Jun 3, 2024

TYSM for the review @jazzsequence! The team is currently addressing your comments and will have an update ASAP. Thanks again! 🙌

@jazzsequence
Copy link
Contributor

@al-esc Feel free to hit me up if y'all want to chat. I'm around on Slack. :)

@al-esc al-esc requested a review from jazzsequence June 7, 2024 07:42
Copy link
Contributor

@jazzsequence jazzsequence left a comment

Choose a reason for hiding this comment

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

Looking good :)

A couple smaller changes requested, but this looks really close. The spacing issues are minor, and it's the inconsistency that I'm more concerned about. I know we're already inconsistent, and I don't want to add more inconsistency to the codebase.

inc/compatibility/class-acceleratedmobilepages.php Outdated Show resolved Hide resolved
inc/compatibility/fixes/class-autoptimizefix.php Outdated Show resolved Hide resolved
inc/compatibility/fixes/class-wprocketfix.php Outdated Show resolved Hide resolved
inc/site-health.php Outdated Show resolved Hide resolved
inc/site-health.php Outdated Show resolved Hide resolved
pantheon.php Outdated Show resolved Hide resolved
@jazzsequence
Copy link
Contributor

One last thought now that I'm actually testing it:

I like that we have our own separate tab. But I'm afraid it will get ignored too easily. It would be nice if manual fixes and things that "need review" also showed up in the main Site Health checks as recommendations with links to the Pantheon Compatibility tab for more information

Screenshot 2024-06-07 at 2 37 54 PM

@al-esc al-esc requested a review from jazzsequence June 14, 2024 12:20
@al-esc
Copy link
Contributor Author

al-esc commented Jun 14, 2024

@jazzsequence main site health info tab should now also output compatibility layer tests.

FYI phpcs is outputting a warning on:(looks like this has been addressed by pantheon-systems/Pantheon-WP-Coding-Standards#6)

@jazzsequence
Copy link
Contributor

Hey @al-esc
Just dropping a note here that I just got back from vacay this week, so I'll be jumping back into this hopefully today. I expect this will be a quick ✅ after I do some testing because I recall the last pass looked pretty much there.

Copy link
Contributor

@jazzsequence jazzsequence left a comment

Choose a reason for hiding this comment

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

Some very weird linting regressions. Did we get our PHPCS wires crossed? Some regressions broke URL strings and others affected code that was there before the compatibility layer feature you wrote. Not sure what happened. I'm fixing as many as I can find.

inc/compatibility/base.php Outdated Show resolved Hide resolved
inc/compatibility/base.php Outdated Show resolved Hide resolved
inc/compatibility/class-compatibilityfactory.php Outdated Show resolved Hide resolved
inc/compatibility/class-compatibilityfactory.php Outdated Show resolved Hide resolved
inc/compatibility/class-fastvelocityminify.php Outdated Show resolved Hide resolved
inc/site-health.php Outdated Show resolved Hide resolved
inc/site-health.php Outdated Show resolved Hide resolved
inc/site-health.php Outdated Show resolved Hide resolved
inc/site-health.php Outdated Show resolved Hide resolved
inc/site-health.php Outdated Show resolved Hide resolved
@jazzsequence
Copy link
Contributor

I guess I can't actually apply the suggestions in the PR. I will pull down and make the changes manually.

Copy link
Contributor

@jazzsequence jazzsequence left a comment

Choose a reason for hiding this comment

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

Okay, I've opened a PR against your fork since I can't merge changes directly into this PR: crowdfavorite#3

This fixes the various linting regressions that are in this last round.

Additionally, although I'm happy that we're now showing up on the main site health tab, it looks like there is a regression with the plugin names (presumably related to pulling out the hard-coded plugin names in favor of something more dynamic) that are displayed in both the main site health tab and the Pantheon Compatibility tab

Screenshot 2024-06-28 at 3 16 30 PM
Screenshot 2024-06-28 at 3 16 40 PM

Indeed, it looks like across the board, Plugin names are either not displaying or displaying the wrong data:
Screenshot 2024-06-28 at 3 17 27 PM

If we could get these things cleaned up I think we'll be good to go.

@al-esc
Copy link
Contributor Author

al-esc commented Jul 16, 2024

Hi @jazzsequence ! Apologies for the wait, this should hopefully solve plugin name retrieval. Let me know whenever you get a chance, please and thank you! 🙌
SCR-20240716-qjhy

Copy link
Contributor

@jazzsequence jazzsequence left a comment

Choose a reason for hiding this comment

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

This looks good so far. I'm going to pull this into my test site and take a peek but if that checks out we're good to go. A couple minor questions but nothing I'm going to block this on.

inc/compatibility/base.php Show resolved Hide resolved
inc/compatibility/base.php Outdated Show resolved Hide resolved
@jazzsequence
Copy link
Contributor

Strange, the plugin nice name isn't showing up in the list, just the slugified versions.

Screenshot 2024-07-17 at 10 58 20 AM

I'm not complaining, this is a huge step forward for the plugin overall and I feel like this is a thing we could iterate on. I'll open a separate issue for it so we remember to come back to it later.

Copy link
Contributor

@jazzsequence jazzsequence left a comment

Choose a reason for hiding this comment

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

:shipit:

@jazzsequence
Copy link
Contributor

@al-esc I clicked approve but it looks like there's one minor linting issue

FILE: inc/site-health.php
--------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------
 850 | ERROR | [x] Expected 1 space after "=>"; 2 found
     |       |     (WordPress.WhiteSpace.OperatorSpacing.SpacingAfter)
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

@al-esc
Copy link
Contributor Author

al-esc commented Jul 18, 2024

@jazzsequence thank you! I would definitely like to maybe spend a bit of time looking at this together, not quite sure what's going on there with the plugin names using the fallback values for you 🤔

@jazzsequence
Copy link
Contributor

@al-esc I did some digging/testing. Looks like paths are failing when you construct $file because what's coming through is, e.g. "/app/web/app/plugins/fast-velocity-minify/fvm.php" instead of "/app/plugins/fast-velocity-minify/fvm.php" -- at least in my Bedrock-based install. I will look into why Bedrock is giving WP_PLUGIN_DIR a value of "/app/web/app/plugins".

@jazzsequence
Copy link
Contributor

Oh wait, maybe it's actually because the plugins weren't active? I think there are a couple different things at work here.

Partially I think the names were wrong because the files didn't exist. And I think the files didn't exist because I had installed them in SFTP mode and then maybe didn't actually commit them to the repository -- meaning the checks ran, and cached in the database, but the plugins weren't actually there so when the plugin files were pulled for plugin information, there was nothing there.

I think this is probably an edge case but maybe something worth collaborating on in the future (specifically retaining check data if the plugin in question has been deactivated or uninstalled) but not worth pursuing at this time. I'm getting mostly correct plugin names now.

Screenshot 2024-07-29 at 1 07 47 PM

@jazzsequence jazzsequence merged commit 13a1a9f into pantheon-systems:main Jul 29, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: Missing function namespace in reference
2 participants