Comments (36)
There are no such plans at the moment. Not that there's anything wrong with the idea; I just don't have the time.
from plugin-update-checker.
thanks for the reply anyway!
from plugin-update-checker.
+1
from plugin-update-checker.
+1
from plugin-update-checker.
I might have a chance to add this sometime soon, so I'm looking for input. What's your typical workflow for releasing new plugin/theme versions on BitBucket? How would one go about finding the latest stable version? (Is it a branch, tag, or does BitBucket have something like GitHub's "releases"?)
from plugin-update-checker.
Great, many thanks in advance! Tags are used for that on Bitbucket.
from plugin-update-checker.
Usually i am adding new tag, like v2.1
, and merging feature branch in the master branch.
from plugin-update-checker.
But you don't have to deal with tags. You just get "readme.txt" from master and parse it.
That's it.
from plugin-update-checker.
Thanks for the feedback. However, wouldn't you still have to deal with tags to generate download URLs and get the last update timestamp? Also, I suspect that some developers might leave out the "Stable tag" header from their readme.txt.
On an unrelated note, how about authentication? Do you use public repositories (so no auth necessary), or private repositories with username/password, app passwords, or something else?
from plugin-update-checker.
I use private repos
from plugin-update-checker.
No, you don't have to. The download url is always same as https://bitbucket.org/{your-user-name}/repo/get/master.zip. To get the last update timestamp, you use the last commit created time.
I'm using free private repositories on Bitbucket. (Most of the people uses it because of that.) So, you need to access BitBucket API with a key and secret which is generated on this link: https://bitbucket.org/account/user/{your-user-name}/api
But, I'm not sure how to get downloadable zip url with that key and secret for Wordpress.
These may help you:
https://confluence.atlassian.com/bitbucket/oauth-on-bitbucket-cloud-238027431.html
https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Busername%7D/%7Brepo_slug%7D/downloads#downloadsResource-GETaspecificfile
from plugin-update-checker.
@bilaltas Wait, so are you using tags or not? That download URL would point to the master branch, not a tag. Or are you implying that in your case master is always stable and identical to the latest tag?
from plugin-update-checker.
@YahnisElsts I'm using Bitbucket Tags but I don't have to. For me, it's just to show which commit is belong to which version of the plugin. Not everyone fills it, most of them do. Yes, in my case, master is always stable and identical to the latest tag. If I work on a beta version, I would create another branch.
https://bitbucket.org/{your-username}/{your-repo}/get/{your-latest-tag}.zip (Tags might be text or number or both)
and
https://bitbucket.org/{your-username}/{your-repo}/get/master.zip downloads the same.
from plugin-update-checker.
We're using Bitbucket and don't use tags much right now and all our repos are private. The master branch is always production ready. That said, I like to sometimes use a "beta" branch for beta releases on plugins for those that want bleeding edge. If you went the direction of tags though, it'd be more than welcomed in order to integrated with Bitbucket repos.
from plugin-update-checker.
I think the update checker could support a couple of different approaches like it already does for plugins hosted on GitHub. For example, it could do this (in priority order):
- Look at
readme.txt
in a specific branch. If it has aStable tag
header that points to a valid tag, use that tag. - Look at the most recent tags, sort the ones that look like version numbers in descending order, and use the first tag.
- Just use the specified branch. The branch is configurable and defaults to
master
.
from plugin-update-checker.
Sounds like a plan :)
from plugin-update-checker.
About one year ago, I tried integrating Bitbucket api for your script but I haven't had time to complete. Last status of it has ability to check and detect the new version, but it cannot download and install it yet. I used Gentlero's Bitbucket PHP API Wrapper. I hope this files help you to complete it: (I'm not sure it still works, but it gives an idea.)
- bitbucket-checker.php
- plugin-update-checker.php
plugin-update-checker-with-bitbucket.zip
from plugin-update-checker.
I actually just got my own implementation to a sort-of-usable state. Anyone interested in testing BitBucket integration can find it in this branch:
https://github.com/YahnisElsts/plugin-update-checker/tree/theme-support
Usage:
$bitbucketPluginChecker = Puc_v4_Factory::buildUpdateChecker(
'https://bitbucket.org/username/repository-name',
__FILE__, //Full path to the main plugin file.
'unique-plugin-slug' //Usually the same as your plugin directory name.
);
//If your repository is private, create an OAuth consumer that has read access
//to the repository and and set the credentials like this:
$bitbucketPluginChecker->setAuthentication(array(
'consumer_key' => 'abc',
'consumer_secret' => 'def',
));
Fair warning: This stuff is mostly untested and definitely not production-ready. It might just crash right away.
from plugin-update-checker.
Oh good! I didn't know you already started it. :)
from plugin-update-checker.
Update: Now BitBucket support should also work with themes. The setup is almost identical to plugins:
$bitbucketThemeChecker = Puc_v4_Factory::buildUpdateChecker(
'https://bitbucket.org/username/repository-name',
__FILE__, //Full path to your functions.php file.
'unique-theme-slug' //Optional. Usually the same as your theme directory name.
);
The only significant difference is that the second parameter must be an absolute path to any file inside your theme's directory. If your update-related code is inside functions.php, the __FILE__
constant would be a good choice. The update checker uses this path to distinguish between plugins and themes and to get the theme slug.
from plugin-update-checker.
Update: Version 4.0 has been released and it includes BitBucket support.
from plugin-update-checker.
Thank you Yahnis. But I couldn't get it worked yet. Two problems I saw:
- Doesn't work with 3 digits version numbers
- If I change the installed plugin's version to 0.0, it shows an update. Once I start the update, it gives this error message:
from plugin-update-checker.
Thank you for the report. I could swear I tested the installation process multiple times...
Anyway, both of those issues should be fixed now.
from plugin-update-checker.
Hello Yahnis! Is there any update on these issues?
from plugin-update-checker.
As I said, those issues should be fixed now.
Edit: In case that phrasing was ambiguous (English isn't my first language), here's a clarification: I believe both of those problems are fixed in the master branch. I tested it and everything worked correctly. However, just because something works for me doesn't mean it will work for everyone, which is why I said "should be" instead of "are".
from plugin-update-checker.
Sorry, I misunderstood you. I think because it was so fast. :)
I tried once you replied, both wasn't working. Now, issue #1 is still exist. It still shows the v0.1 as the latest. And, when I update it, it updates to the v0.1 perfectly. So, issue #2 is fixed.
from plugin-update-checker.
Well, I can't reproduce the problem with version numbers. In my own tests, the update checker picks the correct version.
Are you sure that:
- You've got the latest changes from the master branch?
- The style.css in the v0.1.6 tag has the correct header, i.e.
Version: 0.1.6
?
from plugin-update-checker.
- Yes, I have only branch which is master one.
- Yes, it has correct version header: Version: 0.1.6 (without "v" letter)
Could it be about the "v0.1" version is two-digit or something like that? Did you have a chance to test it that way?
from plugin-update-checker.
That shouldn't matter. I've tested it with both two-digit and three-digit version numbers, with and without the v
prefix.
Unfortunately, there's not much else I can do without seeing what exactly is going on in your setup. What I would suggest is this: take a look at the getLatestTag
method in Puc/v4/Vcs/BitBucketApi.php
. Try tracing it with a debugger or add some var_dump()
's statements to see what it's doing. Confirm that:
$tags->values
includes thev0.1.6
tag- This tag is also the first entry in
$versionTags
.
Chances are, one of those will be false. Then we can move on from there.
from plugin-update-checker.
Interestingly, it shows all the versions up to v0.1, not more.
from plugin-update-checker.
Only first 10 versions.
from plugin-update-checker.
I think I got the problem. The results are paginated as 10 by 10. Once I print the $tags directly, it shows:
from plugin-update-checker.
Hello again,
I could not find any way to reverse the output on the api. So I tried detecting the last page and updated the api code. I've changed the getLatestTag
method like this and the problem is solved:
public function getLatestTag() {
$tags = $this->api('/refs/tags');
if ( !isset($tags, $tags->values) || !is_array($tags->values) ) {
return null;
}
$lastPage = floor($tags->size / $tags->pagelen) + 1;
if ( $lastPage > 1 ) {
$tags = $this->api('/refs/tags?page='.$lastPage);
}
//Filter and sort the list of tags.
$versionTags = $this->sortTagsByVersion($tags->values);
//Return the first result.
if ( !empty($versionTags) ) {
$tag = $versionTags[0];
return new Puc_v4_Vcs_Reference(array(
'name' => $tag->name,
'version' => ltrim($tag->name, 'v'),
'updated' => $tag->target->date,
'downloadUrl' => $this->getDownloadUrl($tag->name),
));
}
return null;
}
from plugin-update-checker.
It looks like you're right about the source of the bug. I had assumed BitBucket would return the most recent results first, but that's apparently not the case. I didn't catch this in my own testing because my repository didn't have enough tags to trigger pagination.
There is actually a way to sort query responses. The documentation is pretty short on details, but after some expermentation, I was able to find a way to sort tags by commit date. (sort=-target.date
). Try the patch I just committed - it should fix the problem.
from plugin-update-checker.
Great job Yahnis, thank you. 👍
from plugin-update-checker.
All right, I'll close this now. If anyone finds any new BitBucket-related bugs, please open a new issue.
from plugin-update-checker.
Related Issues (20)
- version_compare(): Passing null to parameter #1 ($version1) of type string is deprecated HOT 25
- Plugin stopped finding updates HOT 3
- Plugin Update Error HOT 3
- Release assets fallback to first/default .zip even if releaseassets regex is applied. HOT 5
- Plugin not found HOT 5
- Disable Update Mechanism / Hooks for License Management HOT 8
- 404 Issue when Updating (Fine grained tokens?) HOT 2
- enableReleaseAssets() no longer the supported method HOT 5
- Error PUC 5.1 does not support GitHub in ... HOT 13
- Question about translations HOT 2
- PHP 8.2 Compatibility - Deprecation Notice HOT 3
- "Can't to read the plugin header" errors HOT 2
- Deprecated error HOT 2
- Deprecation notices PHP8 HOT 3
- Some assistance with a universal updater for a private repo HOT 6
- Unable to check version HOT 7
- Using PUC on an external server HOT 2
- Fatal error: Uncaught Error: Class 'YahnisElsts\PluginUpdateChecker\v5p1\DebugBar\Panel' not found HOT 11
- API for self update function HOT 11
- Fatal Error: Unable to determine if plugin or theme HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from plugin-update-checker.