[wp-trac] [WordPress Trac] #51857: Add rollback for failed plugin/theme updates

WordPress Trac noreply at wordpress.org
Thu Mar 18 06:04:52 UTC 2021


#51857: Add rollback for failed plugin/theme updates
-------------------------------+-----------------------
 Reporter:  pbiron             |       Owner:  pbiron
     Type:  enhancement        |      Status:  reopened
 Priority:  normal             |   Milestone:  5.8
Component:  Upgrade/Install    |     Version:
 Severity:  normal             |  Resolution:
 Keywords:  early needs-patch  |     Focuses:
-------------------------------+-----------------------

Comment (by galbaras):

 > I think comment:56 is the preferred direction here.

 This great approach can be combined with avoiding `copy_dir()` altogether
 and using `move()` again.

 1. Unpack the zip file to `hello.update.1234`
 2. If unsuccessful, return false
 3. If `hello.old` exists, remove it
 3. Move `hello` to `hello.old`
 4. Move `hello.update.1234` to `hello`
 5. Later on (manually and/or scheduled), remove `hello.old`.

 `move()` should fail a lot less often than `copy_dir()`, especially since
 it uses delete & copy anyway when direct renaming fails.

 This should greatly simplify the entire upgrade process, make it faster
 and provide a way to recover from problems by quickly restoring
 `hello.old` to whence it came, also by deleting and renaming.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/51857#comment:83>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list