Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alternative: Filesystem API: Introduce pre_unzip_file and unzip_file filter hooks. #4220

Conversation

costdev
Copy link
Contributor

@costdev costdev commented Mar 11, 2023

This introduces two new filters: pre_unzip_file and unzip_file.

  • pre_unzip_file allows overriding the unzipping logic with a custom implementation.
  • unzip_file allows filtering the result of unzipping. This can be used to perform malware scans, for example.

Both filters pass the following:

  • string $file - Full path and filename of ZIP archive.
  • string $to - Full path on the filesystem to extract archive to.
  • string[] $needed_dirs - A full list of required folders needed to be created.
  • float|false $required_space - The space required to unzip the file and copy its contents, with a 10% buffer. False if disk_free_space() returned false.

Trac ticket: https://core.trac.wordpress.org/ticket/37719

@costdev costdev marked this pull request as ready for review March 11, 2023 01:24
@costdev costdev force-pushed the simplified_introduce_pre_unzip_file_and_post_unzip_file branch from 6c259cf to 2879828 Compare August 20, 2023 17:46
@costdev costdev changed the title Alternative: Filesystem API: Introduce pre_unzip_file and post_unzip_file hooks. Alternative: Filesystem API: Introduce before_unzip_file and after_unzip_file hooks. Aug 20, 2023
@costdev costdev force-pushed the simplified_introduce_pre_unzip_file_and_post_unzip_file branch from 2879828 to a8e650b Compare August 20, 2023 18:04
@costdev costdev force-pushed the simplified_introduce_pre_unzip_file_and_post_unzip_file branch from a8e650b to f79c5ee Compare September 9, 2023 09:34
@costdev costdev force-pushed the simplified_introduce_pre_unzip_file_and_post_unzip_file branch from f79c5ee to 3468d35 Compare September 23, 2023 16:34
@costdev costdev changed the title Alternative: Filesystem API: Introduce before_unzip_file and after_unzip_file hooks. Alternative: Filesystem API: Introduce pre_unzip_file and unzip_file filter hooks. Sep 23, 2023
@costdev costdev force-pushed the simplified_introduce_pre_unzip_file_and_post_unzip_file branch from b20c999 to 649b4a3 Compare September 25, 2023 21:56
@costdev
Copy link
Contributor Author

costdev commented Sep 25, 2023

Committed in r56689.

@costdev costdev closed this Sep 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants