Commit Graph

172 Commits

Author SHA1 Message Date
Yahnis Elsts 0edd15f678 Minor: Fix incorrect version number in a doc-comment 2020-08-21 14:36:45 +03:00
Yahnis Elsts 97885642cc Merge branch 'master' into wp55-auto-updates 2020-08-21 14:33:01 +03:00
Yahnis Elsts 8c4a998c63 Hopefully fixed a fatal error related to Debug Bar
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.
2020-08-10 22:08:34 +03:00
Yahnis Elsts 5a98cfdae1 Change version number to 4.10 everywhere 2020-08-08 14:30:02 +03:00
Yahnis Elsts 66f5cf10c2 Change version number in directory name 2020-08-08 14:21:30 +03:00
Yahnis Elsts 5d3e93d267 Support the auto-update feature introduced in WP 5.5
Discussed in #376
2020-08-03 19:48:01 +03:00
Yahnis Elsts 9748abe1bd Add support for "Requires PHP" header fields.
In the update metadata the field is called "requires_php".

Closes #355
2020-04-07 16:06:24 +03:00
Yahnis Elsts ce3f43c10f Don't change "tested":"x.y" to "tested":"x.y.999" when x.y already matches the current WordPress release.
See #356
2020-04-07 15:21:40 +03:00
Yahnis Elsts 949842cee6 Minor cleanup and formatting changes 2020-03-31 17:52:07 +03:00
Richard Coffee b2ca059c05 change method name, add EXTR_SKIP to extract call 2020-03-30 15:15:35 -04:00
Richard Coffee e61f3f5cba Fix logic error 2020-03-29 15:29:23 -04:00
Richard Coffee dcc817106a add updateChecker and getServiceURI methods 2020-03-29 14:25:16 -04:00
Yahnis Elsts 5c6c45d561 Fixed a fatal error triggered when trying to autoload some classes while inside a Phar archive 2020-02-23 12:38:27 +02:00
Yahnis Elsts e3cc1c03c9 Fixed a potential fatal error when the current PUC version is removed during an upgrade.
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.
2020-02-15 15:28:12 +02:00
Yahnis Elsts 5cdadd0369 Fixed a bug where PUC might not properly whitelist the hostname used in the metadata URL if there were at least two active plugins using the same version of PUC. 2020-02-13 22:14:49 +02:00
Yahnis Elsts 28f29c940c Bump version number to 4.9 2020-02-07 13:07:19 +02:00
Yahnis Elsts 3857481c65 GitHub support: Use Basic auth instead of the access_token query parameter
See #337, #338
2020-02-04 20:29:25 +02:00
Yahnis Elsts 760225bbfe Fix fatal error "Call to a member function isMuPlugin() on null"
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
2020-01-24 19:05:40 +02:00
Yahnis Elsts 7014c9d9fd Randomly offset the update check schedule within $checkPeriod
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.
2019-11-03 12:33:09 +02:00
Yahnis Elsts 2a7c818f18 Alternative fix to Composer autoloading issues.
It may be possible to overcome the limitations of the "files" autoloading mechanism by changing the file name in every version.
2019-10-08 15:06:40 +03:00
Yahnis Elsts 66472c5f16 Hopefully fixed a crash when loading Puc_v4_Factory with a Composer autoloader.
See #321 for details.
2019-10-08 14:45:29 +03:00
Yahnis Elsts 0a0142f1ae Fixed a bug where Puc_v4_Factory was not loaded by the custom autoloader.
This could cause a fatal error in PUC 4.8 when not using the Composer autoloader.
2019-10-02 13:47:16 +03:00
Yahnis Elsts 17e1c90598 Minor: Removed another unnecessary condition 2019-10-01 14:47:45 +03:00
Yahnis Elsts a3ff7ada08 Fixed a potential bug with multiple plugins using GitHub release assets.
To allow WP to download a release asset from GitHub, the update checker needs to add an "Accept: application/octet-stream" header to the HTTP request. We use the "http_request_args" filter for that. 

Previously, we used a static variable to ensure that the filter callback is added only once. However, in PHP, static variables defined in a method are shared by all instances of the class that the method belongs to. This means that if one plugin enables release assets, adds a "http_request_args" filter, and sets ``$filterAdded` to `true`, then the next plugin that enables release assets won't add its own filter because the variable will already be `true`.

Fixed by using an instance variable (`$downloadFilterAdded`) instead of a static variable.
2019-10-01 14:35:16 +03:00
Yahnis Elsts 969f8adf21 Minor: Remove a few unneeded conditions 2019-10-01 14:25:04 +03:00
Yahnis Elsts c30528c55c Minor: Fixed some spacing and style 2019-10-01 13:29:51 +03:00
Malte Müns 05c76ef07d [FEATURE] Allow subgroups for self hosted GitLab instances
https://docs.gitlab.com/ce/user/group/subgroups/index.html
2019-09-30 11:02:00 +02:00
Yahnis Elsts a78cbb71d3 Bump version number to 4.8 2019-09-28 15:47:47 +03:00
Yahnis Elsts bbe88a70d6 Attempt to fix errors caused by using Composer-generated autoloaders when multiple versions of the library are loaded at the same time.
See #300. Apparently, when using the `files` autoloading mechanism, Composer will only include the files for one version of the library (i.e. the first one loaded). Let's see if we can fix that by switching to a `psr-0` autoloader. This requires a bunch of changes to the standalone autoloader and the factory registration process.
2019-09-27 17:06:01 +03:00
Yahnis Elsts ee8ccd4181 Adjust the "tested" version shown in the "View details" pop-up.
PUC automatically changes "tested up to" version numbers that are in the major.minor format to major.minor.latest-patch to prevent WP from showing "this update hasn't been tested with your WP version" warnings. (This was implemented because WordPress.org does something similar.) Previously, this adjustment didn't happen when the user clicked the "view details" link in a plugin update notification, so they would still see a compatibility warning there. That has now been fixed.

Fixes #307
2019-08-19 14:09:54 +03:00
Yahnis Elsts 6355072b9f Minor: Add a newline to the end of file because it's recommended by some code style checkers. 2019-07-15 17:58:23 +03:00
Yahnis Elsts 6da68b1192 Changed version number to 4.7 2019-07-05 21:39:53 +03:00
Yahnis Elsts 3f5a340ded Fully upgraded to BitBucket API 2.0.
Previously the update checker used a mix of 2.0 and 1.0. Version 1.0 was deprecated a while ago and has now stopped working for at least some users.

This should fix the errors reported in #289.
2019-06-13 16:11:05 +03:00
Yahnis Elsts 4643dec114 Minor: Add newlines to the end of each file.
Some code analysers require this.
2019-04-18 22:53:23 +03:00
Yahnis Elsts 5f856d8d80 Removed warning suppression from parse_url().
PUC uses parse_url() in a number of places to parse the metadata URL or repository URL. If someone provides an invalid URL then that's already a configuration error so it's not necessary to hide the warnings emitted by parse_url(). 

Also, as of PHP 5.3.3, parse_url() no longer emits warnings when it fails to parse something, so anyone using an actively supported PHP version (7.2+) wouldn't see any warnings anyway.
2019-04-18 22:30:53 +03:00
Yahnis Elsts 45374e3c02 Bump version number to 4.6 2019-04-02 20:56:11 +03:00
Yahnis Elsts 8499f5c429 GitLab: Use the protocol specified in the repository URL instead of always defaulting to HTTPS.
A user reports that some GitLab servers use plain HTTP for their APIs. See #270.
2019-03-18 14:11:42 +02:00
Yahnis Elsts 49c0fbd6b5 Minor code style adjustments. 2019-03-14 20:28:41 +02:00
David Anderson d9011e1a49
Added missing type check 2019-03-14 18:21:01 +00:00
David Anderson b26dbf8eb3
Extra check 2019-03-14 16:13:08 +00:00
David Anderson 8d3aa30f3e
Modify behaviour on upgrader_process_complete action
Won't call `maybeCheckForUpdates()` if it's not an update for this entity.
2019-03-14 16:01:09 +00:00
Pierre e8422cdf42 Fix wrong function name 2019-02-27 14:03:43 +01:00
Adrien Foulon 02592c7fc4
Add a filter to getVcsService
The filter 'puc_get_vcs_service' will then allow user to add their self hosted gitlab or bitbucket as a recognised service
like so
add_filter('puc_get_vcs_service', function($service, $host) {
    if ($host == 'gitlab.mydomain.com') {
        return 'GitLab';
    }
    return $service;
}, 10, 2);
2019-02-25 19:03:46 +01:00
Yahnis Elsts 9d087b7d9c Add a workaround for realpath() failing to process the mu-plugins path.
Probably fixes #251
2018-12-30 13:36:24 +02:00
Yahnis Elsts d98d6bc6ca Bump version to 4.5 - step 2
Rename files and update file paths.
2018-12-30 12:38:32 +02:00
Yahnis Elsts d460807de8 Bump version to 4.5 - step #1
Renaming all of the clases and updating version numbers.
2018-12-30 12:35:16 +02:00
Yahnis Elsts 5a6b4f9878 Merge branch 'master' into gitlab-subgroups 2018-12-11 20:14:59 +02:00
Yahnis Elsts c5036b620f Fix outdated API syntax in getRemoteFile 2018-12-09 11:02:54 +02:00
Yahnis Elsts 2dba97ecfb Don't encode slashes unnecessarily 2018-12-05 21:51:15 +02:00
Yahnis Elsts ee677e2e5b Potential fix for #240.
Props to @froger-me
2018-12-05 21:40:54 +02:00