Plugin Directory

Changeset 2947672


Ignore:
Timestamp:
08/04/2023 11:24:07 AM (3 years ago)
Author:
gelatoapi
Message:

Improved site redirection checks and updated status page

Location:
gelato-integration-for-woocommerce/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • gelato-integration-for-woocommerce/trunk/gelato-integration-for-woocommerce.php

    r2947207 r2947672  
    55 * Plugin URI: https://
    66 * Description: This plugin helps to connect your WooCommerce store with Gelato .
    7  * Version: 1.2.0
     7 * Version: 1.2.1
    88 * Author: Gelato
    99 * Author URI: https://gelato.com
     
    1212 */
    1313
    14 define('GELATO_VERSION', '1.2.0');
     14define('GELATO_VERSION', '1.2.1');
    1515define('GELATO_MINIMUM_WP_VERSION', '4.0');
    1616
  • gelato-integration-for-woocommerce/trunk/includes/Pages/GelatoStatusPage.php

    r2771476 r2947672  
    4545            echo "* ";
    4646            echo str_pad(esc_html($result['name']), 30) . '=> ' . esc_html($result['status']) . "\n";
     47        }
     48
     49        echo "\n\n##### Additional Information #####\n";
     50        foreach ($this->get_additional_info() as $name => $value) {
     51            echo "* ";
     52            echo str_pad(esc_html($name), 30) . '=> ' . esc_html($value) . "\n";
    4753        }
    4854
     
    96102            'WC is log folder writable' => (bool) @fopen( WC_LOG_DIR . 'test-log.log', 'a' ), // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged, WordPress.WP.AlternativeFunctions.file_system_read_fopen
    97103        );
     104    }
     105
     106    public function get_additional_info()
     107    {
     108        $siteUrl = get_option('home');
     109        $requestBasic = $this->gelatoStatusChecker->get_basic_redirect_request($siteUrl);
     110        $requestSlashed = $this->gelatoStatusChecker->get_slashed_redirect_request($siteUrl);
     111
     112        $additionalInformation = array();
     113
     114        if(is_wp_error($requestBasic)) {
     115            $additionalInformation['Redirect Site basic error'] = is_wp_error($requestBasic);
     116            $additionalInformation['Redirect Site basic error message'] = $requestBasic->get_error_message();
     117        }
     118
     119        if(is_wp_error($requestSlashed)) {
     120            $additionalInformation['Redirect Site slashed error'] = is_wp_error($requestSlashed);
     121            $additionalInformation['Redirect Site slashed error message'] = $requestSlashed->get_error_message();
     122        }
     123
     124        return $additionalInformation;
    98125    }
    99126
  • gelato-integration-for-woocommerce/trunk/includes/StatusChecker/GelatoStatusChecker.php

    r2916413 r2947672  
    228228    }
    229229
     230    public function get_basic_redirect_request($siteUrl)
     231    {
     232        return wp_remote_head( $siteUrl . '/wp-json/', ['redirection' => 0, 'timeout' => 30]);
     233    }
     234
     235    public function get_slashed_redirect_request($siteUrl)
     236    {
     237        return wp_remote_head( trailingslashit($siteUrl), ['redirection' => 0, 'timeout' => 30]);
     238    }
     239
    230240    private function test_php_memory_limit()
    231241    {
     
    275285    {
    276286        $siteUrl = get_option('home');
    277         $requestBasic = wp_remote_head( $siteUrl . '/wp-json/', ['redirection' => 0]);
    278         $requestSlashed = wp_remote_head( trailingslashit($siteUrl), ['redirection' => 0]);
     287        $requestBasic = $this->get_basic_redirect_request($siteUrl);
     288        $requestSlashed = $this->get_slashed_redirect_request($siteUrl);
    279289
    280290        if (is_wp_error($requestBasic) || is_wp_error($requestSlashed)) {
  • gelato-integration-for-woocommerce/trunk/readme.txt

    r2947207 r2947672  
    88Requires at least: 3.8
    99Tested up to: 6.2
    10 Stable tag: 1.2.0
     10Stable tag: 1.2.1
    1111Requires PHP: 7.0
    1212License: GPLv2 or later
     
    9292= 1.2.0 =
    9393* Fixed issue with duplicate variant ids
     94
     95= 1.2.1 =
     96* Improvements for redirect check and status page
Note: See TracChangeset for help on using the changeset viewer.