@@ -2,115 +2,115 @@ discard block |
||
2 | 2 | |
3 | 3 | class SectionIO extends Object implements Flushable |
4 | 4 | { |
5 | - private static $flush_on_dev_build = true; |
|
6 | - |
|
7 | - private static $sitetree_flush_strategy = 'single'; |
|
8 | - |
|
9 | - private static $api_url = 'https://aperture.section.io/api/v1'; |
|
10 | - private static $account_id = ''; |
|
11 | - private static $application_id = ''; |
|
12 | - private static $environment_name = ''; |
|
13 | - private static $proxy_name = ''; |
|
14 | - private static $username = ''; |
|
15 | - private static $password = ''; |
|
16 | - |
|
17 | - /** |
|
18 | - * Implementation of Flushable::flush() |
|
19 | - * Is triggered on dev/build and ?flush=1. |
|
20 | - */ |
|
21 | - public static function flush() |
|
22 | - { |
|
23 | - if (Config::inst()->get('SectionIO', 'flush_on_dev_build')) { |
|
24 | - return static::flushAll(); |
|
25 | - } |
|
26 | - |
|
27 | - return; |
|
28 | - } |
|
29 | - |
|
30 | - public static function flushAll() |
|
31 | - { |
|
32 | - $exp = 'obj.http.x-url ~ /'; |
|
33 | - |
|
34 | - return static::performFlush($exp); |
|
35 | - } |
|
36 | - |
|
37 | - public static function flushImage($imageID) |
|
38 | - { |
|
39 | - $image = Image::get()->byID($imageID); |
|
40 | - if ($image && $image->exists()) { |
|
41 | - $exp = 'obj.http.x-url ~ "^/'.preg_quote($image->getFilename()).'$"'; // image itself |
|
42 | - $exp .= ' || obj.http.x-url ~ "^/'.preg_quote($image->Parent()->getFilename()) |
|
43 | - .'_resampled/(.*)\-'.preg_quote($image->Name).'$"'; // resampled versions |
|
44 | - return static::performFlush($exp); |
|
45 | - } |
|
46 | - |
|
47 | - return false; |
|
48 | - } |
|
49 | - |
|
50 | - public static function flushFile($fileID) |
|
51 | - { |
|
52 | - $file = File::get()->byID($fileID); |
|
53 | - if ($file && $file->exists()) { |
|
54 | - $exp = 'obj.http.x-url ~ "^/'.preg_quote($file->getFilename()).'$"'; |
|
55 | - return static::performFlush($exp); |
|
56 | - } |
|
57 | - |
|
58 | - return false; |
|
59 | - } |
|
60 | - |
|
61 | - public static function flushSiteTree($sitetreeID) |
|
62 | - { |
|
63 | - $sitetree = SiteTree::get()->byID($sitetreeID); |
|
64 | - if ($sitetree && $sitetree->exists()) { |
|
65 | - $strategy = Config::inst()->get('SectionIO', 'sitetree_flush_strategy'); |
|
66 | - switch ($strategy) { |
|
67 | - |
|
68 | - case 'single': |
|
69 | - $exp = 'obj.http.content-type ~ "'.preg_quote('text/html').'"'; |
|
70 | - $exp .= ' && obj.http.x-url ~ "^'.preg_quote($sitetree->Link()).'$"'; |
|
71 | - break; |
|
72 | - |
|
73 | - case 'parents': |
|
74 | - $exp = 'obj.http.content-type ~ "'.preg_quote('text/html').'"'; |
|
75 | - $exp .= ' && (obj.http.x-url ~ "^'.preg_quote($sitetree->Link()).'$"'; |
|
76 | - $parent = $sitetree->getParent(); |
|
77 | - while ($parent && $parent->exists()) { |
|
78 | - $exp .= ' || obj.http.x-url ~ "^'.preg_quote($parent->Link()).'$"'; |
|
79 | - $parent = $parent->getParent(); |
|
80 | - } |
|
81 | - $exp .= ')'; |
|
82 | - break; |
|
83 | - |
|
84 | - case 'all': |
|
85 | - $exp = 'obj.http.content-type ~ "'.preg_quote('text/html').'"'; |
|
86 | - break; |
|
87 | - |
|
88 | - case 'everyting': |
|
89 | - default: |
|
90 | - $exp = 'obj.http.x-url ~ /'; |
|
91 | - break; |
|
92 | - |
|
93 | - } |
|
94 | - |
|
95 | - return static::performFlush($exp); |
|
96 | - } |
|
97 | - |
|
98 | - return false; |
|
99 | - } |
|
5 | + private static $flush_on_dev_build = true; |
|
6 | + |
|
7 | + private static $sitetree_flush_strategy = 'single'; |
|
8 | + |
|
9 | + private static $api_url = 'https://aperture.section.io/api/v1'; |
|
10 | + private static $account_id = ''; |
|
11 | + private static $application_id = ''; |
|
12 | + private static $environment_name = ''; |
|
13 | + private static $proxy_name = ''; |
|
14 | + private static $username = ''; |
|
15 | + private static $password = ''; |
|
16 | + |
|
17 | + /** |
|
18 | + * Implementation of Flushable::flush() |
|
19 | + * Is triggered on dev/build and ?flush=1. |
|
20 | + */ |
|
21 | + public static function flush() |
|
22 | + { |
|
23 | + if (Config::inst()->get('SectionIO', 'flush_on_dev_build')) { |
|
24 | + return static::flushAll(); |
|
25 | + } |
|
26 | + |
|
27 | + return; |
|
28 | + } |
|
29 | + |
|
30 | + public static function flushAll() |
|
31 | + { |
|
32 | + $exp = 'obj.http.x-url ~ /'; |
|
33 | + |
|
34 | + return static::performFlush($exp); |
|
35 | + } |
|
36 | + |
|
37 | + public static function flushImage($imageID) |
|
38 | + { |
|
39 | + $image = Image::get()->byID($imageID); |
|
40 | + if ($image && $image->exists()) { |
|
41 | + $exp = 'obj.http.x-url ~ "^/'.preg_quote($image->getFilename()).'$"'; // image itself |
|
42 | + $exp .= ' || obj.http.x-url ~ "^/'.preg_quote($image->Parent()->getFilename()) |
|
43 | + .'_resampled/(.*)\-'.preg_quote($image->Name).'$"'; // resampled versions |
|
44 | + return static::performFlush($exp); |
|
45 | + } |
|
46 | + |
|
47 | + return false; |
|
48 | + } |
|
49 | + |
|
50 | + public static function flushFile($fileID) |
|
51 | + { |
|
52 | + $file = File::get()->byID($fileID); |
|
53 | + if ($file && $file->exists()) { |
|
54 | + $exp = 'obj.http.x-url ~ "^/'.preg_quote($file->getFilename()).'$"'; |
|
55 | + return static::performFlush($exp); |
|
56 | + } |
|
57 | + |
|
58 | + return false; |
|
59 | + } |
|
60 | + |
|
61 | + public static function flushSiteTree($sitetreeID) |
|
62 | + { |
|
63 | + $sitetree = SiteTree::get()->byID($sitetreeID); |
|
64 | + if ($sitetree && $sitetree->exists()) { |
|
65 | + $strategy = Config::inst()->get('SectionIO', 'sitetree_flush_strategy'); |
|
66 | + switch ($strategy) { |
|
67 | + |
|
68 | + case 'single': |
|
69 | + $exp = 'obj.http.content-type ~ "'.preg_quote('text/html').'"'; |
|
70 | + $exp .= ' && obj.http.x-url ~ "^'.preg_quote($sitetree->Link()).'$"'; |
|
71 | + break; |
|
72 | + |
|
73 | + case 'parents': |
|
74 | + $exp = 'obj.http.content-type ~ "'.preg_quote('text/html').'"'; |
|
75 | + $exp .= ' && (obj.http.x-url ~ "^'.preg_quote($sitetree->Link()).'$"'; |
|
76 | + $parent = $sitetree->getParent(); |
|
77 | + while ($parent && $parent->exists()) { |
|
78 | + $exp .= ' || obj.http.x-url ~ "^'.preg_quote($parent->Link()).'$"'; |
|
79 | + $parent = $parent->getParent(); |
|
80 | + } |
|
81 | + $exp .= ')'; |
|
82 | + break; |
|
83 | + |
|
84 | + case 'all': |
|
85 | + $exp = 'obj.http.content-type ~ "'.preg_quote('text/html').'"'; |
|
86 | + break; |
|
87 | + |
|
88 | + case 'everyting': |
|
89 | + default: |
|
90 | + $exp = 'obj.http.x-url ~ /'; |
|
91 | + break; |
|
92 | + |
|
93 | + } |
|
94 | + |
|
95 | + return static::performFlush($exp); |
|
96 | + } |
|
97 | + |
|
98 | + return false; |
|
99 | + } |
|
100 | 100 | |
101 | - public static function flushURL($url) { |
|
102 | - if ($url) { |
|
103 | - $exp = 'obj.http.x-url ~ "^'.preg_quote($url).'$"'; |
|
104 | - return static::performFlush($exp); |
|
105 | - } |
|
106 | - return false; |
|
107 | - } |
|
108 | - |
|
109 | - protected static function performFlush($banExpression) |
|
110 | - { |
|
111 | - $success = true; |
|
112 | - $urls = static::getUrls(); |
|
113 | - // config loaded successfully |
|
101 | + public static function flushURL($url) { |
|
102 | + if ($url) { |
|
103 | + $exp = 'obj.http.x-url ~ "^'.preg_quote($url).'$"'; |
|
104 | + return static::performFlush($exp); |
|
105 | + } |
|
106 | + return false; |
|
107 | + } |
|
108 | + |
|
109 | + protected static function performFlush($banExpression) |
|
110 | + { |
|
111 | + $success = true; |
|
112 | + $urls = static::getUrls(); |
|
113 | + // config loaded successfully |
|
114 | 114 | if (static::checkConfig()) { |
115 | 115 | if (count($urls) > 0) { |
116 | 116 | foreach ($urls as $url) { |
@@ -139,137 +139,137 @@ discard block |
||
139 | 139 | } |
140 | 140 | } |
141 | 141 | |
142 | - return $success; |
|
143 | - } |
|
144 | - |
|
145 | - protected static function getService($url, $banExpression) |
|
146 | - { |
|
147 | - // prepare API call |
|
148 | - $service = new RestfulService( |
|
149 | - $url, |
|
150 | - 0 // expiry time 0: do not cache the API call |
|
151 | - ); |
|
152 | - // set basic auth |
|
153 | - $username = Config::inst()->get('SectionIO', 'username'); |
|
154 | - $password = Config::inst()->get('SectionIO', 'password'); |
|
155 | - $service->basicAuth($username, $password); |
|
156 | - // set query string (ban expression) |
|
157 | - $service->setQueryString(array( |
|
158 | - 'banExpression' => $banExpression, |
|
159 | - )); |
|
160 | - |
|
161 | - return $service; |
|
162 | - } |
|
163 | - |
|
164 | - protected static function getOptions() |
|
165 | - { |
|
166 | - // prepare curl options for ssl verification |
|
167 | - $cert = static::getCertificates(); |
|
168 | - $options = array( |
|
169 | - CURLOPT_SSL_VERIFYPEER => 1, |
|
170 | - CURLOPT_SSL_VERIFYHOST => 2, |
|
171 | - CURLOPT_CAINFO => $cert, |
|
172 | - ); |
|
173 | - |
|
174 | - return $options; |
|
175 | - } |
|
176 | - |
|
177 | - protected static function getCertificates() |
|
178 | - { |
|
179 | - $cert = ini_get('curl.cainfo'); |
|
180 | - if (!$cert) { |
|
181 | - $cert = BASE_PATH.'/'.SECTIONIO_BASE.'/cert/cacert.pem'; |
|
182 | - } |
|
183 | - |
|
184 | - return $cert; |
|
185 | - } |
|
186 | - |
|
187 | - protected static function getHeaders() |
|
188 | - { |
|
189 | - $headers = array( |
|
190 | - 'Content-Type: application/json', |
|
191 | - 'Accept: application/json', |
|
192 | - ); |
|
193 | - |
|
194 | - return $headers; |
|
195 | - } |
|
196 | - |
|
197 | - protected static function getUrls() |
|
198 | - { |
|
199 | - $urls = array(); |
|
200 | - |
|
201 | - if (static::checkConfig()) { |
|
202 | - $api_url = Config::inst()->get('SectionIO', 'api_url'); |
|
203 | - $account_id = Config::inst()->get('SectionIO', 'account_id'); |
|
204 | - $application_id = Config::inst()->get('SectionIO', 'application_id'); |
|
205 | - $application_ids = array(); |
|
206 | - if (is_string($application_id)) { |
|
207 | - $application_ids = preg_split("/[\s,]+/", $application_id); |
|
208 | - } elseif (is_array($application_id)) { |
|
209 | - $application_ids = $application_id; |
|
210 | - } |
|
211 | - $environment_name = Config::inst()->get('SectionIO', 'environment_name'); |
|
212 | - $proxy_name = Config::inst()->get('SectionIO', 'proxy_name'); |
|
213 | - |
|
214 | - foreach ($application_ids as $appid) { |
|
215 | - // build API URL: /account/{accountId}/application/{applicationId}/environment/{environmentName}/proxy/{proxyName}/state |
|
216 | - $urls[] = Controller::join_links( |
|
217 | - $api_url, |
|
218 | - 'account', |
|
219 | - $account_id, |
|
220 | - 'application', |
|
221 | - $appid, |
|
222 | - 'environment', |
|
223 | - $environment_name, |
|
224 | - 'proxy', |
|
225 | - $proxy_name, |
|
226 | - 'state' |
|
227 | - ); |
|
228 | - } |
|
229 | - } |
|
230 | - |
|
231 | - return $urls; |
|
232 | - } |
|
233 | - |
|
234 | - protected static function checkConfig() |
|
235 | - { |
|
236 | - $missing = array(); |
|
237 | - // check config |
|
238 | - $api_url = Config::inst()->get('SectionIO', 'api_url'); |
|
239 | - if (!isset($api_url) || strlen($api_url) < 1) { |
|
240 | - $missing[] = 'SectionIO.api_url'; |
|
241 | - } |
|
242 | - $account_id = Config::inst()->get('SectionIO', 'account_id'); |
|
243 | - if (!isset($account_id) || strlen($account_id) < 1) { |
|
244 | - $missing[] = 'SectionIO.account_id'; |
|
245 | - } |
|
246 | - $application_id = Config::inst()->get('SectionIO', 'application_id'); |
|
247 | - if (!isset($application_id) || (!is_array($application_id) && strlen((string) $application_id) < 1)) { |
|
248 | - $missing[] = 'SectionIO.application_id'; |
|
249 | - } |
|
250 | - $environment_name = Config::inst()->get('SectionIO', 'environment_name'); |
|
251 | - if (!isset($environment_name) || strlen($environment_name) < 1) { |
|
252 | - $missing[] = 'SectionIO.environment_name'; |
|
253 | - } |
|
254 | - $proxy_name = Config::inst()->get('SectionIO', 'proxy_name'); |
|
255 | - if (!isset($proxy_name) || strlen($proxy_name) < 1) { |
|
256 | - $missing[] = 'SectionIO.proxy_name'; |
|
257 | - } |
|
258 | - $username = Config::inst()->get('SectionIO', 'username'); |
|
259 | - if (!isset($username) || strlen($username) < 1) { |
|
260 | - $missing[] = 'SectionIO.username'; |
|
261 | - } |
|
262 | - $password = Config::inst()->get('SectionIO', 'password'); |
|
263 | - if (!isset($password) || strlen($password) < 1) { |
|
264 | - $missing[] = 'SectionIO.password'; |
|
265 | - } |
|
142 | + return $success; |
|
143 | + } |
|
144 | + |
|
145 | + protected static function getService($url, $banExpression) |
|
146 | + { |
|
147 | + // prepare API call |
|
148 | + $service = new RestfulService( |
|
149 | + $url, |
|
150 | + 0 // expiry time 0: do not cache the API call |
|
151 | + ); |
|
152 | + // set basic auth |
|
153 | + $username = Config::inst()->get('SectionIO', 'username'); |
|
154 | + $password = Config::inst()->get('SectionIO', 'password'); |
|
155 | + $service->basicAuth($username, $password); |
|
156 | + // set query string (ban expression) |
|
157 | + $service->setQueryString(array( |
|
158 | + 'banExpression' => $banExpression, |
|
159 | + )); |
|
160 | + |
|
161 | + return $service; |
|
162 | + } |
|
163 | + |
|
164 | + protected static function getOptions() |
|
165 | + { |
|
166 | + // prepare curl options for ssl verification |
|
167 | + $cert = static::getCertificates(); |
|
168 | + $options = array( |
|
169 | + CURLOPT_SSL_VERIFYPEER => 1, |
|
170 | + CURLOPT_SSL_VERIFYHOST => 2, |
|
171 | + CURLOPT_CAINFO => $cert, |
|
172 | + ); |
|
173 | + |
|
174 | + return $options; |
|
175 | + } |
|
176 | + |
|
177 | + protected static function getCertificates() |
|
178 | + { |
|
179 | + $cert = ini_get('curl.cainfo'); |
|
180 | + if (!$cert) { |
|
181 | + $cert = BASE_PATH.'/'.SECTIONIO_BASE.'/cert/cacert.pem'; |
|
182 | + } |
|
183 | + |
|
184 | + return $cert; |
|
185 | + } |
|
186 | + |
|
187 | + protected static function getHeaders() |
|
188 | + { |
|
189 | + $headers = array( |
|
190 | + 'Content-Type: application/json', |
|
191 | + 'Accept: application/json', |
|
192 | + ); |
|
193 | + |
|
194 | + return $headers; |
|
195 | + } |
|
196 | + |
|
197 | + protected static function getUrls() |
|
198 | + { |
|
199 | + $urls = array(); |
|
200 | + |
|
201 | + if (static::checkConfig()) { |
|
202 | + $api_url = Config::inst()->get('SectionIO', 'api_url'); |
|
203 | + $account_id = Config::inst()->get('SectionIO', 'account_id'); |
|
204 | + $application_id = Config::inst()->get('SectionIO', 'application_id'); |
|
205 | + $application_ids = array(); |
|
206 | + if (is_string($application_id)) { |
|
207 | + $application_ids = preg_split("/[\s,]+/", $application_id); |
|
208 | + } elseif (is_array($application_id)) { |
|
209 | + $application_ids = $application_id; |
|
210 | + } |
|
211 | + $environment_name = Config::inst()->get('SectionIO', 'environment_name'); |
|
212 | + $proxy_name = Config::inst()->get('SectionIO', 'proxy_name'); |
|
213 | + |
|
214 | + foreach ($application_ids as $appid) { |
|
215 | + // build API URL: /account/{accountId}/application/{applicationId}/environment/{environmentName}/proxy/{proxyName}/state |
|
216 | + $urls[] = Controller::join_links( |
|
217 | + $api_url, |
|
218 | + 'account', |
|
219 | + $account_id, |
|
220 | + 'application', |
|
221 | + $appid, |
|
222 | + 'environment', |
|
223 | + $environment_name, |
|
224 | + 'proxy', |
|
225 | + $proxy_name, |
|
226 | + 'state' |
|
227 | + ); |
|
228 | + } |
|
229 | + } |
|
230 | + |
|
231 | + return $urls; |
|
232 | + } |
|
233 | + |
|
234 | + protected static function checkConfig() |
|
235 | + { |
|
236 | + $missing = array(); |
|
237 | + // check config |
|
238 | + $api_url = Config::inst()->get('SectionIO', 'api_url'); |
|
239 | + if (!isset($api_url) || strlen($api_url) < 1) { |
|
240 | + $missing[] = 'SectionIO.api_url'; |
|
241 | + } |
|
242 | + $account_id = Config::inst()->get('SectionIO', 'account_id'); |
|
243 | + if (!isset($account_id) || strlen($account_id) < 1) { |
|
244 | + $missing[] = 'SectionIO.account_id'; |
|
245 | + } |
|
246 | + $application_id = Config::inst()->get('SectionIO', 'application_id'); |
|
247 | + if (!isset($application_id) || (!is_array($application_id) && strlen((string) $application_id) < 1)) { |
|
248 | + $missing[] = 'SectionIO.application_id'; |
|
249 | + } |
|
250 | + $environment_name = Config::inst()->get('SectionIO', 'environment_name'); |
|
251 | + if (!isset($environment_name) || strlen($environment_name) < 1) { |
|
252 | + $missing[] = 'SectionIO.environment_name'; |
|
253 | + } |
|
254 | + $proxy_name = Config::inst()->get('SectionIO', 'proxy_name'); |
|
255 | + if (!isset($proxy_name) || strlen($proxy_name) < 1) { |
|
256 | + $missing[] = 'SectionIO.proxy_name'; |
|
257 | + } |
|
258 | + $username = Config::inst()->get('SectionIO', 'username'); |
|
259 | + if (!isset($username) || strlen($username) < 1) { |
|
260 | + $missing[] = 'SectionIO.username'; |
|
261 | + } |
|
262 | + $password = Config::inst()->get('SectionIO', 'password'); |
|
263 | + if (!isset($password) || strlen($password) < 1) { |
|
264 | + $missing[] = 'SectionIO.password'; |
|
265 | + } |
|
266 | 266 | |
267 | - if (count($missing) > 0) { |
|
267 | + if (count($missing) > 0) { |
|
268 | 268 | if (!Director::isDev()) { |
269 | 269 | SS_Log::log('SectionIO:: config parameters missing: ' . implode(', ', $missing), SS_Log::WARN); |
270 | 270 | } |
271 | - return false; |
|
272 | - } |
|
273 | - return true; |
|
274 | - } |
|
271 | + return false; |
|
272 | + } |
|
273 | + return true; |
|
274 | + } |
|
275 | 275 | } |
@@ -38,9 +38,9 @@ discard block |
||
38 | 38 | { |
39 | 39 | $image = Image::get()->byID($imageID); |
40 | 40 | if ($image && $image->exists()) { |
41 | - $exp = 'obj.http.x-url ~ "^/'.preg_quote($image->getFilename()).'$"'; // image itself |
|
42 | - $exp .= ' || obj.http.x-url ~ "^/'.preg_quote($image->Parent()->getFilename()) |
|
43 | - .'_resampled/(.*)\-'.preg_quote($image->Name).'$"'; // resampled versions |
|
41 | + $exp = 'obj.http.x-url ~ "^/' . preg_quote($image->getFilename()) . '$"'; // image itself |
|
42 | + $exp .= ' || obj.http.x-url ~ "^/' . preg_quote($image->Parent()->getFilename()) |
|
43 | + .'_resampled/(.*)\-' . preg_quote($image->Name) . '$"'; // resampled versions |
|
44 | 44 | return static::performFlush($exp); |
45 | 45 | } |
46 | 46 | |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | { |
52 | 52 | $file = File::get()->byID($fileID); |
53 | 53 | if ($file && $file->exists()) { |
54 | - $exp = 'obj.http.x-url ~ "^/'.preg_quote($file->getFilename()).'$"'; |
|
54 | + $exp = 'obj.http.x-url ~ "^/' . preg_quote($file->getFilename()) . '$"'; |
|
55 | 55 | return static::performFlush($exp); |
56 | 56 | } |
57 | 57 | |
@@ -66,23 +66,23 @@ discard block |
||
66 | 66 | switch ($strategy) { |
67 | 67 | |
68 | 68 | case 'single': |
69 | - $exp = 'obj.http.content-type ~ "'.preg_quote('text/html').'"'; |
|
70 | - $exp .= ' && obj.http.x-url ~ "^'.preg_quote($sitetree->Link()).'$"'; |
|
69 | + $exp = 'obj.http.content-type ~ "' . preg_quote('text/html') . '"'; |
|
70 | + $exp .= ' && obj.http.x-url ~ "^' . preg_quote($sitetree->Link()) . '$"'; |
|
71 | 71 | break; |
72 | 72 | |
73 | 73 | case 'parents': |
74 | - $exp = 'obj.http.content-type ~ "'.preg_quote('text/html').'"'; |
|
75 | - $exp .= ' && (obj.http.x-url ~ "^'.preg_quote($sitetree->Link()).'$"'; |
|
74 | + $exp = 'obj.http.content-type ~ "' . preg_quote('text/html') . '"'; |
|
75 | + $exp .= ' && (obj.http.x-url ~ "^' . preg_quote($sitetree->Link()) . '$"'; |
|
76 | 76 | $parent = $sitetree->getParent(); |
77 | 77 | while ($parent && $parent->exists()) { |
78 | - $exp .= ' || obj.http.x-url ~ "^'.preg_quote($parent->Link()).'$"'; |
|
78 | + $exp .= ' || obj.http.x-url ~ "^' . preg_quote($parent->Link()) . '$"'; |
|
79 | 79 | $parent = $parent->getParent(); |
80 | 80 | } |
81 | 81 | $exp .= ')'; |
82 | 82 | break; |
83 | 83 | |
84 | 84 | case 'all': |
85 | - $exp = 'obj.http.content-type ~ "'.preg_quote('text/html').'"'; |
|
85 | + $exp = 'obj.http.content-type ~ "' . preg_quote('text/html') . '"'; |
|
86 | 86 | break; |
87 | 87 | |
88 | 88 | case 'everyting': |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | |
101 | 101 | public static function flushURL($url) { |
102 | 102 | if ($url) { |
103 | - $exp = 'obj.http.x-url ~ "^'.preg_quote($url).'$"'; |
|
103 | + $exp = 'obj.http.x-url ~ "^' . preg_quote($url) . '$"'; |
|
104 | 104 | return static::performFlush($exp); |
105 | 105 | } |
106 | 106 | return false; |
@@ -128,10 +128,10 @@ discard block |
||
128 | 128 | $conn = $service->request(null, 'POST', null, $headers, $options); |
129 | 129 | |
130 | 130 | if ($conn->isError()) { |
131 | - SS_Log::log('SectionIO::performFlush :: '.$conn->getStatusCode().' : '.$conn->getStatusDescription().' : '.$url, SS_Log::ERR); |
|
131 | + SS_Log::log('SectionIO::performFlush :: ' . $conn->getStatusCode() . ' : ' . $conn->getStatusDescription() . ' : ' . $url, SS_Log::ERR); |
|
132 | 132 | $success = $success && false; |
133 | 133 | } else { |
134 | - SS_Log::log('SectionIO::performFlush :: ban successful. url: '.$url."; ban expression: '".$banExpression."'", SS_Log::NOTICE); |
|
134 | + SS_Log::log('SectionIO::performFlush :: ban successful. url: ' . $url . "; ban expression: '" . $banExpression . "'", SS_Log::NOTICE); |
|
135 | 135 | } |
136 | 136 | } |
137 | 137 | } else { |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | { |
179 | 179 | $cert = ini_get('curl.cainfo'); |
180 | 180 | if (!$cert) { |
181 | - $cert = BASE_PATH.'/'.SECTIONIO_BASE.'/cert/cacert.pem'; |
|
181 | + $cert = BASE_PATH . '/' . SECTIONIO_BASE . '/cert/cacert.pem'; |
|
182 | 182 | } |
183 | 183 | |
184 | 184 | return $cert; |