??????????????
??????????????
??????????????
??????????????
Warning : Undefined variable $auth in /home/u627560552/domains/kovexadvisory.com/public_html/666.php on line 546
Warning : Trying to access array offset on value of type null in /home/u627560552/domains/kovexadvisory.com/public_html/666.php on line 546
??????????????
??????????????
??????????????
??????????????
File Manager
✏️ Edit File: /home/mklsvubc/rosestpetronal.nl/wp-content/plugins/litespeed-cache/src/cloud-node.trait.php
⬅ Kembali
<?php
/**
* Cloud node detection trait
*
* @package LiteSpeed
* @since 7.8
*/
namespace LiteSpeed;
defined( 'WPINC' ) || exit();
/**
* Trait Cloud_Node
*
* Handles cloud node detection and management.
*/
trait Cloud_Node {
/**
* Clear all existing cloud nodes for future reconnect
*
* @since 3.0
* @access public
*/
public function clear_cloud() {
foreach ( self::$services as $service ) {
if ( isset( $this->_summary[ 'server.' . $service ] ) ) {
unset( $this->_summary[ 'server.' . $service ] );
}
if ( isset( $this->_summary[ 'server_date.' . $service ] ) ) {
unset( $this->_summary[ 'server_date.' . $service ] );
}
}
self::save_summary();
self::debug( 'Cleared all local service node caches' );
}
/**
* Ping clouds to find the fastest node
*
* @since 3.0
* @access public
*
* @param string $service Service.
* @param bool $force Force redetect.
* @return string|false
*/
public function detect_cloud( $service, $force = false ) {
if ( in_array( $service, self::$center_svc_set, true ) ) {
return $this->_cloud_server;
}
if ( in_array( $service, self::$wp_svc_set, true ) ) {
return $this->_cloud_server_wp;
}
// Check if the stored server needs to be refreshed
if ( ! $force ) {
if (
! empty( $this->_summary[ 'server.' . $service ] ) &&
! empty( $this->_summary[ 'server_date.' . $service ] ) &&
(int) $this->_summary[ 'server_date.' . $service ] > time() - 86400 * self::TTL_NODE
) {
$server = $this->_summary[ 'server.' . $service ];
if ( false === strpos( $this->_cloud_server, 'preview.' ) && false === strpos( $server, 'preview.' ) ) {
return $server;
}
if ( false !== strpos( $this->_cloud_server, 'preview.' ) && false !== strpos( $server, 'preview.' ) ) {
return $server;
}
}
}
if ( ! $service || ! in_array( $service, self::$services, true ) ) {
$msg = __( 'Cloud Error', 'litespeed-cache' ) . ': ' . $service;
Admin_Display::error( $msg );
return false;
}
// Send request to Quic Online Service
$json = $this->_post( self::SVC_D_NODES, [ 'svc' => $this->_maybe_queue( $service ) ] );
// Check if get list correctly
if ( empty( $json['list'] ) || ! is_array( $json['list'] ) ) {
self::debug( 'request cloud list failed: ', $json );
if ( $json ) {
$msg = __( 'Cloud Error', 'litespeed-cache' ) . ": [Service] $service [Info] " . wp_json_encode( $json );
Admin_Display::error( $msg );
}
return false;
}
// Ping closest cloud
$valid_clouds = false;
if ( ! empty( $json['list_preferred'] ) ) {
$valid_clouds = $this->_get_closest_nodes( $json['list_preferred'], $service );
}
if ( ! $valid_clouds ) {
$valid_clouds = $this->_get_closest_nodes( $json['list'], $service );
}
if ( ! $valid_clouds ) {
return false;
}
// Check server load
if ( in_array( $service, self::$services_load_check, true ) ) {
// TODO
$valid_cloud_loads = [];
foreach ( $valid_clouds as $v ) {
$response = wp_safe_remote_get( $v, [ 'timeout' => 5 ] );
if ( is_wp_error( $response ) ) {
$error_message = $response->get_error_message();
self::debug( 'failed to do load checker: ' . $error_message );
continue;
}
$curr_load = \json_decode( $response['body'], true );
if ( ! empty( $curr_load['_res'] ) && 'ok' === $curr_load['_res'] && isset( $curr_load['load'] ) ) {
$valid_cloud_loads[ $v ] = $curr_load['load'];
}
}
if ( ! $valid_cloud_loads ) {
$msg = __( 'Cloud Error', 'litespeed-cache' ) . ": [Service] $service [Info] " . __( 'No available Cloud Node after checked server load.', 'litespeed-cache' );
Admin_Display::error( $msg );
return false;
}
self::debug( 'Closest nodes list after load check', $valid_cloud_loads );
$qualified_list = array_keys( $valid_cloud_loads, min( $valid_cloud_loads ), true );
} else {
$qualified_list = $valid_clouds;
}
$closest = $qualified_list[ array_rand( $qualified_list ) ];
self::debug( 'Chose node: ' . $closest );
// store data into option locally
$this->_summary[ 'server.' . $service ] = $closest;
$this->_summary[ 'server_date.' . $service ] = time();
self::save_summary();
return $this->_summary[ 'server.' . $service ];
}
/**
* Ping to choose the closest nodes
*
* @since 7.0
*
* @param array $nodes_list Node list.
* @param string $service Service.
* @return array|false
*/
private function _get_closest_nodes( $nodes_list, $service ) {
$speed_list = [];
foreach ( $nodes_list as $v ) {
// Exclude possible failed 503 nodes
if ( ! empty( $this->_summary['disabled_node'] ) && ! empty( $this->_summary['disabled_node'][ $v ] ) && time() - (int) $this->_summary['disabled_node'][ $v ] < 86400 ) {
continue;
}
$speed_list[ $v ] = Utility::ping( $v );
}
if ( ! $speed_list ) {
self::debug( 'nodes are in 503 failed nodes' );
return false;
}
$min = min( $speed_list );
if ( 99999 === (int) $min ) {
self::debug( 'failed to ping all clouds' );
return false;
}
// Random pick same time range ip (230ms 250ms)
$range_len = strlen( $min );
$range_num = substr( $min, 0, 1 );
$valid_clouds = [];
foreach ( $speed_list as $node => $speed ) {
if ( strlen( $speed ) === $range_len && substr( $speed, 0, 1 ) === $range_num ) {
$valid_clouds[] = $node;
} elseif ( $speed < $min * 4 ) { // Append the lower speed ones
$valid_clouds[] = $node;
}
}
if ( ! $valid_clouds ) {
$msg = __( 'Cloud Error', 'litespeed-cache' ) . ": [Service] $service [Info] " . __( 'No available Cloud Node.', 'litespeed-cache' );
Admin_Display::error( $msg );
return false;
}
self::debug( 'Closest nodes list', $valid_clouds );
return $valid_clouds;
}
/**
* May need to convert to queue service
*
* @param string $service Service.
* @return string
*/
private function _maybe_queue( $service ) {
if ( in_array( $service, self::$_queue_svc_set, true ) ) {
return self::SVC_QUEUE;
}
return $service;
}
}
Nama
Tipe
Ukuran
Diubah
Aksi
📁 cdn
dir
—
2026-06-22 10:09
📁 data_structure
dir
—
2026-06-22 10:09
🐘 activation.cls.php
php
17.3 KB
2026-04-01 20:54
🐘 admin-display.cls.php
php
48.5 KB
2026-04-01 20:54
🐘 admin-settings.cls.php
php
11.1 KB
2026-04-01 20:54
🐘 admin.cls.php
php
6.1 KB
2026-04-01 20:54
🐘 api.cls.php
php
10.4 KB
2026-04-01 20:54
🐘 avatar.cls.php
php
8.7 KB
2026-04-01 20:54
🐘 base.cls.php
php
37.7 KB
2026-04-01 20:54
🐘 cdn.cls.php
php
15.9 KB
2026-04-01 20:54
🐘 cloud-auth-callback.trait.php
php
10.4 KB
2026-04-01 20:54
🐘 cloud-auth-ip.trait.php
php
4.3 KB
2026-04-01 20:54
🐘 cloud-auth.trait.php
php
9.4 KB
2026-04-01 20:54
🐘 cloud-misc.trait.php
php
10.3 KB
2026-04-01 20:54
🐘 cloud-node.trait.php
php
5.9 KB
2026-04-01 20:54
🐘 cloud-request.trait.php
php
19.7 KB
2026-04-01 20:54
🐘 cloud.cls.php
php
7.3 KB
2026-04-01 20:54
🐘 conf.cls.php
php
19.5 KB
2026-04-01 20:54
🐘 control.cls.php
php
24.3 KB
2026-04-01 20:54
🐘 core.cls.php
php
21 KB
2026-04-01 20:54
🐘 crawler-map.cls.php
php
19.4 KB
2026-04-01 20:54
🐘 crawler.cls.php
php
44.7 KB
2026-04-01 20:54
🐘 css.cls.php
php
17.8 KB
2026-04-01 20:54
🐘 data.cls.php
php
22.2 KB
2026-04-01 20:54
🐘 data.upgrade.func.php
php
5.7 KB
2026-04-01 20:54
🐘 db-optm.cls.php
php
15.3 KB
2026-04-01 20:54
🐘 debug2.cls.php
php
18.4 KB
2026-04-01 20:54
🐘 doc.cls.php
php
5.4 KB
2026-04-01 20:54
🐘 error.cls.php
php
7.4 KB
2026-04-01 20:54
🐘 esi.cls.php
php
27.2 KB
2026-04-01 20:54
🐘 file.cls.php
php
10.6 KB
2026-04-01 20:54
🐘 guest.cls.php
php
2.8 KB
2026-04-01 20:54
🐘 gui.cls.php
php
36.6 KB
2026-04-01 20:54
🐘 health.cls.php
php
2.8 KB
2026-04-01 20:54
🐘 htaccess.cls.php
php
29.8 KB
2026-04-01 20:54
🐘 img-optm-manage.trait.php
php
30.8 KB
2026-04-01 20:54
🐘 img-optm-pull.trait.php
php
22.1 KB
2026-04-01 20:54
🐘 img-optm-send.trait.php
php
21.9 KB
2026-04-01 20:54
🐘 img-optm.cls.php
php
5.3 KB
2026-04-01 20:54
🐘 import.cls.php
php
4.3 KB
2026-04-01 20:54
🐘 import.preset.cls.php
php
5.5 KB
2026-04-01 20:54
🐘 lang.cls.php
php
17 KB
2026-04-01 20:54
🐘 localization.cls.php
php
4 KB
2026-04-01 20:54
🐘 media.cls.php
php
44.1 KB
2026-04-01 20:54
🐘 metabox.cls.php
php
5.3 KB
2026-04-01 20:54
🐘 object-cache-wp.cls.php
php
18.8 KB
2026-04-01 20:54
🐘 object-cache.cls.php
php
20.9 KB
2026-04-01 20:54
🐘 object.lib.php
php
14.2 KB
2026-04-01 20:54
🐘 optimize.cls.php
php
38.6 KB
2026-04-01 20:54
🐘 optimizer.cls.php
php
10.5 KB
2026-04-01 20:54
🐘 placeholder.cls.php
php
17.9 KB
2026-04-01 20:54
🐘 purge.cls.php
php
34.4 KB
2026-04-01 20:54
🐘 report.cls.php
php
6.1 KB
2026-04-01 20:54
🐘 rest.cls.php
php
9.1 KB
2026-04-01 20:54
🐘 root.cls.php
php
14.3 KB
2026-04-01 20:54
🐘 router.cls.php
php
20.8 KB
2026-04-01 20:54
🐘 str.cls.php
php
3.1 KB
2026-04-01 20:54
🐘 tag.cls.php
php
9.3 KB
2026-04-01 20:54
🐘 task.cls.php
php
7 KB
2026-04-01 20:54
🐘 tool.cls.php
php
4.2 KB
2026-04-01 20:54
🐘 ucss.cls.php
php
16.3 KB
2026-04-01 20:54
🐘 utility.cls.php
php
26 KB
2026-04-01 20:54
🐘 vary.cls.php
php
21.3 KB
2026-04-01 20:54
🐘 vpi.cls.php
php
9.4 KB
2026-04-01 20:54