The following method is a replacement for Joomla's unzip method to overcome a server's ulimit setting that prevents large packages from unzipping.
The original method can be found in following path. You can open the file and replace the extractNative
function with the one below.
libraries/vendor/joomla/archive/src/Zip.php
The new function overcomes the server restrictions on the number of simultaneous open files because it doesn't try to extract based on the number of files in the zip archive that could cause issues with ulimit; instead, it extracts everything to a temporary folder using the extractTo
method, which reduces the number of simultaneous open files.
Once extraction is completed, it loops over each file in the zip archive and moves files one by one from the temporary directory to the final destination. This approach has good performance because it solves the issue by reducing the maximum number of open files simultaneously, irrespective of the number of files in the zip archive.