PluginProbe
BerqWP – All-In-One Optimization for Core Web Vitals, Cache, CDN, Images, CSS & JavaScript / trunk
BerqWP – All-In-One Optimization for Core Web Vitals, Cache, CDN, Images, CSS & JavaScript vtrunk
4.1.16 4.1.15 4.1.14 4.1.13 4.1.12 4.1.11 4.1.10 4.0.30 4.0.29 4.0.28 4.0.27 4.0.26 4.0.24 4.0.25 4.0.23 4.0.22 4.0.21 4.0.19 4.0.18 4.0.17 4.0.16 1.9.3 1.9.4 1.9.5 1.9.6 All 170 releases
searchpro / BerqWP / vendor-prefixed / src / CDN.php

CDN.php in BerqWP – All-In-One Optimization for Core Web Vitals, Cache, CDN, Images, CSS & JavaScript trunk, at BerqWP/vendor-prefixed/src/CDN.php

42 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace BerqWP;
4
5 use BerqWP_Deps\GuzzleHttp\Exception\RequestException;
6 class CDN
7 {
8 protected $client = null;
9 protected $license_key = null;
10 function __construct($client, $license_key)
11 {
12 $this->client = $client;
13 $this->license_key = $license_key;
14 }
15 function purge_all($domain)
16 {
17 $post_data = ['domain' => $domain, 'license_key' => $this->license_key];
18 try {
19 $response = $this->client->post('cdn/flush', ['form_params' => $post_data]);
20 if ($response->getStatusCode() === 200) {
21 return \true;
22 }
23 } catch (RequestException $e) {
24 } catch (\Throwable $e) {
25 }
26 return \false;
27 }
28 function stale_assets($domain)
29 {
30 $post_data = ['domain' => $domain, 'license_key' => $this->license_key];
31 try {
32 $response = $this->client->post('cdn/stale-assets', ['form_params' => $post_data]);
33 if ($response->getStatusCode() === 200) {
34 return \true;
35 }
36 } catch (RequestException $e) {
37 } catch (\Throwable $e) {
38 }
39 return \false;
40 }
41 }
42