Skip to content

What if get_option( 'NF_Videomail_Version' ) is undefined? #42

@binarykitchen

Description

@binarykitchen

@kjohnson I'm afraid your PR didn't resolve the problem. My customer re-enabled the LiteSpeed plugin and the error is still happening:

Uncaught ReferenceError: VideomailClient is not defined
Image

The VideomailClient doesn't exist in the global scope. But it's being loaded, I can see in the network tab. Wondering if LiteSpeed plugin is messing with the global scope?

Furthermore, I've double-checked your code:

  public function plugin_update_check() {
      // Check if current version is newer.
      if(version_compare( self::VERSION, get_option( 'NF_Videomail_Version' ), '>' )) {
          // Purge LiteSpeed cache.
          !class_exists('\LiteSpeed\Purge') || \LiteSpeed\Purge::purge_all();

          // Finally, update the stored version for future checks.
          update_option('NF_Videomail_Version', self::VERSION);
      }
  }

I think we forgot something: when the user updates the plugin for the first time, then get_option( 'NF_Videomail_Version' ) is actually undefined and thus, version comparison is impossible. We need to add an extra check to purge cache when this option does not exist yet.

Thoughts?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions