Giter Site home page Giter Site logo

Comments (3)

seyfro avatar seyfro commented on May 22, 2024

I did some more tests and found that if I outcomment the "non-versioned variants of the update checker classes" at the end of the class, both plugins work fine:

/**
 * Create non-versioned variants of the update checker classes. This allows for backwards
 * compatibility with versions that did not use a factory, and it simplifies doc-comments.
 */
/*
if ( !class_exists('PluginUpdateChecker', false) ) {
    class PluginUpdateChecker extends PluginUpdateChecker_2_2 { }
}
if ( !class_exists('PluginUpdate', false) ) {
    class PluginUpdate extends PluginUpdate_2_2 {}
}
if ( !class_exists('PluginInfo', false) ) {
    class PluginInfo extends PluginInfo_2_2 {}
}
*/

As my plugin is named "Maps Marker Pro", my PUC class is first loaded I guess and so when PUC for "UpDraftPlus" is loaded afterwards, the code above has already loaded PUC2.2 which breaks the PUC for UpdraftPlus - at least this is what I think happens.

what would be your advice here, taking into account that multiple PUC instances with different versions might be active on a WordPress site?

from plugin-update-checker.

YahnisElsts avatar YahnisElsts commented on May 22, 2024

Are both plugins instantiating a specific version of PUC by using e.g. new PluginUpdateChecker_2_0(...), or are they using PucFactory::buildUpdateChecker which always gives you the newest loaded version? Or some combination of both?

If both plugins explicitly ask for a specific version, there shouldn't be any conflicts (and if there are, then that's a bug in PUC). On the other hand, if a plugin uses the "give me the newest version" approach, then it must be prepared to actually support the newest version of PUC, and things may break if it does not.

I did some more tests and found that if I outcomment the "non-versioned variants of the update checker classes" at the end of the class, both plugins work fine [...]

Ah, it sounds like UpDraftPlus is using the old way to instantiate the update checker that didn't really allow for running multiple different versions at the same time. I should probably deprecate or remove those classes.

In this case, removing that code from your copy of plugin-update-checker.php would probably be the easiest solution.

from plugin-update-checker.

seyfro avatar seyfro commented on May 22, 2024

Thanks for the prompt reply!

You seem to be right - UpDraftPlus is using the following code to load PUC:
$plug_updatechecker = new PluginUpdateChecker($this->url."/plugin-info/", WP_PLUGIN_DIR.'/'.$this->slug.'/'.$this->slug.'.php', $this->slug, 24);

while I am using

$run_PluginUpdateChecker = new PluginUpdateChecker_2_2( 
    $lmm_plugin_updater_url,
    plugin_dir_path( __FILE__ ) . 'leaflet-maps-marker.php',
    'leaflet-maps-marker-pro',
    '12',
    'leafletmapsmarkerpro_pluginupdatechecker'
);

I will remove the "non-versioned variants of the update checker classes" from my PUC class as I do not use them within my plugin and those might only conflict with other plugins.

from plugin-update-checker.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.