composer / mirror

Mirroring script for packagist.org and composer repositories metadata in general
MIT License
31 stars 9 forks source link

The problem of php mirror.php --gc command #7

Closed peter279k closed 4 years ago

peter279k commented 4 years ago

After looking at this code snippet, it seems that this will remove the files are on p folder.

That is, it will clean the outdated Composer V1 mirror files.

What about the outdated Composer v2 mirror files? (These files will be on p2 folder) Are they need to be removed?

peter279k commented 4 years ago

It seems that the outdated files about V2 will be removed during v2 mirror syncing.

If I don't run php mirror.php --v1 command to build the Composer V1 mirrors, I don't need to run php mirror.php --gc every hour?

peter279k commented 4 years ago

I notice that following message snippets when the it doesn't have Composer v1 mirror:

Mirror  job failed at 2020-11-10 16:09:55
[ErrorException] file_get_contents(/var/www/html/public/p/provider-2013$c6f19599d6682dbdbd2c6b93faa2f2f53b8f1f64717ec199d944794833be9bdd.json.gz): failed to open stream: No such file or directory
PHP Fatal error:  Uncaught ErrorException: file_get_contents(/var/www/html/public/p/provider-2013$c6f19599d6682dbdbd2c6b93faa2f2f53b8f1f64717ec199d944794833be9bdd.json.gz): failed to open stream: No such file or directory in /var/www/html/mirror.php:498

It seems that the php mirror.php --gc command doesn't necessary to run if the Composer v1 mirrors are not on server.

Seldaek commented 4 years ago

Right, running the gc command is not needed if you only run --v2. I added this in the README now, and I'll make sure the gc command exits early if configured to only have v2.

Seldaek commented 4 years ago

And yes you are right, the v2 files get deleted/cleaned up as part of the regular v2 updates, v1 did not have an update feed so we could not clean up deleted files there.