rudrastyh / misha-update-checker

This simple plugin does nothing, only gets updates from a custom server
124 stars 44 forks source link

Incorrect return for `plugins_api` hook. #1

Closed ve3 closed 2 years ago

ve3 commented 2 years ago

Your plugins_api filter called to info() method.

The info() method that return false; after checked something is incorrect.

The return false; will be mess with another plugins information that is using the self hosted.

To be correct, it should return $res;.

Example:

        function info( $res, $action, $args ) {

            // print_r( $action );
            // print_r( $args );

            // do nothing if you're not getting plugin information right now
            if( 'plugin_information' !== $action ) {
                return $res;
            }

            // do nothing if it is not our plugin
            if( $this->plugin_slug !== $args->slug ) {
                return $res;
            }

            // get updates
            $remote = $this->request();

            if( ! $remote ) {
                return $res;
            }
            // your code
        }
rudrastyh commented 2 years ago

Thank you! It is fixed