pantheon-systems / pantheon-mu-plugin

Pantheon's WordPress mu-plugin for all WordPress-based upstreams.
MIT License
9 stars 5 forks source link

Pull Pantheon Advanced Page Cache into the mu-plugin [draft] #68

Open jazzsequence opened 3 weeks ago

jazzsequence commented 3 weeks ago

tl;dr

We should pull the Pantheon Advanced Page Cache plugin into the Pantheon MU plugin.

Why?

Risks

Implementation

If the site already has PAPC installed:

If the site does not have PAPC installed:

If the site has a version of WordPress older than 6.4:

If there was a problem requiring the library:

Deprecating PAPC

Pantheon Advanced Page Cache will need to push one final release around the same time that this is merged and deployed to the mu-plugin.

That update should display a deprecation notice that the plugin is not longer required if you are using the most recent version of the Pantheon mu-plugin and link to a piece of documentation (to be written, perhaps a release note) that discusses the change, the impact, the new defaults (and documentation to turn off the automattic inclusion of the "advanced" caching) and link to documentation for the filter to override the default cache max age options. A similar note should be added to the top of the readme files.

At that point, we can remove any secrets and archive the Pantheon Advanced Page Cache repository on GitHub (and Packagist).

pwtyler commented 3 weeks ago

I am not strongly against PAPC moving into the mu plugin, but the biggest loss I see to moving is our ability to iterate and version PAPC faster outside of the mu plugin as it is not tied to CMS/upstream update cadence. Divorcing upstream updates from CMS updates would ease this, but either way PAPC is essentially locked to the latest version of WordPress. Whether that's a bug or a feature likely lies in the eye of the beholder.

I do think the current split of functionality and hooks between the two can be confusing at times (tripping me up recently with #67)

The "advanced" features should be able to be toggled on/off (in the case that a user legitimately does not want the benefits of PAPC)

Is your expectation here that this would have a dashboard UI/wp_options setting, or would a filter suffice?

jazzsequence commented 3 weeks ago

Is your expectation here that this would have a dashboard UI/wp_options setting, or would a filter suffice?

Specifically a visible (in the UX) toggle. We can also toggle on/off via a filter to override, but I'm thinking about people who don't want (or for now don't know that they want) to turn PAPC "on".

our ability to iterate and version PAPC faster outside of the mu plugin as it is not tied to CMS/upstream update cadence

True. However, I don't see that we're doing (or likely to do) a ton of PAPC updates such that this would be a significant issue. And, it's more a problem with the WordPress upstream deployment/update strategy than a problem with putting things into the mu-plugin specifically (we've been in this state for a long time already with not being able to "push" mu-plugin updates outside of WP releases -- and a workaround exists to just create our own Pantheon-specific releases if we needed to).

jazzsequence commented 3 weeks ago

I don't see that we're doing (or likely to do) a ton of PAPC updates such that this would be a significant issue.

Also, this could be seen as a feature rather than a bug. Tying updates to WP releases means we can worry less about backwards compatibility with older versions of WordPress (except with Composer-based installs).

stevector commented 2 weeks ago

What would we do with the analogous PAPC Drupal module? I think we'd create confusion by eliminating the WordPress plugin but not the Drupal module.

@jazzsequence? Is your motivation more about eliminating the distinct plugin or more about getting it installed on every site?

jazzsequence commented 1 week ago

@stevector My motivation is both.

  1. This plugin does not serve anyone not on Pantheon. The WordPress.org repository is (ideally) a place to get plugins that could be used in any context. Having a plugin that's only usable by a subset of the audience of WordPress.org doesn't make sense.
    • In the Drupal space, it's more commonly accepted for modules to be required at the site level. There's an argument to be made that we could just require it in the base upstream composer.json -- I don't know the difference between how pantheon_advanced_page_cache works differently than pantheon-advanced-page-cache but I don't think the end result is a Pantheon Page Cache page in the admin of every site that is not created by Pantheon Advanced Page Cache and, in fact, leaves important features missing, leading to confusion between "Page Cache" and "Advanced Page Cache" (which does not add an admin page).
  2. There are almost no cases where this plugin should not just be installed on every WordPress site. Could we add it to the upstream? Sure. But that requires a lot more toil and maintenance because we'd need to treat it like the pantheon-mu-plugin to pull it into the vanilla WordPress upstream and that would likely lead to conflicts (especially when customers already have it installed).

It also serves a third purpose:

  1. The codebase is already mixed and confusing. The MU plugin adds pieces of "Pantheon Page Cache" functionality that are used by "Pantheon Advanced Page Cache" and "Pantheon Advanced Page Cache" -- by necessity -- has to find ways to interact with code that exists in the mu-plugin rather than its own codebase. It's a maintenance burden because it's not always clear what code exists where (and frequently it's the opposite of what you would expect). Pulling PAPC into the mu-plugin solves the maintenance burden by putting all the relevant code in one place.

What's more, this is something that people are wanting and asking for. When I have brought this up in Community Slack and office hours, I always get wholehearted support for pulling PAPC into the mu-plugin and just giving it to everyone automatically, and it solves the problem of "when I update a post on my site, it does not update?" "did you install Pantheon Advanced Page Cache?" problem.

stevector commented 5 days ago

Makes sense. I think the way forward is for @scottbuscemi / @DuncanSchouten to organize / prioritize this idea in Productboard.

jazzsequence commented 4 days ago

Productboard link: https://pantheon.productboard.com/all-notes?d=notes%2F41919565