plugin-update-checker icon indicating copy to clipboard operation
plugin-update-checker copied to clipboard

Disable update from tag

Open Spidlace opened this issue 6 years ago • 3 comments

Hello @YahnisElsts !

I would like to disable (only in one case) the update from tag but like u say in readme.md :

PUC doesn't require strict adherence to SemVer. These are all valid tag names: v1.2.3, v1.2-foo, 1.2.3_rc1-ABC, 1.2.3.4.5. However, be warned that it's not smart enough to filter out alpha/beta/RC versions. If that's a problem, you might want to use GitLab branches instead.

I make an option in my WordPress to choose one branch from Gitlab API, but tag release is priority as "version in plugin/theme"... It's possible to add option after creating the update checker instance, to disable the priority (tag release).

Example :

I have one plugin "plugin-example" :

$option_branch_fixiso = get_option('branch_fixiso');
require(get_template_directory() . '/plugin-update-checker/plugin-update-checker.php');
$myUpdateChecker = new Puc_v4p4_Vcs_PluginUpdateChecker(
   new Puc_v4p4_Vcs_GitLabApi('http://gitlab_url.com/'),
        __FILE__,
    'plugin-example-slug'
);
if (empty($option_branch_fixiso['plugins']['plugin-example-slug'])) {
    $myUpdateChecker->setBranch('master');
} else {
    $myUpdateChecker->setBranch("test");
}

Branch Master version = 1.0.1 Branch Test version = 1.0.2

When i switch to branch test, no problem, updates are detected and my wordpress download new version from Test branch. (no tags are created, just version change from file) But when i update master, i need to create new tag (example : 1.0.3) When I create new tag (from master branch), new update are available in my WordPress (1.0.3)... But I don't want the new version when I am on branch test...

It's possible to add method like (setBranch) to disable update by tag ? Like :

$myUpdateChecker->disableUpdateByTags();

Spidlace avatar Jun 26 '19 12:06 Spidlace

The update checker isn't supposed to search for tags when using a custom branch. It sounds like there might be either a bug or a caching issue.

Could you please double-check that it's using tags when branch is set to test? To do that, set the branch first and then click the "Check for updates" link under the plugin description on the "Plugins" page.

YahnisElsts avatar Jun 26 '19 19:06 YahnisElsts

I've the same error: i set : $myUpdateChecker->setBranch('master');

but in my query log i can see 2 call One by tag and another by branch name

Djomobil avatar May 14 '20 13:05 Djomobil

@Djomobil That's a slightly different issue. Internally, the update checker uses the master name as a default settings that indicates that the developer hasn't specified a branch. As a result, it's currently not possible to tell it to use the master branch only and ignore tags, etc.

YahnisElsts avatar May 14 '20 13:05 YahnisElsts