Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
afragen committed Mar 6, 2022
2 parents 8f0d9e5 + 4221af2 commit 3c7dd56
Show file tree
Hide file tree
Showing 12 changed files with 81 additions and 55 deletions.
6 changes: 6 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
#### [unreleased]

#### 10.7.0 / 2022-03-06
* fix long standing object cache conflict with refresh cache and missing GitHub subtab by always showing GitHub subtab
* return `get_remote_repo_meta()` data when called from Git Updater PRO REST API
* add `default` icon data to `Plugin` object
* add additional release asset data to repo cache

#### 10.6.15 / 2022-03-02
* show overridden plugins/themes by [Skip Updates](https://wordpress.org/plugins/skip-updates/) plugin in Git Updater Settings tab
* use `sanitize_key()` for nonces
Expand Down
12 changes: 6 additions & 6 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion git-updater.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* Plugin Name: Git Updater
* Plugin URI: https://git-updater.com
* Description: A plugin to automatically update GitHub hosted plugins, themes, and language packs. Additional API plugins available for Bitbucket, GitLab, Gitea, and Gist.
* Version: 10.6.15
* Version: 10.7.0
* Author: Andy Fragen
* License: MIT
* Domain Path: /languages
Expand Down
46 changes: 23 additions & 23 deletions languages/git-updater.pot
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@
# This file is distributed under the MIT.
msgid ""
msgstr ""
"Project-Id-Version: Git Updater 10.6.14\n"
"Project-Id-Version: Git Updater 10.7.0\n"
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/git-updater\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"POT-Creation-Date: 2022-02-05T23:32:19+00:00\n"
"POT-Creation-Date: 2022-03-06T19:18:31+00:00\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"X-Generator: WP-CLI 2.6.0\n"
"X-Domain: git-updater\n"

#. Plugin Name of the plugin
#: src/Git_Updater/Settings.php:165
#: src/Git_Updater/Settings.php:270
#: src/Git_Updater/Settings.php:166
#: src/Git_Updater/Settings.php:274
msgid "Git Updater"
msgstr ""

Expand Down Expand Up @@ -180,74 +180,74 @@ msgstr ""
msgid "Please be patient while WP-Cron finishes making API calls."
msgstr ""

#: src/Git_Updater/Settings.php:137
#: src/Git_Updater/Settings.php:806
#: src/Git_Updater/Settings.php:138
#: src/Git_Updater/Settings.php:817
msgid "Settings"
msgstr ""

#: src/Git_Updater/Settings.php:212
#: src/Git_Updater/Settings.php:369
#: src/Git_Updater/Settings.php:216
#: src/Git_Updater/Settings.php:373
msgid "Git Updater Settings"
msgstr ""

#: src/Git_Updater/Settings.php:213
#: src/Git_Updater/Settings.php:217
msgctxt "Menu item"
msgid "Git Updater"
msgstr ""

#: src/Git_Updater/Settings.php:293
#: src/Git_Updater/Settings.php:297
msgid "Refresh Cache"
msgstr ""

#: src/Git_Updater/Settings.php:338
#: src/Git_Updater/Settings.php:342
msgid "Settings saved."
msgstr ""

#: src/Git_Updater/Settings.php:340
#: src/Git_Updater/Settings.php:344
msgid "Cache refreshed."
msgstr ""

#: src/Git_Updater/Settings.php:382
#: src/Git_Updater/Settings.php:386
msgid "Enable Branch Switching"
msgstr ""

#: src/Git_Updater/Settings.php:395
#: src/Git_Updater/Settings.php:399
msgid "Bypass WP-Cron Background Processing for Debugging"
msgstr ""

#: src/Git_Updater/Settings.php:407
#: src/Git_Updater/Settings.php:411
msgid "Display `deprecated hook` messaging in debug.log"
msgstr ""

#: src/Git_Updater/Settings.php:570
#: src/Git_Updater/Settings.php:574
msgid "Check to enable."
msgstr ""

#: src/Git_Updater/Settings.php:602
#: src/Git_Updater/Settings.php:613
msgid "Overridden Plugins and Themes"
msgstr ""

#: src/Git_Updater/Settings.php:603
#: src/Git_Updater/Settings.php:614
msgid "The following plugins or themes might exist on wp.org, but any updates will be downloaded from their respective git repositories."
msgstr ""

#: src/Git_Updater/Settings.php:840
#: src/Git_Updater/Settings.php:851
msgid "This is a private repository."
msgstr ""

#: src/Git_Updater/Settings.php:841
#: src/Git_Updater/Settings.php:852
msgid "This repository has not connected to the API or was unable to connect."
msgstr ""

#: src/Git_Updater/Settings.php:842
#: src/Git_Updater/Settings.php:853
msgid "This repository is hosted on WordPress.org."
msgstr ""

#: src/Git_Updater/Settings.php:843
#: src/Git_Updater/Settings.php:854
msgid "This repository has been ignored and does not connect to the API."
msgstr ""

#: src/Git_Updater/Settings.php:887
#: src/Git_Updater/Settings.php:898
msgid "Installed Plugins and Themes"
msgstr ""

Expand Down
17 changes: 13 additions & 4 deletions src/Git_Updater/API/API.php
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,7 @@ protected function get_release_asset_redirect( $asset, $aws = false ) {

// Unset release asset url if older than 5 min to account for AWS expiration.
if ( $aws && ( time() - strtotime( '-12 hours', $this->response['timeout'] ) ) >= 300 ) {
unset( $this->response['release_asset'] );
unset( $this->response['release_asset_redirect'] );
}

Expand All @@ -575,15 +576,23 @@ protected function get_release_asset_redirect( $asset, $aws = false ) {

// phpcs:ignore WordPress.Security.NonceVerification.Recommended
if ( ! $response || isset( $_REQUEST['override'] ) ) {
$args = $this->add_auth_header( [], $asset );
$octet_stream = [ 'accept' => 'application/octet-stream' ];

// Get additional release asset data.
$release_asset_response = \wp_remote_get( $asset, $args );
$release_asset_response = json_decode( wp_remote_retrieve_body( $release_asset_response ) );
if ( ! empty( $release_asset_response ) ) {
$this->set_repo_cache( 'release_asset_response', $release_asset_response );
}

add_action( 'requests-requests.before_redirect', [ $this, 'set_redirect' ], 10, 1 );
$auth_header = $this->add_auth_header( [], $asset );
$octet_stream = [ 'accept' => 'application/octet-stream' ];
$args['headers'] = array_merge( $auth_header['headers'], $octet_stream );
$args['headers'] = array_merge( $args['headers'], $octet_stream );
$redirect = wp_remote_get( $asset, $args );

// If $redirect not retrieved zero out value of release_asset in cache.
if ( 200 !== wp_remote_retrieve_response_code( $redirect ) ) {
$this->set_repo_cache( 'release_asset', false );
$this->set_repo_cache( 'release_asset_response', false );
}
}

Expand Down
9 changes: 8 additions & 1 deletion src/Git_Updater/Base.php
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ public function maybe_auto_update() {
*
* @param \stdClass $repo Repo object.
*
* @return bool
* @return bool|\stdClass
*/
public function get_remote_repo_meta( $repo ) {
// Exit if non-privileged user and bypassing wp-cron.
Expand Down Expand Up @@ -374,6 +374,13 @@ public function get_remote_repo_meta( $repo ) {
$language_pack->run();
}

// Return data if being called from Git Updater PRO REST API.
if ( class_exists( 'Fragen\Git_Updater\PRO\REST\REST_API' )
&& $this->caller instanceof \Fragen\Git_Updater\PRO\REST\REST_API
) {
return $repo;
}

return true;
}

Expand Down
12 changes: 6 additions & 6 deletions src/Git_Updater/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -209,11 +209,12 @@ function ( $key ) use ( $plugin ) {
: null;
$git_plugin['icons'] = [];
$icons = [
'svg' => 'icon.svg',
'1x_png' => 'icon-128x128.png',
'1x_jpg' => 'icon-128x128.jpg',
'2x_png' => 'icon-256x256.png',
'2x_jpg' => 'icon-256x256.jpg',
'svg' => 'icon.svg',
'1x_png' => 'icon-128x128.png',
'1x_jpg' => 'icon-128x128.jpg',
'2x_png' => 'icon-256x256.png',
'2x_jpg' => 'icon-256x256.jpg',
'default' => '',
];
foreach ( $icons as $key => $filename ) {
$key = preg_replace( '/_png|_jpg/', '', $key );
Expand Down Expand Up @@ -379,7 +380,6 @@ public function update_site_transient( $transient ) {
'plugin' => $plugin->file,
'url' => $plugin->uri,
'icons' => $plugin->icons,
'icons' => $plugin->icons,
'banners' => $plugin->banners,
'branch' => $plugin->branch,
'type' => "{$plugin->git}-{$plugin->type}",
Expand Down
4 changes: 4 additions & 0 deletions src/Git_Updater/Settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
namespace Fragen\Git_Updater;

use Fragen\Singleton;
use Fragen\Git_Updater\API\GitHub_API;
use Fragen\Git_Updater\Traits\GU_Trait;

/*
Expand Down Expand Up @@ -167,6 +168,9 @@ private function settings_sub_tabs() {
$git_subtab = [];
$gu_subtabs = [];

// Force GitHub Settings subtab. Fix for object cache and refresh cache conflict.
( new GitHub_API( new \stdClass() ) )->add_settings( static::$auth_required );

/**
* Filter subtabs to be able to add subtab from git API class.
*
Expand Down
14 changes: 7 additions & 7 deletions vendor/composer/installed.json
Original file line number Diff line number Diff line change
Expand Up @@ -263,23 +263,23 @@
},
{
"name": "freemius/wordpress-sdk",
"version": "2.4.2",
"version_normalized": "2.4.2.0",
"version": "2.4.3",
"version_normalized": "2.4.3.0",
"source": {
"type": "git",
"url": "https://github.com/Freemius/wordpress-sdk.git",
"reference": "84a9be4717effd7697a217e0d931f48ae0d2ecc6"
"reference": "d2c3e1c27792f34123f928ea9fa73be56c337d13"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Freemius/wordpress-sdk/zipball/84a9be4717effd7697a217e0d931f48ae0d2ecc6",
"reference": "84a9be4717effd7697a217e0d931f48ae0d2ecc6",
"url": "https://api.github.com/repos/Freemius/wordpress-sdk/zipball/d2c3e1c27792f34123f928ea9fa73be56c337d13",
"reference": "d2c3e1c27792f34123f928ea9fa73be56c337d13",
"shasum": ""
},
"require": {
"php": ">=5.2"
},
"time": "2021-02-08T16:47:44+00:00",
"time": "2022-03-03T09:14:17+00:00",
"type": "library",
"installation-source": "dist",
"notification-url": "https://packagist.org/downloads/",
Expand All @@ -299,7 +299,7 @@
],
"support": {
"issues": "https://github.com/Freemius/wordpress-sdk/issues",
"source": "https://github.com/Freemius/wordpress-sdk/tree/2.4.2"
"source": "https://github.com/Freemius/wordpress-sdk/tree/2.4.3"
},
"install-path": "../freemius/wordpress-sdk"
}
Expand Down
10 changes: 5 additions & 5 deletions vendor/composer/installed.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
'type' => 'wordpress-plugin',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
'reference' => '089e23eefd3d661c7a1f4246e38534623f353012',
'reference' => '8f0d9e5517d037f62823d093d69c01e4acf1e1ae',
'name' => 'afragen/git-updater',
'dev' => false,
),
Expand All @@ -16,7 +16,7 @@
'type' => 'wordpress-plugin',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
'reference' => '6ef7a25b7fa6b6e35a2f35312a78b717686da4e3',
'reference' => '8f0d9e5517d037f62823d093d69c01e4acf1e1ae',
'dev_requirement' => false,
),
'afragen/singleton' => array(
Expand Down Expand Up @@ -69,12 +69,12 @@
'dev_requirement' => false,
),
'freemius/wordpress-sdk' => array(
'pretty_version' => '2.4.2',
'version' => '2.4.2.0',
'pretty_version' => '2.4.3',
'version' => '2.4.3.0',
'type' => 'library',
'install_path' => __DIR__ . '/../freemius/wordpress-sdk',
'aliases' => array(),
'reference' => '84a9be4717effd7697a217e0d931f48ae0d2ecc6',
'reference' => 'd2c3e1c27792f34123f928ea9fa73be56c337d13',
'dev_requirement' => false,
),
),
Expand Down
2 changes: 1 addition & 1 deletion vendor/freemius/wordpress-sdk/includes/class-freemius.php
Original file line number Diff line number Diff line change
Expand Up @@ -4058,7 +4058,7 @@ function get_anonymous_id( $blog_id = null ) {
if ( empty( $unique_id ) || ! is_string( $unique_id ) ) {
$key = fs_strip_url_protocol( get_site_url( $blog_id ) );

$secure_auth = SECURE_AUTH_KEY;
$secure_auth = defined( 'SECURE_AUTH_KEY' ) ? SECURE_AUTH_KEY : '';
if ( empty( $secure_auth ) ||
false !== strpos( $secure_auth, ' ' ) ||
'put your unique phrase here' === $secure_auth
Expand Down
2 changes: 1 addition & 1 deletion vendor/freemius/wordpress-sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"author": "Freemius, Inc.",
"license": "GPL-3.0",
"homepage": "https://freemius.com",
"version": "2.4.2",
"version": "2.4.3",
"main": "gulpfile.js",
"dependencies": {},
"scripts": {
Expand Down

0 comments on commit 3c7dd56

Please sign in to comment.