No Code Attached Yet
avatar ufuk-avcu
ufuk-avcu
27 Nov 2020

Steps to reproduce the issue

Use the newest Joomla 3.9.23
Install for example Yootheme Pro Package. (important: This package includes more Zips within the zip File and this seems to be the problem. If the zip doesn't contains other zips, the installation times are as usual.)

Expected result

Installation complete after several seconds.
Tested with Joomla 3.9.22 -> 15 seconds for installation.

Actual result

Installation takes minutes or fail:
Maximum execution time of 60 seconds exceeded in /libraries/vendor/joomla/archive/src/Zip.php on line 301
With higher exexcution Time settings the installation takes 2:05 minutes.

System information (as much as possible)

Joomla 3.9.23
Tested it with Yootheme Pro 2.3.19 (7,3 MB) -> takes long. Zip in zips.
Tested with oder extensions without zips in zip ist fast and as excepted.

Conlusion

Joomla 3.9.23 -> 2:05 Minutes
Joomla 3.9.22 -> 0:15 Minutes
-> for the same extension.

Votes

# of Users Experiencing Issue
3/3
Average Importance Score
3.67

avatar ufuk-avcu ufuk-avcu - open - 27 Nov 2020
avatar joomla-cms-bot joomla-cms-bot - labeled - 27 Nov 2020
avatar nibra
nibra - comment - 27 Nov 2020

The joomla-framework/archive package has been updated to use the PHP ZipArchive, because the zip functions we used before are deprecated in favor of the Object API.

This is an issue that we inherited from PHP, so we can't do much about it. Nevertheless we'll investigate the possibility of a workaround. Can't promise anything, though.

avatar ufuk-avcu
ufuk-avcu - comment - 27 Nov 2020

Tested it also with Akeeba Backup Core. The main zip contains, 6 other zips. But there are no problems here. The installation speed is more or less the same.

avatar steffans
steffans - comment - 27 Nov 2020

This resolves the issue for me, use directly ZipArchive::getFromIndex instead of first getting and reading the file with ZipArchive::getStream. This should happen with all larger zip files because the read operation takes longer.

	/**
	 * Extract a ZIP compressed file to a given path using native php api calls for speed
	 *
	 * @param   string  $archive      Path to ZIP archive to extract
	 * @param   string  $destination  Path to extract archive into
	 *
	 * @return  boolean  True on success
	 *
	 * @since   1.0
	 * @throws  \RuntimeException
	 */
	protected function extractNative($archive, $destination)
	{
		$zip = new \ZipArchive;

		if ($zip->open($archive) !== true)
		{
			throw new \RuntimeException('Unable to open archive');
		}

		// Make sure the destination folder exists
		if (!Folder::create($destination))
		{
			throw new \RuntimeException('Unable to create destination folder ' . \dirname($path));
		}

		// Read files in the archive
		for ($index = 0; $index < $zip->numFiles; $index++)
		{
			$file = $zip->getNameIndex($index);

			if (substr($file, -1) === '/')
			{
				continue;
			}

			$buffer = $zip->getFromIndex($index);

			if ($buffer === false)
			{
				throw new \RuntimeException('Unable to read ZIP entry');
			}

			if (File::write($destination . '/' . $file, $buffer) === false)
			{
				throw new \RuntimeException('Unable to write ZIP entry to file ' . $destination . '/' . $file);
			}
		}

		$zip->close();

		return true;
	}
avatar ufuk-avcu
ufuk-avcu - comment - 27 Nov 2020

@steffans Tested your code with 3.9.23 and now it takes also 15 seconds.

avatar HLeithner
HLeithner - comment - 27 Nov 2020
avatar HLeithner
HLeithner - comment - 27 Nov 2020

or @nibra will you create the PR?

avatar nibra
nibra - comment - 27 Nov 2020
avatar richard67
richard67 - comment - 27 Nov 2020

@HLeithner We leave this issue open until the framework PR has been merged and we will have a PR for updating the framework package in staging, right?

avatar HLeithner
HLeithner - comment - 27 Nov 2020

yes please

avatar vingle
vingle - comment - 2 Dec 2020

I have the same issue - also emerged on an attempted YTPro upgrade.

Tested the same upgrade on a 3.9.22 (fine) and 3.9.23 (timed out with a 500 second limit). Zoolanders Essentials timesout too - but other extensions have loaded ok. The issue is the same whether using the update script, installing from a directory, or uploading the package file.

I tried applying the patch from the PR to libraries/joomla/archive/zip.php - but unless I need to delete a cache or something, it didn't make any difference.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/31506.
avatar ufuk-avcu
ufuk-avcu - comment - 2 Dec 2020

@vingle This is the correct directory: joomla_root/libraries/vendor/joomla/archive/src/Zip.php


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/31506.

avatar vingle
vingle - comment - 2 Dec 2020

Ah - thanks for the correction – yes that works for me now :)

avatar paoprod
paoprod - comment - 7 Dec 2020

Just to confirm...

  • I installed a Joomla 3.9.22 on a test website on MAMP 6.2 / PHP 7.4.12
  • I installed Yootheme J3_2.3.19 -> OK
  • I updated Joomla to 3.9.23
  • I updated Yootheme to J3_2.3.21 -> FAILED
  • I updated Joomla to 3.9.24-dev
  • I pudated Yootheme to J3_2.3.21 -> OK
    This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/31506.
avatar HLeithner
HLeithner - comment - 7 Dec 2020

thx I keep this issue open until 3.9.24 is released

avatar Stevec4
Stevec4 - comment - 9 Dec 2020

I applied the patch to the zip.php, and tried updating from yootheme j3_2.3.21 to yootheme j3_2.3.23 and 24 both fail with an unable to find manifest file. I re-uploaded the unchanged zip.php file and the update for yootheme pro installed fine.

Joomla 3.9.23
PHP 7.4.11


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/31506.

avatar HLeithner
HLeithner - comment - 9 Dec 2020

@Stevec4 did you tested #31514 ?

avatar Stevec4
Stevec4 - comment - 9 Dec 2020

Sorry I wasn't clear Harald, the patch I applied was from the #31514 PR.

Steve

avatar HLeithner HLeithner - change - 16 Dec 2020
Status New Closed
Closed_Date 0000-00-00 00:00:00 2020-12-16 23:51:39
Closed_By HLeithner
avatar HLeithner
HLeithner - comment - 16 Dec 2020

@Stevec4 please test https://github.com/joomla/joomla-cms/releases/tag/3.9.24-rc I'm closing this because this should be solved

avatar HLeithner HLeithner - close - 16 Dec 2020
avatar Stevec4
Stevec4 - comment - 17 Dec 2020
Message
Installation of the package was successful.

With the RC installed it worked perfectly Harald

avatar HLeithner
HLeithner - comment - 17 Dec 2020

Thanks for the feedback

avatar PhilETaylor
PhilETaylor - comment - 18 Dec 2020

Tested 3.9.24RC will all the largest packages like com_easyblog 5.4.6 which is 13.5Mb... and com_jomsocial 4.7.7 which is 12.9Mb packages and its all ok for me.

avatar HLeithner
HLeithner - comment - 18 Dec 2020

thanks for the report @PhilETaylor

Add a Comment

Login with GitHub to post a comment