WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#25576 closed defect (bug) (fixed)

Check the available disk space before attempting upgrades

Reported by: dd32 Owned by: nacin
Milestone: 3.7 Priority: normal
Severity: normal Version:
Component: Upgrade/Install Keywords: has-patch
Focuses: Cc:

Description

At present we attempt to upgrade WordPress without first checking that there's enough space to uncompress the archive into the working directory.

Attached is a patch to check the disk space prior to Zip extraction, It only checks there's enough space to extract into the Working directory (which is in WP_CONTENT_DIR/upgrade).

Attachments (1)

25576.diff (2.6 KB) - added by dd32 3 years ago.

Download all attachments as: .zip

Change History (7)

@dd32
3 years ago

#1 @nacin
3 years ago

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

In 25774:

In unzip_file(), confirm we have enough available disk space before extracting.

"enough" is calculated by adding up the uncompressed size of the files in the archive, then adding a 20% buffer.

props dd32.
fixes #25576.

#2 @nacin
3 years ago

In 25775:

In the upgrader, only print additional error data if it is a string.

As in [25576], we sometimes want to return additional data that is not necessarily meant for UI consumption.

see #25576.

#3 @nacin
3 years ago

In 25776:

Account for possible failures by disk_free_space(), as well as the potential need to copy the unzipped files.

see #25576.

#4 @nacin
3 years ago

In 25778:

Account for the possible failure of disk_free_space() in update_core().

see #22704, #25576.

#5 @nacin
3 years ago

In 25796:

In show_message(), only print error data if it is a string.

see #25576, [25775].

#6 @dd32
3 years ago

In 25831:

Silence PHP warnings from disk_free_space(). disk_free_space() will produce a warning in error conditions in addition to returning false, this includes a case where the bytes free is greater than PHP_INT_MAX (which is a error condition we don't need to check).
See #25576, #22704

Note: See TracTickets for help on using tickets.