Skip to content

Commit 5c1a0d3

Browse files
committed
Merge branch 'develop'
2 parents 60a540b + 7d19470 commit 5c1a0d3

12 files changed

+283
-204
lines changed

CHANGES.md

+7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
#### [unreleased]
22

3+
#### 8.7.1 / 2019-03-09
4+
* add new filter hook `github_updater_post_construct_download_link` to allow for returning your own download link
5+
* deprecate filter hook `github_updater_set_rollback_package` as the above replaces it
6+
* add _looser_ check of `Base::get_repo_slugs()`, thanks @sc0ttkclark
7+
* update `class Bitbucket_Server_API`, thanks @allrite for the access
8+
* added filter hook `github_updater_repo_cache_timeout` to change default timeout per repository, thanks @sc0ttkclark
9+
310
#### 8.7.0 / 2019-02-24
411
* update `Readme_Parser` for changelog and description parsing
512
* add filter `github_updater_temp_readme_filepath` to change default location if server has permissions issues, fixes [#766](https://github.com/afragen/github-updater/issues/766)

github-updater.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* Plugin Name: GitHub Updater
1313
* Plugin URI: https://github.com/afragen/github-updater
1414
* Description: A plugin to automatically update GitHub, Bitbucket, GitLab, or Gitea hosted plugins, themes, and language packs. It also allows for remote installation of plugins or themes into WordPress.
15-
* Version: 8.7.0
15+
* Version: 8.7.1
1616
* Author: Andy Fragen
1717
* License: GNU General Public License v2
1818
* License URI: http://www.gnu.org/licenses/gpl-2.0.html

languages/github-updater.pot

+52-52
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
# This file is distributed under the same license as the GitHub Updater plugin.
33
msgid ""
44
msgstr ""
5-
"Project-Id-Version: GitHub Updater 8.6.3\n"
5+
"Project-Id-Version: GitHub Updater 8.7.1\n"
66
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/github-updater\n"
77
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
88
"Language-Team: LANGUAGE <[email protected]>\n"
99
"MIME-Version: 1.0\n"
1010
"Content-Type: text/plain; charset=UTF-8\n"
1111
"Content-Transfer-Encoding: 8bit\n"
12-
"POT-Creation-Date: 2019-02-05T03:35:40+00:00\n"
12+
"POT-Creation-Date: 2019-03-09T19:26:46+00:00\n"
1313
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
1414
"X-Generator: WP-CLI 2.1.0\n"
1515
"X-Domain: github-updater\n"
@@ -190,7 +190,7 @@ msgstr ""
190190

191191
#. translators: 1: branch name, 2: jQuery dropdown, 3: closing tag
192192
#: src/GitHub_Updater/Theme.php:583
193-
#: src/GitHub_Updater/Base.php:895
193+
#: src/GitHub_Updater/Base.php:913
194194
msgid "Current branch is `%1$s`, try %2$sanother version%3$s"
195195
msgstr ""
196196

@@ -199,7 +199,7 @@ msgid "Choose a Version"
199199
msgstr ""
200200

201201
#: src/GitHub_Updater/Theme.php:609
202-
#: src/GitHub_Updater/Base.php:930
202+
#: src/GitHub_Updater/Base.php:948
203203
msgid "No previous tags to rollback to."
204204
msgstr ""
205205

@@ -211,11 +211,11 @@ msgstr ""
211211
msgid "There may be a problem with WP-Cron. A GitHub Updater WP-Cron event is overdue."
212212
msgstr ""
213213

214-
#: src/GitHub_Updater/Base.php:906
214+
#: src/GitHub_Updater/Base.php:924
215215
msgid "Switch to branch "
216216
msgstr ""
217217

218-
#: src/GitHub_Updater/Base.php:922
218+
#: src/GitHub_Updater/Base.php:940
219219
msgid "Switch to release "
220220
msgstr ""
221221

@@ -237,49 +237,49 @@ msgstr ""
237237
msgid "Use of Remote Management services may result increase some page load speeds only for `admin` level users in the dashboard."
238238
msgstr ""
239239

240-
#: src/GitHub_Updater/API/Bitbucket_API.php:353
240+
#: src/GitHub_Updater/API/Bitbucket_API.php:386
241241
msgid "Bitbucket Private Settings"
242242
msgstr ""
243243

244-
#: src/GitHub_Updater/API/Bitbucket_API.php:360
245-
#: src/GitHub_Updater/API/Bitbucket_API.php:448
244+
#: src/GitHub_Updater/API/Bitbucket_API.php:393
245+
#: src/GitHub_Updater/API/Bitbucket_API.php:481
246246
msgid "Bitbucket Username"
247247
msgstr ""
248248

249-
#: src/GitHub_Updater/API/Bitbucket_API.php:369
250-
#: src/GitHub_Updater/API/Bitbucket_API.php:456
249+
#: src/GitHub_Updater/API/Bitbucket_API.php:402
250+
#: src/GitHub_Updater/API/Bitbucket_API.php:489
251251
msgid "Bitbucket Password"
252252
msgstr ""
253253

254-
#: src/GitHub_Updater/API/Bitbucket_API.php:385
254+
#: src/GitHub_Updater/API/Bitbucket_API.php:418
255255
msgid "Bitbucket Private Repositories"
256256
msgstr ""
257257

258-
#: src/GitHub_Updater/API/Bitbucket_API.php:415
258+
#: src/GitHub_Updater/API/Bitbucket_API.php:448
259259
msgid "Bitbucket"
260260
msgstr ""
261261

262-
#: src/GitHub_Updater/API/Bitbucket_API.php:424
262+
#: src/GitHub_Updater/API/Bitbucket_API.php:457
263263
msgid "Check box if private repository. Leave unchecked for public repositories."
264264
msgstr ""
265265

266-
#: src/GitHub_Updater/API/Bitbucket_API.php:431
266+
#: src/GitHub_Updater/API/Bitbucket_API.php:464
267267
msgid "Enter your personal Bitbucket username and password."
268268
msgstr ""
269269

270-
#: src/GitHub_Updater/API/Bitbucket_API.php:465
270+
#: src/GitHub_Updater/API/Bitbucket_API.php:498
271271
msgid "Private Bitbucket Repository"
272272
msgstr ""
273273

274-
#: src/GitHub_Updater/API/Bitbucket_API.php:481
274+
#: src/GitHub_Updater/API/Bitbucket_API.php:514
275275
msgid "Check for private Bitbucket repositories."
276276
msgstr ""
277277

278-
#: src/GitHub_Updater/API/Bitbucket_API.php:496
278+
#: src/GitHub_Updater/API/Bitbucket_API.php:529
279279
msgid "Enter Bitbucket username."
280280
msgstr ""
281281

282-
#: src/GitHub_Updater/API/Bitbucket_API.php:511
282+
#: src/GitHub_Updater/API/Bitbucket_API.php:544
283283
msgid "Enter Bitbucket password."
284284
msgstr ""
285285

@@ -291,129 +291,129 @@ msgstr ""
291291
msgid "Enter plugin or theme slug."
292292
msgstr ""
293293

294-
#: src/GitHub_Updater/API/Gitea_API.php:312
295-
#: src/GitHub_Updater/API/Gitea_API.php:330
296-
#: src/GitHub_Updater/API/Gitea_API.php:392
294+
#: src/GitHub_Updater/API/Gitea_API.php:343
295+
#: src/GitHub_Updater/API/Gitea_API.php:361
296+
#: src/GitHub_Updater/API/Gitea_API.php:423
297297
msgid "Gitea Access Token"
298298
msgstr ""
299299

300-
#: src/GitHub_Updater/API/Gitea_API.php:321
300+
#: src/GitHub_Updater/API/Gitea_API.php:352
301301
msgid "Gitea Private Settings"
302302
msgstr ""
303303

304-
#: src/GitHub_Updater/API/Gitea_API.php:365
304+
#: src/GitHub_Updater/API/Gitea_API.php:396
305305
msgid "Gitea"
306306
msgstr ""
307307

308-
#: src/GitHub_Updater/API/Gitea_API.php:374
308+
#: src/GitHub_Updater/API/Gitea_API.php:405
309309
msgid "Enter your repository specific Gitea Access Token."
310310
msgstr ""
311311

312-
#: src/GitHub_Updater/API/Gitea_API.php:381
312+
#: src/GitHub_Updater/API/Gitea_API.php:412
313313
msgid "Enter your Gitea Access Token."
314314
msgstr ""
315315

316-
#: src/GitHub_Updater/API/Gitea_API.php:408
316+
#: src/GitHub_Updater/API/Gitea_API.php:439
317317
msgid "Enter Gitea Access Token for private Gitea repositories."
318318
msgstr ""
319319

320-
#: src/GitHub_Updater/API/Gitea_API.php:439
320+
#: src/GitHub_Updater/API/Gitea_API.php:470
321321
msgid "You must set a Gitea Access Token."
322322
msgstr ""
323323

324-
#: src/GitHub_Updater/API/GitLab_API.php:405
324+
#: src/GitHub_Updater/API/GitLab_API.php:436
325325
msgid "GitLab Personal Access Token"
326326
msgstr ""
327327

328-
#: src/GitHub_Updater/API/GitLab_API.php:414
328+
#: src/GitHub_Updater/API/GitLab_API.php:445
329329
msgid "GitLab Private Settings"
330330
msgstr ""
331331

332-
#: src/GitHub_Updater/API/GitLab_API.php:423
332+
#: src/GitHub_Updater/API/GitLab_API.php:454
333333
msgid "GitLab.com Access Token"
334334
msgstr ""
335335

336-
#: src/GitHub_Updater/API/GitLab_API.php:437
336+
#: src/GitHub_Updater/API/GitLab_API.php:468
337337
msgid "GitLab CE or GitLab Enterprise Personal Access Token"
338338
msgstr ""
339339

340-
#: src/GitHub_Updater/API/GitLab_API.php:472
340+
#: src/GitHub_Updater/API/GitLab_API.php:503
341341
msgid "GitLab"
342342
msgstr ""
343343

344-
#: src/GitHub_Updater/API/GitLab_API.php:481
344+
#: src/GitHub_Updater/API/GitLab_API.php:512
345345
msgid "Enter your repository specific GitLab Access Token."
346346
msgstr ""
347347

348-
#: src/GitHub_Updater/API/GitLab_API.php:488
348+
#: src/GitHub_Updater/API/GitLab_API.php:519
349349
msgid "Enter your GitLab.com, GitLab CE, or GitLab Enterprise Access Token."
350350
msgstr ""
351351

352-
#: src/GitHub_Updater/API/GitLab_API.php:499
352+
#: src/GitHub_Updater/API/GitLab_API.php:530
353353
msgid "GitLab Access Token"
354354
msgstr ""
355355

356-
#: src/GitHub_Updater/API/GitLab_API.php:515
356+
#: src/GitHub_Updater/API/GitLab_API.php:546
357357
msgid "Enter GitLab Access Token for private GitLab repositories."
358358
msgstr ""
359359

360-
#: src/GitHub_Updater/API/GitLab_API.php:548
360+
#: src/GitHub_Updater/API/GitLab_API.php:579
361361
msgid "You must set a GitLab.com, GitLab CE, or GitLab Enterprise Access Token."
362362
msgstr ""
363363

364-
#: src/GitHub_Updater/API/GitHub_API.php:340
364+
#: src/GitHub_Updater/API/GitHub_API.php:371
365365
msgid "GitHub Personal Access Token"
366366
msgstr ""
367367

368-
#: src/GitHub_Updater/API/GitHub_API.php:347
368+
#: src/GitHub_Updater/API/GitHub_API.php:378
369369
msgid "github.com Access Token"
370370
msgstr ""
371371

372-
#: src/GitHub_Updater/API/GitHub_API.php:360
372+
#: src/GitHub_Updater/API/GitHub_API.php:391
373373
msgid "GitHub Enterprise Access Token"
374374
msgstr ""
375375

376-
#: src/GitHub_Updater/API/GitHub_API.php:377
376+
#: src/GitHub_Updater/API/GitHub_API.php:408
377377
msgid "GitHub Private Settings"
378378
msgstr ""
379379

380-
#: src/GitHub_Updater/API/GitHub_API.php:404
380+
#: src/GitHub_Updater/API/GitHub_API.php:435
381381
msgid "Enter your GitHub Access Token. Leave empty for public repositories."
382382
msgstr ""
383383

384-
#: src/GitHub_Updater/API/GitHub_API.php:411
384+
#: src/GitHub_Updater/API/GitHub_API.php:442
385385
msgid "Enter your personal github.com or GitHub Enterprise Access Token to avoid API access limits."
386386
msgstr ""
387387

388-
#: src/GitHub_Updater/API/GitHub_API.php:422
388+
#: src/GitHub_Updater/API/GitHub_API.php:453
389389
msgid "GitHub Access Token"
390390
msgstr ""
391391

392-
#: src/GitHub_Updater/API/GitHub_API.php:436
392+
#: src/GitHub_Updater/API/GitHub_API.php:467
393393
msgid "GitHub"
394394
msgstr ""
395395

396-
#: src/GitHub_Updater/API/GitHub_API.php:450
396+
#: src/GitHub_Updater/API/GitHub_API.php:481
397397
msgid "Enter GitHub Access Token for private GitHub repositories."
398398
msgstr ""
399399

400-
#: src/GitHub_Updater/API/Bitbucket_Server_API.php:344
400+
#: src/GitHub_Updater/API/Bitbucket_Server_API.php:340
401401
msgid "Bitbucket Server Private Settings"
402402
msgstr ""
403403

404-
#: src/GitHub_Updater/API/Bitbucket_Server_API.php:351
404+
#: src/GitHub_Updater/API/Bitbucket_Server_API.php:347
405405
msgid "Bitbucket Server Username"
406406
msgstr ""
407407

408-
#: src/GitHub_Updater/API/Bitbucket_Server_API.php:360
408+
#: src/GitHub_Updater/API/Bitbucket_Server_API.php:356
409409
msgid "Bitbucket Server Password"
410410
msgstr ""
411411

412-
#: src/GitHub_Updater/API/Bitbucket_Server_API.php:376
412+
#: src/GitHub_Updater/API/Bitbucket_Server_API.php:372
413413
msgid "Bitbucket Server Private Repositories"
414414
msgstr ""
415415

416-
#: src/GitHub_Updater/API/Bitbucket_Server_API.php:406
416+
#: src/GitHub_Updater/API/Bitbucket_Server_API.php:402
417417
msgid "Bitbucket Server"
418418
msgstr ""
419419

src/GitHub_Updater/API.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ protected function get_api_url( $endpoint, $download_link = false ) {
340340
];
341341

342342
foreach ( $segments as $segment => $value ) {
343-
$endpoint = str_replace( '/:' . $segment, '/' . sanitize_text_field( $value ), $endpoint );
343+
$endpoint = str_replace( ':' . $segment, sanitize_text_field( $value ), $endpoint );
344344
}
345345

346346
$repo_api = $this->get_repo_api( $type['git'], $this->type );
@@ -376,6 +376,7 @@ protected function get_api_url( $endpoint, $download_link = false ) {
376376
$this->load_authentication_hooks();
377377
if ( $this->type->enterprise_api ) {
378378
if ( $download_link ) {
379+
$type['base_download'] = $type['base_uri'];
379380
break;
380381
}
381382
$endpoint = $repo_api->add_endpoints( $this, $endpoint );

src/GitHub_Updater/API/Bitbucket_API.php

+23-10
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,19 @@ public function construct_download_link( $branch_switch = false ) {
208208
}
209209
}
210210

211-
return $download_link_base . $endpoint;
211+
$download_link = $download_link_base . $endpoint;
212+
213+
/**
214+
* Filter download link so developers can point to specific ZipFile
215+
* to use as a download link during a branch switch.
216+
*
217+
* @since 8.8.0
218+
*
219+
* @param string $download_link Download URL.
220+
* @param /stdClass $this->type Repository object.
221+
* @param string $branch_switch Branch or tag for rollback or branch switching.
222+
*/
223+
return apply_filters( 'github_updater_post_construct_download_link', $download_link, $this->type, $branch_switch );
212224
}
213225

214226
/**
@@ -344,15 +356,16 @@ protected function parse_tags( $response, $repo_type ) {
344356
$rollback = [];
345357

346358
foreach ( (array) $response as $tag ) {
347-
$download_base = implode(
348-
'/',
349-
[
350-
$repo_type['base_download'],
351-
$this->type->owner,
352-
$this->type->slug,
353-
'get/',
354-
]
355-
);
359+
// $download_base = implode(
360+
// '/',
361+
// [
362+
// $repo_type['base_download'],
363+
// $this->type->owner,
364+
// $this->type->owner,
365+
// 'get/',
366+
// ]
367+
// );
368+
$download_base = "{$repo_type['base_download']}/{$this->type->owner}/{$this->type->owner}/get/";
356369
$tags[] = $tag;
357370
$rollback[ $tag ] = $download_base . $tag . '.zip';
358371
}

0 commit comments

Comments
 (0)