[wp-trac] [WordPress Trac] #37719: Pre/Post Unzip Hooks

WordPress Trac noreply at wordpress.org
Sat Mar 11 01:30:25 UTC 2023


#37719: Pre/Post Unzip Hooks
-----------------------------------+---------------------
 Reporter:  dfavor                 |       Owner:  (none)
     Type:  feature request        |      Status:  new
 Priority:  normal                 |   Milestone:  6.3
Component:  Filesystem API         |     Version:  3.0
 Severity:  normal                 |  Resolution:
 Keywords:  2nd-opinion has-patch  |     Focuses:
-----------------------------------+---------------------
Changes (by costdev):

 * version:   => 3.0
 * milestone:  Awaiting Review => 6.3


Comment:

 PRs [https://github.com/WordPress/wordpress-develop/pull/4219 4219] and
 [https://github.com/WordPress/wordpress-develop/pull/4220 4220] implement
 the `pre_unzip_file` and `post_unzip_file` actions.

 - [https://github.com/WordPress/wordpress-develop/pull/4219 4219] combines
 `_unzip_file_ziparchive()` and `_unzip_file_pclzip()` into a new function,
 `_unzip_file()`, makes both functions wrappers for `_unzip_file()`, and
 implements this in `unzip_file()` to avoid unnecessarily calling the
 wrapper functions.
 - [https://github.com/WordPress/wordpress-develop/pull/4220 4220] is an
 alternative option that makes minimal changes by simply introducing the
 actions directly into `_unzip_file_ziparchive()` and
 `_unzip_file_pclzip()`.

 It should be noted that passing `$needed_dirs` in the actions means
 removing `unset( $needed_dirs )`. Unzipping archives is memory intensive,
 so we should decide whether this additional memory by retaining
 `$needed_dirs`, and by doing any hooked callbacks, is worth the benefits.

 -----

 - Keeping `2nd-opinion` to gather thoughts on the above and on both PRs
 - Milestoning for 6.3 to raise awareness of this ticket.
 - Both `_unzip_file_ziparchive()` and `_unzip_file_pclzip()` were
 introduced in 3.0. Updating the `Version` property to reflect this.

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


More information about the wp-trac mailing list