Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
f4144d8
Add changes from #5195
mikachan Sep 20, 2023
d1960cc
Add changes from #5235
mikachan Sep 20, 2023
63217cd
Output of sync-gutenberg-packages so far
mikachan Sep 20, 2023
59dd68d
Revert comments in update-core.php
mikachan Sep 20, 2023
413751d
Update from latest sync script run
mikachan Sep 20, 2023
3adb980
Potential fix for sync sourcemap warning
mikachan Sep 21, 2023
bb55583
Always enqueue prod Interactivity API
mikachan Sep 21, 2023
22bad59
Update from successful sync packages run
mikachan Sep 21, 2023
dd177b0
Clean interactivity assets
mikachan Sep 21, 2023
f881350
Update from successful sync packages run
mikachan Sep 21, 2023
bac2694
Update src/wp-includes/script-loader.php
mikachan Sep 21, 2023
f06bde5
Merge branch 'trunk' into packpage-updates-6.4-beta1
mikachan Sep 21, 2023
ae84988
Results of sync packages script after merge with trunk
mikachan Sep 21, 2023
670ad3a
Update packages using wp-6.4 dist-tag
mikachan Sep 25, 2023
b2a22e2
Merge branch 'trunk' into packpage-updates-6.4-beta1
mikachan Sep 25, 2023
47dde56
Results of npm run build:dev
mikachan Sep 25, 2023
836b9d0
Update tools/webpack/blocks.js
mikachan Sep 25, 2023
9beee04
Re-run npm run build:dev
mikachan Sep 25, 2023
c22d71b
Remove sync pkg from sourcemap config
mikachan Sep 26, 2023
ea5bb8b
Update search/view path
mikachan Sep 26, 2023
709b604
Update src/wp-includes/script-loader.php
mikachan Sep 26, 2023
3cea4be
Docs: Correct typo in new `@since` tag.
desrosj Sep 25, 2023
219483f
Coding Standards: Fix a few newly introduced WPCS issues.
SergeyBiryukov Sep 25, 2023
75c3843
Options, Meta APIs: Improve logic to avoid unnecessary database write…
felixarntz Sep 25, 2023
1e1ed26
Script Loader: Replace hardcoded output of style tags with calls to `…
spacedmonkey Sep 25, 2023
76ea238
Editor: Introduce get_block_asset_url Utility Function.
spacedmonkey Sep 25, 2023
d87f9b8
HTML API: Remove all duplicate copies of an attribute when removing.
ockham Sep 25, 2023
4e4b94a
Docs: Revert [56679].
desrosj Sep 25, 2023
a6bf745
Script Loader: Use `wp_get_script_tag()` and `wp_get_inline_script_ta…
westonruter Sep 25, 2023
0eae815
Fonts: Get font-family name from 'fontFamily' field.
hellofromtonya Sep 25, 2023
ef7fa1c
Filesystem API: Introduce filters for before/after unzipping archives.
costdev Sep 25, 2023
6bbce3a
Media: Rely on `wp_get_loading_optimization_attributes()` to add `dec…
felixarntz Sep 25, 2023
670ab40
Filesystem API: Add missing ZIP file for unzip tests.
costdev Sep 25, 2023
f92ba90
Coding Standards: Fix a few newly introduced WPCS issues.
SergeyBiryukov Sep 26, 2023
99a2b31
Media: Ensure images within shortcodes are correctly considered for l…
felixarntz Sep 26, 2023
89f228b
Code Modernization: Rename parameters that use reserved keywords in `…
SergeyBiryukov Sep 26, 2023
6e02a73
Coding Standards: Upgrade WPCS to version 3.0.0.
SergeyBiryukov Sep 26, 2023
b7614a2
Build/Test Tools: Use the latest PHP version for the coding standards…
SergeyBiryukov Sep 26, 2023
5d0827c
Administration: Add event type to Events and News widget.
peterwilsoncc Sep 26, 2023
42eb473
Editor: make better use of Tag Processor in layout block support.
tellthemachines Sep 26, 2023
1ba9ebb
Build: Introduce SCRIPT_DEBUG global in webpack processing
gziolo Sep 26, 2023
3b6b60f
Editor: remove null coalescing operator from layout.
tellthemachines Sep 26, 2023
cf48792
Results of npm run build:dev
mikachan Sep 26, 2023
59c1099
Add sync pkg back to sourcemaps config
mikachan Sep 26, 2023
babbb7a
Add sync package to list of bundled packages
mikachan Sep 26, 2023
fce438a
Remove sync package from sourcemap config
mikachan Sep 26, 2023
6854286
Results of npm run build:dev
mikachan Sep 26, 2023
ab68c96
Revert "Results of npm run build:dev"
mikachan Sep 26, 2023
37c51de
Revert "Remove sync package from sourcemap config"
mikachan Sep 26, 2023
6c77b49
Revert "Add sync package to list of bundled packages"
mikachan Sep 26, 2023
27f9047
Revert "Add sync pkg back to sourcemaps config"
mikachan Sep 26, 2023
5fa88d6
Revert "Results of npm run build:dev"
mikachan Sep 26, 2023
ee20e57
Revert "Editor: remove null coalescing operator from layout."
mikachan Sep 26, 2023
1c1fe1b
Revert "Build: Introduce SCRIPT_DEBUG global in webpack processing"
mikachan Sep 26, 2023
3333c8d
Revert "Editor: make better use of Tag Processor in layout block supp…
mikachan Sep 26, 2023
2bec0bd
Revert "Administration: Add event type to Events and News widget."
mikachan Sep 26, 2023
5d078a5
Revert "Build/Test Tools: Use the latest PHP version for the coding s…
mikachan Sep 26, 2023
7a97b66
Revert "Coding Standards: Upgrade WPCS to version 3.0.0."
mikachan Sep 26, 2023
78f9484
Revert "Code Modernization: Rename parameters that use reserved keywo…
mikachan Sep 26, 2023
abad93f
Revert "Media: Ensure images within shortcodes are correctly consider…
mikachan Sep 26, 2023
2b1df6e
Revert "Coding Standards: Fix a few newly introduced WPCS issues."
mikachan Sep 26, 2023
bbff6d0
Revert "Filesystem API: Add missing ZIP file for unzip tests."
mikachan Sep 26, 2023
c8bd058
Revert "Media: Rely on `wp_get_loading_optimization_attributes()` to …
mikachan Sep 26, 2023
43672e6
Revert "Filesystem API: Introduce filters for before/after unzipping …
mikachan Sep 26, 2023
9c06e87
Revert "Fonts: Get font-family name from 'fontFamily' field."
mikachan Sep 26, 2023
de4ce4f
Revert "Script Loader: Use `wp_get_script_tag()` and `wp_get_inline_s…
mikachan Sep 26, 2023
2237a5d
Revert "Docs: Revert [56679]."
mikachan Sep 26, 2023
bcb6413
Revert "HTML API: Remove all duplicate copies of an attribute when re…
mikachan Sep 26, 2023
58235ef
Revert "Editor: Introduce get_block_asset_url Utility Function."
mikachan Sep 26, 2023
bdb938c
Revert "Script Loader: Replace hardcoded output of style tags with ca…
mikachan Sep 26, 2023
0b307fa
Revert "Options, Meta APIs: Improve logic to avoid unnecessary databa…
mikachan Sep 26, 2023
18ecc50
Revert "Coding Standards: Fix a few newly introduced WPCS issues."
mikachan Sep 26, 2023
291019e
Revert "Docs: Correct typo in new `@since` tag."
mikachan Sep 26, 2023
132c57c
Add sync package to list of bundled packages
mikachan Sep 26, 2023
2ae8c6d
Results of npm run build:dev
mikachan Sep 26, 2023
0587148
Cherry-pick "Results of npm run build:dev"
mikachan Sep 26, 2023
bb34412
Latest results from build:dev
mikachan Sep 26, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Revert "Filesystem API: Introduce filters for before/after unzipping …
…archives."

This reverts commit ef7fa1c.
  • Loading branch information
mikachan committed Sep 26, 2023
commit 43672e6cad44ae06cb87f6bf1567ff59586d67c9
63 changes: 6 additions & 57 deletions src/wp-admin/includes/file.php
Original file line number Diff line number Diff line change
Expand Up @@ -1697,9 +1697,6 @@ function _unzip_file_ziparchive( $file, $to, $needed_dirs = array() ) {
}
}

// Enough space to unzip the file and copy its contents, with a 10% buffer.
$required_space = $uncompressed_size * 2.1;

/*
* disk_free_space() could return false. Assume that any falsey value is an error.
* A disk that has zero free bytes has bigger problems.
Expand All @@ -1708,7 +1705,7 @@ function _unzip_file_ziparchive( $file, $to, $needed_dirs = array() ) {
if ( wp_doing_cron() ) {
$available_space = function_exists( 'disk_free_space' ) ? @disk_free_space( WP_CONTENT_DIR ) : false;

if ( $available_space && ( $required_space > $available_space ) ) {
if ( $available_space && ( $uncompressed_size * 2.1 ) > $available_space ) {
return new WP_Error(
'disk_full_unzip_file',
__( 'Could not copy files. You may have run out of disk space.' ),
Expand Down Expand Up @@ -1749,26 +1746,7 @@ function _unzip_file_ziparchive( $file, $to, $needed_dirs = array() ) {
return new WP_Error( 'mkdir_failed_ziparchive', __( 'Could not create directory.' ), $_dir );
}
}

/**
* Filters archive unzipping to override with a custom process.
*
* @since 6.4.0
*
* @param null|true|WP_Error $result The result of the override. True on success, otherwise WP Error. Default null.
* @param string $file Full path and filename of ZIP archive.
* @param string $to Full path on the filesystem to extract archive to.
* @param string[] $needed_dirs A full list of required folders that need to be created.
* @param float $required_space The space required to unzip the file and copy its contents, with a 10% buffer.
*/
$pre = apply_filters( 'pre_unzip_file', null, $file, $to, $needed_dirs, $required_space );

if ( null !== $pre ) {
// Ensure the ZIP file archive has been closed.
$z->close();

return $pre;
}
unset( $needed_dirs );

for ( $i = 0; $i < $z->numFiles; $i++ ) {
$info = $z->statIndex( $i );
Expand Down Expand Up @@ -1803,22 +1781,7 @@ function _unzip_file_ziparchive( $file, $to, $needed_dirs = array() ) {

$z->close();

/**
* Filters the result of unzipping an archive.
*
* @since 6.4.0
*
* @param true|WP_Error $result The result of unzipping the archive. True on success, otherwise WP_Error. Default true.
* @param string $file Full path and filename of ZIP archive.
* @param string $to Full path on the filesystem the archive was extracted to.
* @param string[] $needed_dirs A full list of required folders that were created.
* @param float $required_space The space required to unzip the file and copy its contents, with a 10% buffer.
*/
$result = apply_filters( 'unzip_file', true, $file, $to, $needed_dirs, $required_space );

unset( $needed_dirs );

return $result;
return true;
}

/**
Expand Down Expand Up @@ -1875,9 +1838,6 @@ function _unzip_file_pclzip( $file, $to, $needed_dirs = array() ) {
$needed_dirs[] = $to . untrailingslashit( $file['folder'] ? $file['filename'] : dirname( $file['filename'] ) );
}

// Enough space to unzip the file and copy its contents, with a 10% buffer.
$required_space = $uncompressed_size * 2.1;

/*
* disk_free_space() could return false. Assume that any falsey value is an error.
* A disk that has zero free bytes has bigger problems.
Expand All @@ -1886,7 +1846,7 @@ function _unzip_file_pclzip( $file, $to, $needed_dirs = array() ) {
if ( wp_doing_cron() ) {
$available_space = function_exists( 'disk_free_space' ) ? @disk_free_space( WP_CONTENT_DIR ) : false;

if ( $available_space && ( $required_space > $available_space ) ) {
if ( $available_space && ( $uncompressed_size * 2.1 ) > $available_space ) {
return new WP_Error(
'disk_full_unzip_file',
__( 'Could not copy files. You may have run out of disk space.' ),
Expand Down Expand Up @@ -1927,13 +1887,7 @@ function _unzip_file_pclzip( $file, $to, $needed_dirs = array() ) {
return new WP_Error( 'mkdir_failed_pclzip', __( 'Could not create directory.' ), $_dir );
}
}

/** This filter is documented in src/wp-admin/includes/file.php */
$pre = apply_filters( 'pre_unzip_file', null, $file, $to, $needed_dirs, $required_space );

if ( null !== $pre ) {
return $pre;
}
unset( $needed_dirs );

// Extract the files from the zip.
foreach ( $archive_files as $file ) {
Expand All @@ -1955,12 +1909,7 @@ function _unzip_file_pclzip( $file, $to, $needed_dirs = array() ) {
}
}

/** This action is documented in src/wp-admin/includes/file.php */
$result = apply_filters( 'unzip_file', true, $file, $to, $needed_dirs, $required_space );

unset( $needed_dirs );

return $result;
return true;
}

/**
Expand Down
76 changes: 0 additions & 76 deletions tests/phpunit/tests/filesystem/_unzipFilePclzip.php

This file was deleted.

84 changes: 0 additions & 84 deletions tests/phpunit/tests/filesystem/_unzipFileZiparchive.php

This file was deleted.