Viewing 7 replies - 1 through 7 (of 7 total)
  • Barry

    (@barryhughes-1)

    That’s really strange and, so far, I can’t find a way to replicate the issue locally.

    Are you able to look at the actual wp-content/plugins directory—is there a duplicate plugin in there, or is this truly a phantom that only exists in the admin environment?

    Could something else be causing this, another plugin or customization? If you were to create a temporary/sandbox WP site, and only install WooCommerce and the legacy plugin, can you replicate the same problem there?

    Barry

    (@barryhughes-1)

    …Or, again thinking of tests you could run in a temporary testing site, you could perhaps incrementally add the same plugins and theme as in your production site, checking at each stage to see if one of them has introduced this issue.

    In parallel, we’ll have a further think on our end in case there is something we missed.

    Thread Starter Dustin L.

    (@bigbugsy)

    Thank you for getting back to me.

    The problem only exists on a local development version of our production site.

    I don’t know how to reproduce the problem.

    To troubleshoot, I created a copy of the site and changed the theme to Twenty Twenty-Four and deleted all plugins except WooCommerce & WooCommerce Legacy REST API. I also deleted all transients and deleted the uninstalled_plugins and active_plugins options.

    There is nothing else in my plugins folder:

    View post on imgur.com

    The phantom entry is still there:

    View post on imgur.com

    Any other ideas?

    Thread Starter Dustin L.

    (@bigbugsy)

    I found out how to reproduce it. The bug only seems to be present on my local development environment: Laragon.

    I installed a fresh copy of WordPress, WooCommerce, and WooCommerce Legacy REST API and the same issue occurred.

    I noticed the active plugin has the description: The legacy WooCommerce REST API, which used to be part of WooCommerce itself but is removed as of WooCommerce 9.0.

    …which is found in the typical plugin header of woocommerce-legacy-rest-api.php.

    The phantom plugin has a different description: The legacy WooCommerce REST API, which is now part of WooCommerce itself but will be removed in WooCommerce 9.0.

    …which is found in \includes\class-wc-legacy-rest-api-plugin.php

    /**
    * Handler for the all_plugins hook, used to change the description of the plugin if it's seen before June 2024.
    */
    public static function on_all_plugins( $all_plugins ) {
        $plugin_relative_path = str_replace( WP_PLUGIN_DIR . '/', '', self::$plugin_filename );
        $all_plugins[ $plugin_relative_path ][ 'Description' ] = 'The legacy WooCommerce REST API, which is now part of WooCommerce itself but will be removed in WooCommerce 9.0.';
        return $all_plugins;
    }

    …which is called by:

    // 1717192800 = June 1st, 2024
    if( time() < 1717192800 ) {
        add_action( 'all_plugins', self::class . '::on_all_plugins' );
    }

    For some reason, my installation is showing both descriptions.

    Thread Starter Dustin L.

    (@bigbugsy)

    Does on_all_plugins() really need all of the logic it has now? Since you already know the directory and filename for the plugin, can’t this be made much simpler?

    public static function on_all_plugins( $all_plugins ) {
        $all_plugins[ 'woocommerce-legacy-rest-api/woocommerce-legacy-rest-api.php' ][ 'Description' ] = 'The legacy WooCommerce REST API, which is now part of WooCommerce itself but will be removed in WooCommerce 9.0.';
        return $all_plugins;
    }

    …That seems to fix the issue on my system.

    I think the original code is causing problems when I am on a Windows server.

    Barry

    (@barryhughes-1)

    It probably could be much simpler, and I think you’ve pinned the problem pretty precisely. That said:

    // 1717192800 = June 1st, 2024
    if( time() < 1717192800 ) { /* ... */

    For all practical purposes, I think this will self-resolve imminently (ie, June 1st).

    Thread Starter Dustin L.

    (@bigbugsy)

    You are right. This is resolved now.

    Thanks

Viewing 7 replies - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.