Skip to content

Update EPV and remove deprecated Chumper/Zipper package #395

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

Open
wants to merge 3 commits into
base: 3.3.x
Choose a base branch
from

Conversation

Skouat
Copy link
Contributor

@Skouat Skouat commented Oct 23, 2024

No description provided.

Copy link

private-packagist bot commented Oct 23, 2024

composer.lock

Package changes

Package Operation From To About
chumper/zipper remove v1.0.0 - -
doctrine/inflector remove 1.4.4 - -
illuminate/contracts remove v5.5.44 - -
illuminate/filesystem remove v5.5.44 - -
illuminate/support remove v5.5.44 - -
kylekatarnls/update-helper remove 1.2.1 - -
nesbot/carbon remove 1.39.1 ⚠️ - -
psr/container remove 1.1.2 - -
psr/simple-cache remove 1.0.1 - -
symfony/translation remove v4.4.47 - -
symfony/translation-contracts remove v2.5.4 - -

Settings · Docs · Powered by Private Packagist

Copy link

The composer.lock diff comment has been updated to reflect new changes in this PR.

1 similar comment
Copy link

The composer.lock diff comment has been updated to reflect new changes in this PR.

@Skouat Skouat changed the title Replace Chumper/Zipper Composer package and update PHP and Composer version Update EPV and remove deprecated Chumper/Zipper package Apr 26, 2025
Copy link

The composer.lock diff comment has been updated to reflect new changes in this PR.

for ($i = 0; $i < $source_zip->numFiles; $i++)
{
$stat = $source_zip->statIndex($i);
if (str_starts_with($stat['name'], $source_path))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

str_starts_with is PHP8, but our PHP level is 7.2. Also there's some repeated processing inside the loop that can be done pre loop. Consider and test out this alternative code:

private function add_to_zip(ZipArchive $source_zip, ZipArchive $dest_zip, $save_version, $source_path)
{
	$source_path = rtrim($source_path, '/') . '/';
	$prefix_length = strlen($source_path);

	for ($i = 0; $i < $source_zip->numFiles; $i++)
	{
		$stat = $source_zip->statIndex($i);
		$entry_name = $stat['name'];

		if (strpos($entry_name, $source_path) !== 0)
		{
			continue;
		}

		$relative_path = substr($entry_name, $prefix_length);
		$dest_path = $save_version . '/' . $relative_path;

		// Check if it's a directory (size is 0 and the name ends with '/')
		if ($stat['size'] === 0 && substr($entry_name, -1) === '/')
		{
			$dest_zip->addEmptyDir($dest_path);
			continue;
		}

		$file_contents = $source_zip->getFromName($entry_name);
		if ($file_contents !== false)
		{
			$dest_zip->addFromString($dest_path, $file_contents);
		}
	}
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

str_starts_with is PHP8, but our PHP level is 7.2.

That's correct. But there is no issue with using it because Titania uses symfony/polyfill-php80 which provides this function.

There is also the same issue with this array_key_first function, which is only available since PHP 7.3."

Consider and test out this alternative code:

Thanks for the code. There was an issue with it, but it's fixed.

Copy link

The composer.lock diff comment has been updated to reflect new changes in this PR.

@DavidIQ
Copy link
Member

DavidIQ commented May 29, 2025

You'll need to update again.

Copy link

The composer.lock diff comment has been updated to reflect new changes in this PR.

1 similar comment
Copy link

The composer.lock diff comment has been updated to reflect new changes in this PR.

@Skouat Skouat force-pushed the replace_chumper_zipper branch from d8c2ca4 to adf3052 Compare May 29, 2025 14:01
Copy link

The composer.lock diff comment has been updated to reflect new changes in this PR.

@Skouat
Copy link
Contributor Author

Skouat commented May 29, 2025

Done :)

@DavidIQ
Copy link
Member

DavidIQ commented Jun 5, 2025

Oops...I needed to merge this before #403. Sorry, you'll need to update again. 😬

@Skouat
Copy link
Contributor Author

Skouat commented Jun 5, 2025

😭

@Skouat Skouat force-pushed the replace_chumper_zipper branch from adf3052 to b3b8f8d Compare June 5, 2025 23:14
Copy link

The composer.lock diff comment has been updated to reflect new changes in this PR.

@Skouat
Copy link
Contributor Author

Skouat commented Jun 5, 2025

@DavidIQ update done. I hope this time it's okay for the merger🤞

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants