cedaro / satispress

Expose installed WordPress plugins and themes as Composer packages.
500 stars 48 forks source link

A way to handle plugins with incorrect zip format #127

Closed Xilonz closed 3 years ago

Xilonz commented 4 years ago

We have plugins from a vendor that packages the archives into plugin.zip/plugin/plugin.php (same as #104 ) Currently SatisPress makes these archives available, but they're invalid for use with composer.

I'd love to see a way to ignore those plugin updates and only archive them from source, just like it is done when initially adding the plugin to SatisPress.

Or ideally, the updates get unpacked an repacked in the correct format, but I imagine that's -currently- not this plugins job. Although that would allow for some sort of validation step to prevent issues like #96

https://github.com/cedaro/satispress/blob/86f09ca848c7c05a83b7a1801958bedb83a63c84/src/ReleaseManager.php#L90-L93

E.g.:

        if ( ! empty( $source_url ) && apply_filter('satispress_install_release_from_source', true, $release) ) {
bradyvercher commented 3 years ago

@Xilonz I added a validator in the latest release (v0.7.0) that should make this work. If a downloaded artifact is invalid, it won't be cached. When the plugin is upgraded in WordPress it'll be cached from the installed source. There are only a couple of validators at the moment, so more may need to be introduced if they don't cover this scenario.