creativecommons / sre-salt-prime

Site Reliability Engineering / DevOps SaltStack configuration files
MIT License
20 stars 9 forks source link

[Bug] add`upgrade-temp-backup` creation to salt to allow WordPress theme and plugin updates #287

Closed possumbilities closed 2 months ago

possumbilities commented 2 months ago

Description

When attempting a plugin or theme update via wpcli the following error occurs:

wpcli plugin update PLUGINNAME
plugin update PLUGINNAME
Enabling Maintenance mode...
Downloading update from https://downloads.wordpress.org/plugin/PLUGINNAME.x.x.x.zip...
Unpacking the update...
Installing the latest version...
Warning: Could not create the upgrade-temp-backup directory.
Plugin update failed.
Disabling Maintenance mode...
+------------+-------------+-------------+--------+
| name       | old_version | new_version | status |
+------------+-------------+-------------+--------+
| PLUGINNAME | x.x.x       | x.x.x       | Error  |
+------------+-------------+-------------+--------+
Error: No plugins updated (1 failed).

Due to a change from WordPress v6.3 onwards, when performing upgrades to plugins or themes the following directories must be present and properly permissioned:

Therefore, we should ensure that the upgrade-temp-backup folder is present. I am unsure if we also need to precreate and permission the plugins and themes directories as well. I believe the creation of the upgrade-temp-backup folder alone with the right user and group permissions should suffice; but I leave that up to other minds.

Reproduction

  1. run wpcli plugin update PLUGINNAME
  2. See error.

Expectation

The update should run successfully without error.

Resolution