Skip to content

Conversation

@phenaproxima
Copy link
Contributor

@phenaproxima phenaproxima commented Apr 8, 2021

This is spun off from discussion in #9740 and #9819.

Right now, it's not possible for plugins (in this case, specifically php-tuf/composer-integration) to react to Composer downloading package metadata. The methods which do that grunt work cannot be overridden because they're private, and no event is dispatched after the metadata is downloaded. @Seldaek suggested modifying ComposerRepository to fire the POST_FILE_DOWNLOAD plugin event after metadata is downloaded, but before it is cached. This PR implements that.

This requires changes to the PostFileDownloadEvent class. Namely, it has be able to accept a type (package or metadata, similar to what PreFileDownloadEvent already does) and additional context beyond just an instance of PackageInterface.

@Seldaek Seldaek added this to the 2.1 milestone Apr 9, 2021
@Seldaek Seldaek added the Feature label Apr 9, 2021
@Seldaek
Copy link
Member

Seldaek commented Apr 9, 2021

Please check out my changes, see if that works for you? I figured passing the repository to metadata and having an array to allow for future additions in a BC way there if needed would be good to have.

@phenaproxima
Copy link
Contributor Author

I think those changes look great, and will serve our purposes beautifully. I considered adding the repository as context, but for TUF's purposes, the response was more valuable. But I agree that passing both in an array is more flexible and future-proof. Thanks!

@Seldaek
Copy link
Member

Seldaek commented Apr 9, 2021

Alright then let's merge this for now, not sure what the timeline is on 2.1 tho but at least you can keep moving forwards based on snapshot builds.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants