Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update detected but former version installed #752

Closed
FORTE-WP opened this issue Dec 25, 2018 · 20 comments
Closed

Update detected but former version installed #752

FORTE-WP opened this issue Dec 25, 2018 · 20 comments

Comments

@FORTE-WP
Copy link

FORTE-WP commented Dec 25, 2018

Hi Andy,

Still loving your plugin, but having some problems. The latest version detects the new update in bitbucket ( 0.7.7) but it installs a previous version (0.6.3). Any idea what the problem might be? Btw: a new install from bitbucket will install the correct version.

Thanks, Frank

@afragen
Copy link
Owner

afragen commented Dec 25, 2018

Frank, this usually happens if the tag isn’t up to date with the version.

@idpaterson
Copy link

I am seeing the same issue with Bitbucket for both plugins and themes. While the update page shows that 1.4.1 is installed and 1.5.0 is available it repeatedly downloads and installs the prior version:

Downloading update from https://bitbucket.org/x/y/get/1.4.1.zip…
Unpacking the update…
Installing the latest version…
Removing the old version of the theme…
Theme updated successfully.

I am using ghu 8.6.0 with wp 5.0.3 and have tried clearing the updater cache. Tags and versions are pushed to master in both repositories and we have used ghu for years so I don't think there were any recent changes on our end. I tried purging our cache just in case something was stuck in memcached but no luck.

I will likely have a few more patch releases coming over the next few days if anything else needs to be tested but for now reinstalled both fresh.

@afragen
Copy link
Owner

afragen commented Jan 10, 2019

Can you give user afragen read access to the repo in question. It makes it easier to check.

@idpaterson
Copy link

I put in a request for the owner to grant read access. While Bitbucket shows 1.5.0 as the latest tag the raw repo metadata in the options table confirms that the tags array contains only up to 1.4.1 while the plugin file defines the version as 1.5.0.

@afragen
Copy link
Owner

afragen commented Jan 10, 2019

What’s the most recent tag?

@idpaterson
Copy link

1.5.0 is the latest tag on bitbucket for this particular private repo, the cached data has everything except the latest:

    [tags] => Array
        (
            [0] => 1.2.6
            [1] => 1.2.7
            [2] => 1.2.8
            [3] => 1.3.0
            [4] => 1.3.1
            [5] => 1.3.2
            [6] => 1.3.3
            [7] => 1.3.4
            [8] => 1.4.0
            [9] => 1.4.1
        )

1.4.1 is the prior version that is currently installed (haven't actually force-updated it yet since you were so quick to respond). 1.5.0 was published about 40 minutes ago as of this comment.

@afragen
Copy link
Owner

afragen commented Jan 10, 2019

If you refresh the cache is the newest tag showing up?

@afragen
Copy link
Owner

afragen commented Jan 10, 2019

Is the 1.5.0 tag named 1.5.0 or something different?

@idpaterson
Copy link

Each time I clear the updater cache it eventually prompts to update the theme again with the same data; 1.5.0 declared in the theme file but 1.4.1 as the latest tag.

It's exactly 1.5.0:
screen shot 2019-01-10 at 4 12 48 pm

@idpaterson
Copy link

I'm not sure how they managed to break the API but there's certainly nothing strange happening in ghu... the BitBucket API is just not returning that latest tag. Confirmed with curl, you have read access now to take a look.

At this point I suppose I will try bumping one of the repos again and see if BitBucket updates to the correct tag or continues to lag behind by one.

@idpaterson
Copy link

Ah, the API is paged and returned in an order where page 1 provides no guarantee to contain the latest release. In my particular case, updating a plugin to 2.2.2 leaves 2.2.0 as the latest known tag. Requesting the next page shows the latest tag (oddly, following the latest tag is the 0.x series). Possibly returned in decreasing order in the past or I was just unlucky and both plugin and theme happened to cross that paging threshold?

It looks like handling the paging would be a viable solution if there is no way to get those sorted more reasonably to start with.

@afragen
Copy link
Owner

afragen commented Jan 10, 2019

I’m on mobile right and can confirm what you’re seeing. I’ll take a closer look later.

@idpaterson
Copy link

Thanks for following up so quickly on mobile! It looks like the easiest fix is to change the API request to .../refs/tags?sort=-name which should sort correctly:

The name field is handled specially for tags in that, if specified as the sort field, it uses a natural sort order instead of the default lexicographical sort order. For example, it will return ['1.1', '1.2', '1.10'] instead of ['1.1', '1.10', '1.2'].

@afragen
Copy link
Owner

afragen commented Jan 10, 2019

I was thinking I could set the page_length=100 on the query. Or something like that.

@FORTE-WP
Copy link
Author

FORTE-WP commented Jan 10, 2019 via email

@afragen
Copy link
Owner

afragen commented Jan 11, 2019

I believe this should now be fixed. In addition to sorting the API response I'm also getting 100 items per page. This is the maximum allowed.

Please confirm the fix and I'll push a release.

@idpaterson
Copy link

Excellent! I will try the latest from develop on staging.

@idpaterson
Copy link

Everything worked normally and my repo metadata is now in descending order including all tags

    [tags] => Array
        (
            [0] => 1.5.3
            [1] => 1.5.2
            [2] => 1.5.1
            [3] => 1.5.0
            [4] => 1.4.1
            [5] => 1.4.0
            [6] => 1.3.4
            [7] => 1.3.3
            [8] => 1.3.2
            [9] => 1.3.1
            [10] => 1.3.0
            [11] => 1.2.8
            [12] => 1.2.7
            [13] => 1.2.6
            [14] => 1.2.5
            [15] => 1.2.4
            [16] => 1.2.3
            [17] => 1.2.2
            [18] => 1.2.1
            [19] => 1.2.0
            [20] => 1.1.1
            [21] => 1.1.0
            [22] => 1.0.3
            [23] => 1.0.2
            [24] => 1.0.1
            [25] => 1.0.0
            [26] => 0.6.0-beta
            [27] => 0.5.0
            [28] => 0.4.1
            [29] => 0.4.0
            [30] => 0.3.0
            [31] => 0.2.0
            [32] => 0.1.1
            [33] => 0.1.0
        )

@Gaffen
Copy link

Gaffen commented Mar 4, 2020

I seem to be encountering this issue at the moment. Are there any sanity checks I can perform to establish where the issue is?

@afragen
Copy link
Owner

afragen commented Mar 5, 2020

@Gaffen this is a closed issue. It's better to open a new one.

Please try to explain in detail what you expect to happen or see and what actually happens. It's also helpful if you can link to your repo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants