WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#10140 closed defect (bug) (fixed)

Files being deleted during upgrade

Reported by: takayukister Owned by: dd32
Milestone: 2.8.1 Priority: highest omg bbq
Severity: blocker Version: 2.8
Component: Upgrade/Install Keywords: has-patch commit
Focuses: Cc:

Description

I found some typos while looking into the forum posts on 2.8 upgrade deleting files from their server http://wordpress.org/support/topic/279104

Attachments (1)

update-core.diff (481 bytes) - added by takayukister 5 years ago.

Download all attachments as: .zip

Change History (12)

takayukister5 years ago

comment:1 peaceablewhale5 years ago

  • Keywords has-patch needs-review added
  • Milestone changed from Unassigned to 2.8.1
  • Priority changed from normal to high
  • Severity changed from critical to blocker

If the typo causes the upgrade script to delete files unexpectedly... it should be a blocker of the next release...

comment:2 Denis-de-Bernardy5 years ago

  • Priority changed from high to highest omg bbq

needs attention, too.

comment:3 Viper007Bond5 years ago

  • Summary changed from Typo in update-core.php (related to deleting outer files problem?) to Files being deleted during upgrade

Turning this into the general ticket for the upgrade craziness.

I attempted to upgrade a blog from 2.7.1 to 2.8. I have forced direct writes (as I have no FTP access, PHP isn't the owner, and SSH isn't complied in).

The blog being upgraded was located at /var/www/hosted/someblog.com/wordpress/. It initially errored out as I had forgotten to chmod to make all the WordPress file writable (I had been doing plugin upgrades for months with no problems).

Once writable, I tried again and it was taking forever (a few minutes), so I stopped it. After further investigation, I discovered lots of files missing. Here's some examples:

  • /var/www/hosted/viper007bond.com/public_html/wordpress/wp-content/plugins/ (entire directory gone)
  • /var/www/hosted/viper007bond.com/public_html/wordpress/wp-content/uploads/ (no files, only a folder inside)
  • /var/www/hosted/someothersite.com/www/htdocs/index.php
  • /home/anotherdomain/www/htdocs/index.php

Files in someothersite.com and anotherdomain weren't touched, only index.php was deleted.

Not sure if the above patch is the complete problem or not though.

comment:4 dd325 years ago

  • Keywords commit added; needs-review removed

..Crud

Yes, Attempting to delete null causes problems like that.. It gets interprated as its asking you to delete CWD or / by the underlying filesystem functions.

and an undefined variable(ie. $null) does that.

...2.8's filesystem abstraction files includes a patch already to prevent deletions of null.. But obviously, 2.7's doesnt, During an upgrade from 2.7 to 2.8, The 2.7's filesystem files are used (instead of new ones from 2.8), The end result, is.. this..

comment:5 dd325 years ago

And here's the faulty changeset:

http://core.trac.wordpress.org/changeset/11005/trunk/wp-admin/includes/update-core.php

It looks like the variable never got changed when it was copy-pasted from elsewhere, And i might've just assumed that it was correct when i came back to all the TODO's..

comment:6 archon8105 years ago

2.7.2 should have addressed the issue IMO - still can if you want to do the right thing and backport the fixes.

comment:7 dd325 years ago

2.7.2 should have addressed the issue IMO - still can if you want to do the right thing and backport the fixes.

The issue never existed under 2.7, The changes made were merely a preventative measure for the future. the changset mentioned above however trigered it under 2.7/2.8 upgrade.

comment:8 azaozz5 years ago

It seems the only way for this to happen is when update_core.php is from 2.8 but the WP_Filesystem classes are from 2.7. That could happen when an upgrade fails in the middle of copying files.

comment:9 azaozz5 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [11560]) Fix typo in update-core.php, props takayukister, fixes #10140 for 2.8.1

comment:10 azaozz5 years ago

(In [11561]) Fix typo in update-core.php, props takayukister, fixes #10140 for trunk

comment:11 dd325 years ago

It seems the only way for this to happen is when update_core.php is from 2.8 but the WP_Filesystem classes are from 2.7. That could happen when an upgrade fails in the middle of copying files.

Almost.

The process for a core upgrade is different from what you're thinking. The core upgrade extracts the files to a temporary folder, Then copies the new upgrade-core.php file into place (overwriting the previous version's file), Then includes it. So an upgrade will always have the new versions upgrade-core.php file, and the old files for everything else.

So this problem only ever occurs if the upgrade crashes half way through, ie. It extrats all files fine, But the process of copying new files into the new location fails.

Note: See TracTickets for help on using tickets.