Plugin Directory


Ignore:
Timestamp:
10/26/2026 02:39:16 AM (3 hours ago)
Author:
gauravtiwari
Message:

Update to version 1.3.6 from GitHub

File:
1 edited

Legend:

Unmodified
Added
Removed
  • gt-performance/trunk/src/Admin/AdminModule.php

    r3750368 r3765447  
    4545use GTPerformance\Redis\ObjectCacheInstaller;
    4646use GTPerformance\XCloud\EdgeOwnership;
     47use GTPerformance\XCloud\EnterprisePurgeHook;
     48use GTPerformance\XCloud\EnterprisePurgeModule;
    4749use GTPerformance\XCloud\SiteService;
    4850
    … …  
    750752                $settings = Settings::all();
    751753                $before   = $settings;
     754                if ( ( new EdgeOwnership() )->enterprisePurgeHookActive() ) {
     755                        $this->redirect( 'gtperf_edge_owner_xcloud_hook', 'cloudflare' );
     756                }
    752757                if ( ( new EdgeOwnership() )->xcloudOwnsEdge() ) {
    753758                        $this->redirect( 'gtperf_edge_owner_conflict', 'cloudflare' );
    … …  
    15661571                        );
    15671572                }
     1573                if ( ( new EdgeOwnership() )->enterprisePurgeHookActive() ) {
     1574                        printf(
     1575                                '<div class="notice notice-info inline"><p>%s</p></div>',
     1576                                esc_html__( 'xCloud Cloudflare Enterprise serves this site: its automatic cache purge plugin is installed. GT Performance purges through xCloud, so this direct Cloudflare integration is paused and makes no API calls. Its settings are kept, and it resumes if the xCloud plugin is removed.', 'gt-performance' )
     1577                        );
     1578                }
    15681579                $this->settingsFormOpen();
    15691580                $this->panelOpen( __( 'Connection', 'gt-performance' ), __( 'A scoped token is safer. Global API Key authentication remains available for legacy accounts.', 'gt-performance' ) );
    … …  
    19621973
    19631974                $this->settingsFormClose();
    1964                 if ( ! empty( $settings['xcloud']['enabled'] ) ) {
     1975                if ( ! empty( $settings['xcloud']['enabled'] ) || ( new EnterprisePurgeHook() )->installed() ) {
    19651976                        $this->renderXcloudStatus( $settings );
    19661977                }
    … …  
    20442055                $purge  = is_array( $purge ) ? $purge : array();
    20452056                $conflict = ( new EdgeOwnership() )->hasDirectCloudflareConflict();
     2057                $hook     = new EnterprisePurgeHook();
     2058                $hookOn   = $hook->available();
     2059                $edge     = get_option( EnterprisePurgeModule::STATUS_OPTION, array() );
     2060                $edge     = is_array( $edge ) ? $edge : array();
     2061                $enterprise = ! empty( $xcloud['enterprise_available'] ) || $hookOn;
     2062                if ( $hookOn ) {
     2063                        $hookState = __( 'Automatic, through xCloud\'s cache purge plugin', 'gt-performance' );
     2064                } elseif ( $hook->installed() ) {
     2065                        $hookState = __( 'xCloud\'s plugin is installed but has no usable purge token', 'gt-performance' );
     2066                } else {
     2067                        $hookState = __( 'Manual: xCloud\'s automatic cache purge is not installed', 'gt-performance' );
     2068                }
     2069                $lastEdge = __( 'Never', 'gt-performance' );
     2070                if ( isset( $edge['created_at'] ) ) {
     2071                        $lastEdge = (string) $edge['created_at'] . ' (' . (string) ( $edge['status'] ?? '' ) . ')';
     2072                        if ( ! empty( $edge['origin_only'] ) ) {
     2073                                $lastEdge .= '; ' . sprintf(
     2074                                        /* translators: %s: number of pages. */
     2075                                        _n( '%s listing page cleared at the origin only', '%s listing pages cleared at the origin only', (int) $edge['origin_only'], 'gt-performance' ),
     2076                                        number_format_i18n( (int) $edge['origin_only'] )
     2077                                );
     2078                        }
     2079                }
    20462080                ?>
    20472081                <section class="gtp-panel">
    … …  
    20492083                                <div>
    20502084                                        <h3><?php esc_html_e( 'xCloud cache status', 'gt-performance' ); ?></h3>
    2051                                         <p><?php esc_html_e( 'Status is refreshed only on request. Enterprise settings and purge remain owned by the xCloud dashboard; GT Performance detects and reports the add-on.', 'gt-performance' ); ?></p>
     2085                                        <p><?php esc_html_e( 'Status is refreshed only on request. Enterprise settings stay in the xCloud dashboard. When xCloud\'s automatic cache purge plugin is installed, GT Performance purges Cloudflare Enterprise through it.', 'gt-performance' ); ?></p>
    20522086                                </div>
    20532087                        </div>
    … …  
    20582092                                <div><dt><?php esc_html_e( 'Redis', 'gt-performance' ); ?></dt><dd><?php echo esc_html( ! empty( $xcloud['redis_enabled'] ) ? __( 'Enabled', 'gt-performance' ) : __( 'Disabled', 'gt-performance' ) ); ?></dd></div>
    20592093                                <div><dt><?php esc_html_e( 'Object Cache Pro', 'gt-performance' ); ?></dt><dd><?php echo esc_html( ! empty( $xcloud['object_cache_pro'] ) ? __( 'Enabled', 'gt-performance' ) : __( 'Disabled', 'gt-performance' ) ); ?></dd></div>
    2060                                 <div><dt><?php esc_html_e( 'Cloudflare Enterprise', 'gt-performance' ); ?></dt><dd><?php echo esc_html( ! empty( $xcloud['enterprise_available'] ) ? __( 'Active through xCloud', 'gt-performance' ) : __( 'Not detected', 'gt-performance' ) ); ?></dd></div>
     2094                                <div><dt><?php esc_html_e( 'Cloudflare Enterprise', 'gt-performance' ); ?></dt><dd><?php echo esc_html( $enterprise ? __( 'Active through xCloud', 'gt-performance' ) : __( 'Not detected', 'gt-performance' ) ); ?></dd></div>
     2095                                <div><dt><?php esc_html_e( 'Enterprise purge', 'gt-performance' ); ?></dt><dd><?php echo esc_html( $hookState ); ?></dd></div>
     2096                                <div><dt><?php esc_html_e( 'Last Enterprise purge', 'gt-performance' ); ?></dt><dd><?php echo esc_html( $lastEdge ); ?></dd></div>
    20612097                                <div><dt><?php esc_html_e( 'Enterprise edge traffic (12h)', 'gt-performance' ); ?></dt><dd><?php echo esc_html( number_format_i18n( (int) ( $xcloud['enterprise_edge_requests'] ?? 0 ) ) . ' / ' . number_format_i18n( (int) ( $xcloud['enterprise_requests'] ?? 0 ) ) . ' (' . number_format_i18n( (float) ( $xcloud['enterprise_hit_percent'] ?? 0 ), 1 ) . '%)' ); ?></dd></div>
    20622098                                <div><dt><?php esc_html_e( 'Free xCloud edge cache', 'gt-performance' ); ?></dt><dd><?php echo esc_html( ! empty( $xcloud['free_edge_cache_enabled'] ) ? __( 'Enabled', 'gt-performance' ) : __( 'Disabled', 'gt-performance' ) ); ?></dd></div>
    … …  
    20642100                                <div><dt><?php esc_html_e( 'Last xCloud purge', 'gt-performance' ); ?></dt><dd><?php echo esc_html( (string) ( $purge['created_at'] ?? __( 'Never', 'gt-performance' ) ) ); ?></dd></div>
    20652101                        </dl>
    2066                         <?php if ( $conflict || ! empty( $xcloud['enterprise_available'] ) ) : ?>
     2102                        <?php if ( $conflict || $enterprise ) : ?>
    20672103                                <div class="gtp-guidance-list">
    20682104                                        <?php if ( $conflict ) : ?>
    … …  
    20722108                                                </div>
    20732109                                        <?php endif; ?>
    2074                                         <?php if ( ! empty( $xcloud['enterprise_available'] ) ) : ?>
     2110                                        <?php if ( $hookOn ) : ?>
     2111                                                <div class="gtp-callout gtp-callout--info" role="note">
     2112                                                        <strong><?php esc_html_e( 'Enterprise purge is automatic', 'gt-performance' ); ?></strong>
     2113                                                        <p><?php esc_html_e( 'Every GT Performance purge also clears Cloudflare Enterprise through xCloud: post saves and their related pages, the Purge button, scheduled purges, and WP-CLI. Direct Cloudflare is paused, because xCloud serves this site from its own Cloudflare zone.', 'gt-performance' ); ?></p>
     2114                                                </div>
     2115                                        <?php endif; ?>
     2116                                        <?php if ( $enterprise && ! $hookOn ) : ?>
    20752117                                                <div class="gtp-callout gtp-callout--warning" role="note">
    20762118                                                        <strong><?php esc_html_e( 'Enterprise purge remains manual', 'gt-performance' ); ?></strong>
    2077                                                         <p><?php esc_html_e( 'Enterprise analytics are available through the API token, but its purge action currently requires an xCloud dashboard session. Automatic Enterprise purge is intentionally disabled until xCloud publishes a token-authenticated endpoint.', 'gt-performance' ); ?></p>
     2119                                                        <p><?php esc_html_e( 'xCloud\'s Public API does not expose an Enterprise purge. Install automatic cache purge from the site\'s Cloudflare Enterprise page in xCloud, and GT Performance will purge through it. Until then, purge from the xCloud dashboard.', 'gt-performance' ); ?></p>
    20782120                                                </div>
     2121                                        <?php endif; ?>
     2122                                        <?php if ( $enterprise ) : ?>
    20792123                                                <div class="gtp-callout gtp-callout--danger" role="note">
    20802124                                                        <strong><?php esc_html_e( 'Keep commerce HTML out of edge cache', 'gt-performance' ); ?></strong>
    … …  
    41194163                        'gtperf_xcloud_json'          => array( __( 'xCloud returned an unreadable response. Try again in a moment.', 'gt-performance' ), 'error' ),
    41204164                        'gtperf_xcloud_api'           => array( __( 'xCloud rejected the request. Check the token scopes and team permissions.', 'gt-performance' ), 'error' ),
    4121                         'gtperf_xcloud_enterprise_purge_unavailable' => array( __( 'Cloudflare Enterprise purge is not available through the xCloud Public API token. Use the Purge control in the xCloud Enterprise dashboard.', 'gt-performance' ), 'warning' ),
     4165                        'gtperf_xcloud_enterprise_purge_unavailable' => array( __( 'Cloudflare Enterprise purge is not available through the xCloud Public API token. Install automatic cache purge from the site\'s Cloudflare Enterprise page in xCloud, or use the Purge control in the xCloud dashboard.', 'gt-performance' ), 'warning' ),
     4166                        'gtperf_edge_owner_xcloud_hook' => array( __( 'xCloud Cloudflare Enterprise serves this site, so direct Cloudflare is paused and no cache rule was synchronized. GT Performance purges through xCloud\'s automatic cache purge plugin instead.', 'gt-performance' ), 'info' ),
    41224167                        'gtperf_edge_owner_conflict'  => array( __( 'xCloud Cloudflare Enterprise is the active owner. Disable it or the direct Cloudflare integration before synchronizing another cache rule.', 'gt-performance' ), 'warning' ),
    41234168                        'xcloud-connected'         => array( __( 'xCloud site, host cache, and Cloudflare Enterprise status refreshed.', 'gt-performance' ), 'success' ),
Note: See TracChangeset for help on using the changeset viewer.