This PR displays an appropriate error message when a process that creates a zip file requires the ZipArchive class and the class does not exist.
Suggestions for displayed text are also welcome!
Testing Instructions
To test this PR, you need to disable the zip extension locally. For wp-env, please follow the steps below.
Run wp-env: npm run wp-env start
Check the container name: docker ps
Go inside the container: docker exec -it {YOUR-CONTAINER-NAME}-wordpress-1 bash
Remove zip extension: rm /usr/local/etc/php/conf.d/docker-php-ext-zip.ini
Restart Apache: /etc/init.d/apache2 reload
Exit the container: exit
Check the Site Health page to make sure the zip extension is disabled:
After that, confirm that an error message is displayed when you perform the following operations:
Site Editor
Create Block Theme Option > Export Zip
Appearance > Create Block Theme
Export {themeName}
Create sibling of {themeName}
Create child of {themeName}
Clone {themeName}
P.S. Restart wp-env and the zip extension will be automatically enabled again.
Supplement
In addition to the REST API endpoint that this PR changes, the ZipArchive class is also used in the callback functions of the following two endpoints. However, these two endpoints currently don't seem to be called from anywhere.
Fixes #492
This PR displays an appropriate error message when a process that creates a zip file requires the ZipArchive class and the class does not exist.
Suggestions for displayed text are also welcome!
Testing Instructions
To test this PR, you need to disable the zip extension locally. For wp-env, please follow the steps below.
npm run wp-env start
docker ps
docker exec -it {YOUR-CONTAINER-NAME}-wordpress-1 bash
rm /usr/local/etc/php/conf.d/docker-php-ext-zip.ini
/etc/init.d/apache2 reload
exit
After that, confirm that an error message is displayed when you perform the following operations:
P.S. Restart wp-env and the zip extension will be automatically enabled again.
Supplement
In addition to the REST API endpoint that this PR changes, the ZipArchive class is also used in the callback functions of the following two endpoints. However, these two endpoints currently don't seem to be called from anywhere.