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

Backup: Write helper script to ABSPATH by default, just like we did before #35508

Merged
merged 18 commits into from
Feb 8, 2024

Conversation

pypt
Copy link
Contributor

@pypt pypt commented Feb 7, 2024

In #34297, among other things, we've changed the order of directories to which we try to write the helper script.

Before that PR, the order was:

  1. ABSPATH
  2. wp-content/
  3. wp-content/uploads/

After that PR, the new order was:

  1. wp-content/
  2. wp-content/uploads/
  3. ABSPATH

This is because on some hosts, ABSPATH might point to weird locations, and on others, writing to ABSPATH won't be allowed due to security reasons.

It turned out that quite a few hosts disallow us from accessing PHP scripts from wp-content/ directly:

  • p1707297095152959-slack-CS8UYNPEE

So, we're changing back the default to ABSPATH, i.e. the order is now going to be back to:

  1. ABSPATH
  2. wp-content/
  3. wp-content/uploads/

Also, I've moved Package_Version class from a versioned VXXXX namespace because it's used in a filter, and due to the way it works, it would cause problems on plugin upgrades:

  • p1707319616800829/1705089030.985119-slack-CBG1CP4EN

Proposed changes:

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

p1707297095152959-slack-CS8UYNPEE

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

No.

Testing instructions:

Just like with #34297, run a Jetpack VaultPress Backup backup without credentials set up, so that the tool is then forced to upload the helper script via Jetpack API and thus trigger this code.

Please test upgrades as well, we had some hiccups with the Backup plugin getting updated with the versioning: #34739 (comment)

Writing to "wp-content/" has caused some issues, as some hosts don't allow PHP code from "wp-content/" to be accessed directly.
@pypt pypt self-assigned this Feb 7, 2024
@github-actions github-actions bot added [Feature] WPCOM API [Package] Backup [Package] Backup Helper Script Manager [Package] Transport Helper [Plugin] Backup A plugin that allows users to save every change and get back online quickly with one-click restores. [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Plugin] Migration [Status] In Progress [Tests] Includes Tests labels Feb 7, 2024
Copy link
Contributor

github-actions bot commented Feb 7, 2024

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.
  • ✅ 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 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 reviewed, it can then be merged.
If you need an extra review from someone familiar with the codebase, you can update the labels from "[Status] Needs Team Review" to "[Status] Needs Review", and in that case Jetpack Approvers will do a final review of your PR.


Jetpack plugin:

The Jetpack plugin has different release cadences depending on the platform:

  • WordPress.com Simple releases happen daily.
  • WoA releases happen weekly.
  • Releases to self-hosted sites happen monthly. The next release is scheduled for March 5, 2024 (scheduled code freeze on March 4, 2024).

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.


Backup plugin:

  • Next scheduled release: March 5, 2024.
  • Scheduled code freeze: February 26, 2024.

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.


Migration plugin:

  • Next scheduled release: March 5, 2024.
  • Scheduled code freeze: February 26, 2024.

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.

Copy link
Contributor

github-actions bot commented Feb 7, 2024

Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.

  • To test on WoA, go to the Plugins menu on a WordPress.com Simple site. Click on the "Upload" button and follow the upgrade flow to be able to upload, install, and activate the Jetpack Beta plugin. Once the plugin is active, go to Jetpack > Jetpack Beta, select your plugin, and enable the modify/backup-helper-script-prioritize-abspath branch.

  • To test on Simple, run the following command on your sandbox:

    bin/jetpack-downloader test jetpack modify/backup-helper-script-prioritize-abspath
    

Interested in more tips and information?

  • In your local development environment, use the jetpack rsync command to sync your changes to a WoA dev blog.
  • Read more about our development workflow here: PCYsg-eg0-p2
  • Figure out when your changes will be shipped to customers here: PCYsg-eg5-p2

@pypt pypt requested a review from a team February 7, 2024 14:21
@pypt pypt added [Status] Needs Review To request a review from Crew. Label will be renamed soon. [Status] Needs Team Review and removed [Status] In Progress labels Feb 7, 2024
@pypt pypt marked this pull request as ready for review February 7, 2024 14:22
@pypt pypt requested a review from Initsogar February 7, 2024 14:22
Copy link
Contributor

@Initsogar Initsogar 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 working on this. I just tested it using the core plugin and the standalone backup plugin, and it is working as expected.

@pypt pypt removed the [Status] Needs Review To request a review from Crew. Label will be renamed soon. label Feb 8, 2024
@pypt pypt requested a review from a team February 8, 2024 00:04
@pypt pypt added [Status] Needs Review To request a review from Crew. Label will be renamed soon. and removed [Status] Needs Team Review labels Feb 8, 2024
@pypt
Copy link
Contributor Author

pypt commented Feb 8, 2024

Thank you Rafa!

@Initsogar
Copy link
Contributor

I was taking a look into some manual upgrade tests using Beta Testers, and can confirm that upgrading from Jetpack 13.1.1 and Jetpack VaultPress Backup 2.4 to this branch is working as expected and no more PHP errors are thrown.

I think we are good to go ✅

@pypt pypt merged commit 7eba97c into trunk Feb 8, 2024
55 checks passed
@pypt pypt deleted the modify/backup-helper-script-prioritize-abspath branch February 8, 2024 01:26
@github-actions github-actions bot removed [Status] In Progress [Status] Needs Review To request a review from Crew. Label will be renamed soon. labels Feb 8, 2024
bindlegirl pushed a commit that referenced this pull request Feb 8, 2024
…efore (#35508)

* Write helper script to ABSPATH, just like we did before

Writing to "wp-content/" has caused some issues, as some hosts don't allow PHP code from "wp-content/" to be accessed directly.

* Bump class namespace version

#34739

* changelog

* Make the test expect the right order of install locations

* Fix up project versions

* Add proxy `Package_Version` classes with different namespaces

* Revert "Add proxy `Package_Version` classes with different namespaces"

This reverts commit abd558f.

* Don't use namespace versioning in Package_Version, add <...>\V0001\Package_Version proxy

* Use correct path to Package_Version in the test

* Fix package name in a test

* Move test to Automattic\Jetpack\Backup namespace

* Move Package_Version's compatibility class to separate file

* Add (possibly) missing import

* Apply the same behavior to Automattic\Jetpack\Transport_Helper\Package_Version too

* Fix up project/package versions again

* Fix transport-helper's actions.php to point to the right Package_Version
spsiddarthan pushed a commit that referenced this pull request Feb 15, 2024
…efore (#35508)

* Write helper script to ABSPATH, just like we did before

Writing to "wp-content/" has caused some issues, as some hosts don't allow PHP code from "wp-content/" to be accessed directly.

* Bump class namespace version

#34739

* changelog

* Make the test expect the right order of install locations

* Fix up project versions

* Add proxy `Package_Version` classes with different namespaces

* Revert "Add proxy `Package_Version` classes with different namespaces"

This reverts commit abd558f.

* Don't use namespace versioning in Package_Version, add <...>\V0001\Package_Version proxy

* Use correct path to Package_Version in the test

* Fix package name in a test

* Move test to Automattic\Jetpack\Backup namespace

* Move Package_Version's compatibility class to separate file

* Add (possibly) missing import

* Apply the same behavior to Automattic\Jetpack\Transport_Helper\Package_Version too

* Fix up project/package versions again

* Fix transport-helper's actions.php to point to the right Package_Version
@samiff samiff added this to the jetpack/13.1.3 milestone Feb 20, 2024
samiff pushed a commit that referenced this pull request Feb 20, 2024
…efore (#35508)

* Write helper script to ABSPATH, just like we did before

Writing to "wp-content/" has caused some issues, as some hosts don't allow PHP code from "wp-content/" to be accessed directly.

* Bump class namespace version

#34739

* changelog

* Make the test expect the right order of install locations

* Fix up project versions

* Add proxy `Package_Version` classes with different namespaces

* Revert "Add proxy `Package_Version` classes with different namespaces"

This reverts commit abd558f.

* Don't use namespace versioning in Package_Version, add <...>\V0001\Package_Version proxy

* Use correct path to Package_Version in the test

* Fix package name in a test

* Move test to Automattic\Jetpack\Backup namespace

* Move Package_Version's compatibility class to separate file

* Add (possibly) missing import

* Apply the same behavior to Automattic\Jetpack\Transport_Helper\Package_Version too

* Fix up project/package versions again

* Fix transport-helper's actions.php to point to the right Package_Version
@samiff
Copy link
Contributor

samiff commented Feb 20, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] WPCOM API [Package] Backup Helper Script Manager [Package] Backup [Package] Transport Helper [Plugin] Backup A plugin that allows users to save every change and get back online quickly with one-click restores. [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Plugin] Migration [Tests] Includes Tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants