Skip to content
Snippets Groups Projects
Commit 5286fe0d authored by Reinhold Kainhofer's avatar Reinhold Kainhofer
Browse files

V1.2.6debug: Add debug statements for update credentials check issues...

V1.2.6debug: Add debug statements for update credentials check issues (wp_remote_get fails for some unknown reason...)
parent 9ed46b18
Branches
Tags
No related merge requests found
diff --git a/opentools-update-checker.php b/opentools-update-checker.php
index b01fa1d..49f45ad 100644
--- a/opentools-update-checker.php
+++ b/opentools-update-checker.php
@@ -23,6 +23,7 @@ class OpenToolsPluginUpdateChecker extends PluginUpdateChecker_2_1 {
public function __construct($metadataUrl, $pluginFile, $slug = '', $checkPeriod = 12, $optionName = '', $muPluginFile = '')
{
parent::__construct($metadataUrl, $pluginFile, $slug, $checkPeriod, $optionName, $muPluginFile);
+ $this->debugMode = TRUE;
$this->installOTHooks();
}
public function declareCredentials($credential_def) {
@@ -249,6 +250,9 @@ class OpenToolsPluginUpdateChecker extends PluginUpdateChecker_2_1 {
$success = ($status_code==200);
} else {
$message = __('Unable to access plugin download URL. Please check your credentials.');
+ if ($this->debugMode) {
+ $message .= "<pre>updateinfo: ".print_r($updateinfo,1)."</pre>";
+ }
}
return $success;
}
diff --git a/plugin-update-checker/plugin-update-checker.php b/plugin-update-checker/plugin-update-checker.php
index 8a5c92f..af74a8a 100644
--- a/plugin-update-checker/plugin-update-checker.php
+++ b/plugin-update-checker/plugin-update-checker.php
@@ -221,7 +221,7 @@ class PluginUpdateChecker_2_1 {
);
//Try to parse the response
- $pluginInfo = null;
+ $pluginInfo = new stdClass();
if ( !is_wp_error($result) && isset($result['response']['code']) && ($result['response']['code'] == 200) && !empty($result['body']) ){
$pluginInfo = PluginInfo_2_1::fromJson($result['body'], $this->debugMode);
$pluginInfo->filename = $this->pluginFile;
@@ -237,6 +237,7 @@ class PluginUpdateChecker_2_1 {
}
trigger_error($message, E_USER_WARNING);
}
+ $pluginInfo->response = $result;
$pluginInfo = apply_filters('puc_request_info_result-'.$this->slug, $pluginInfo, $result);
return $pluginInfo;
BASE=shipping-by-rules BASE=shipping-by-rules
PLATTFORM=woocommerce PLATTFORM=woocommerce
VENDOR=opentools VENDOR=opentools
VERSION=1.2.6 VERSION=1.2.6debug
DIR = $(shell pwd) DIR = $(shell pwd)
SVNDIR=wordpress-plugin-svn SVNDIR=wordpress-plugin-svn
......
...@@ -23,6 +23,7 @@ class OpenToolsPluginUpdateChecker extends PluginUpdateChecker_2_1 { ...@@ -23,6 +23,7 @@ class OpenToolsPluginUpdateChecker extends PluginUpdateChecker_2_1 {
public function __construct($metadataUrl, $pluginFile, $slug = '', $checkPeriod = 12, $optionName = '', $muPluginFile = '') public function __construct($metadataUrl, $pluginFile, $slug = '', $checkPeriod = 12, $optionName = '', $muPluginFile = '')
{ {
parent::__construct($metadataUrl, $pluginFile, $slug, $checkPeriod, $optionName, $muPluginFile); parent::__construct($metadataUrl, $pluginFile, $slug, $checkPeriod, $optionName, $muPluginFile);
$this->debugMode = TRUE;
$this->installOTHooks(); $this->installOTHooks();
} }
public function declareCredentials($credential_def) { public function declareCredentials($credential_def) {
...@@ -249,6 +250,9 @@ class OpenToolsPluginUpdateChecker extends PluginUpdateChecker_2_1 { ...@@ -249,6 +250,9 @@ class OpenToolsPluginUpdateChecker extends PluginUpdateChecker_2_1 {
$success = ($status_code==200); $success = ($status_code==200);
} else { } else {
$message = __('Unable to access plugin download URL. Please check your credentials.'); $message = __('Unable to access plugin download URL. Please check your credentials.');
if ($this->debugMode) {
$message .= "<pre>updateinfo: ".print_r($updateinfo,1)."</pre>";
}
} }
return $success; return $success;
} }
......
File added
File added
...@@ -221,11 +221,11 @@ class PluginUpdateChecker_2_1 { ...@@ -221,11 +221,11 @@ class PluginUpdateChecker_2_1 {
); );
//Try to parse the response //Try to parse the response
$pluginInfo = null; $pluginInfo = new stdClass();
if ( !is_wp_error($result) && isset($result['response']['code']) && ($result['response']['code'] == 200) && !empty($result['body']) ){ if ( !is_wp_error($result) && isset($result['response']['code']) && ($result['response']['code'] == 200) && !empty($result['body']) ){
$pluginInfo = PluginInfo_2_1::fromJson($result['body'], $this->debugMode); $pluginInfo = PluginInfo_2_1::fromJson($result['body'], $this->debugMode);
$pluginInfo->filename = $this->pluginFile; $pluginInfo->filename = $this->pluginFile;
$pluginInfo->slug = $this->slug; $pluginInfo->slug = $this->slug;
} else if ( $this->debugMode ) { } else if ( $this->debugMode ) {
$message = sprintf("The URL %s does not point to a valid plugin metadata file. ", $url); $message = sprintf("The URL %s does not point to a valid plugin metadata file. ", $url);
if ( is_wp_error($result) ) { if ( is_wp_error($result) ) {
...@@ -237,6 +237,7 @@ class PluginUpdateChecker_2_1 { ...@@ -237,6 +237,7 @@ class PluginUpdateChecker_2_1 {
} }
trigger_error($message, E_USER_WARNING); trigger_error($message, E_USER_WARNING);
} }
$pluginInfo->response = $result;
$pluginInfo = apply_filters('puc_request_info_result-'.$this->slug, $pluginInfo, $result); $pluginInfo = apply_filters('puc_request_info_result-'.$this->slug, $pluginInfo, $result);
return $pluginInfo; return $pluginInfo;
......
...@@ -3,7 +3,7 @@ Contributors: opentools ...@@ -3,7 +3,7 @@ Contributors: opentools
Tags: WooCommerce, Shipment, Shipping Tags: WooCommerce, Shipment, Shipping
Requires at least: 4.0 Requires at least: 4.0
Tested up to: 4.5 Tested up to: 4.5
Stable tag: 1.2.6 Stable tag: 1.2.6debug
License: GPLv3 or later License: GPLv3 or later
License URI: http://www.gnu.org/licenses/gpl.html License URI: http://www.gnu.org/licenses/gpl.html
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* Plugin Name: WooCommerce Advanced Shipping By Rules * Plugin Name: WooCommerce Advanced Shipping By Rules
* Plugin URI: http://open-tools.net/woocommerce/advanced-shipping-by-rules-for-woocommerce.html * Plugin URI: http://open-tools.net/woocommerce/advanced-shipping-by-rules-for-woocommerce.html
* Description: Define Shipping cost by very general and flexible (text-based) rules. The advanced version also provides mathematical expressions and functions * Description: Define Shipping cost by very general and flexible (text-based) rules. The advanced version also provides mathematical expressions and functions
* Version: 1.2.6 * Version: 1.2.6debug
* Author: Open Tools, Reinhold Kainhofer * Author: Open Tools, Reinhold Kainhofer
* Author URI: http://open-tools.net * Author URI: http://open-tools.net
* Text Domain: woocommerce-advanced-shipping-by-rules * Text Domain: woocommerce-advanced-shipping-by-rules
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* Plugin Name: WooCommerce Shipping By Rules * Plugin Name: WooCommerce Shipping By Rules
* Plugin URI: http://open-tools.net/woocommerce/advanced-shipping-by-rules-for-woocommerce.html * Plugin URI: http://open-tools.net/woocommerce/advanced-shipping-by-rules-for-woocommerce.html
* Description: Define Shipping cost by very general and flexible (text-based) rules. * Description: Define Shipping cost by very general and flexible (text-based) rules.
* Version: 1.2.6 * Version: 1.2.6debug
* Author: Open Tools, Reinhold Kainhofer * Author: Open Tools, Reinhold Kainhofer
* Author URI: http://open-tools.net * Author URI: http://open-tools.net
* Text Domain: woocommerce-shipping-by-rules * Text Domain: woocommerce-shipping-by-rules
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment