Adds `main` as a possible default branch name to invoke `$this->getLatestTag()` inside of `Puc_v4p11_Vcs_BitBucketApi::chooseReference()`.
Previously, only branches named `master` inherited this special behavior. With more VCS providers opting for an inclusive default branch name, this commit adds `main` as a default branch name configuration.
Related to #422.
The update checker will look for a `master` branch by default, but new repositories use the name `main` instead, and it is technically possible to use any branch as the default branch. So while you don't *have to* set the branch name, it's probably a good idea to always do that.
Apparently, the "/src" subsection of the BitBucket API doesn't do well with branch names that contain slashes. urlencode() doesn't help. See #409 for the initial report.
Apparently, upgrading a plugin that uses PUC 4.9 to a version that uses PUC 4.10 may trigger two fatal errors, one of which happens inside the Debug Bar extension. Cause is unclear and the errors are not reproduced, but I suspect it has to do with PUC trying to set up a Debug Bar panel after the currently active PUC version has already been replaced. This patch should fix that.
Over the past couple of years when maintaining Easy Updates Manager - https://wordpress.org/plugins/stops-core-theme-and-plugin-updates/ - we've had a lots of reports from people with third party plugins and themes whose upgrades aren't detected or performed. On investigation, this is invariably because the component loads PUC only during an `admin_*` hook, which means that those updates are effectively invisible except for a logged-in user viewing a page in the WP dashboard. So, tools like EUM, ManageWP, JetPack Manage, UpdraftCentral, WP-CLI, etc., don't see them - they're invisible.
By default, PUC automatically checks for updates immediately after the user upgrades the plugin or theme. This can become a problem if the upgrade overwrites the PUC library with a different version. While checking for updates, PUC may attempt to autoload a class, which will trigger a fatal error if the class file was deleted during the upgrade.
Fixed by checking if the running PUC version still exists after the upgrade. If it doesn't, remove hooks and stop.
In certain configurations, PUC could call a method that uses the $package property before calling the parent class constructor that initialises that property. This has now been fixed by moving the parent constructor call a few lines up.
Fixes#335
This helps spread out update requests over all hours of the day and may prevent the update server from being hit with daily traffic spikes.
See #323 for discussion.