Changeset 2689658
- Timestamp:
- 03/06/2022 08:45:35 PM (4 years ago)
- Location:
- quant
- Files:
-
- 49 added
- 4 edited
-
tags/1.3.2 (added)
-
tags/1.3.2/quant-cli.php (added)
-
tags/1.3.2/quant.php (added)
-
tags/1.3.2/readme.txt (added)
-
tags/1.3.2/src (added)
-
tags/1.3.2/src/App.php (added)
-
tags/1.3.2/src/Client.php (added)
-
tags/1.3.2/src/Field.php (added)
-
tags/1.3.2/src/Settings.php (added)
-
tags/1.3.2/src/SettingsScreen.php (added)
-
tags/1.3.2/src/functions.php (added)
-
tags/1.3.2/src/seed (added)
-
tags/1.3.2/src/seed/ArchivesBatch.php (added)
-
tags/1.3.2/src/seed/CategoryBatch.php (added)
-
tags/1.3.2/src/seed/CustomCronRoutesBatch.php (added)
-
tags/1.3.2/src/seed/CustomPostTypes.php (added)
-
tags/1.3.2/src/seed/CustomRoutesBatch.php (added)
-
tags/1.3.2/src/seed/CustomTaxonomies.php (added)
-
tags/1.3.2/src/seed/HomeBatch.php (added)
-
tags/1.3.2/src/seed/MediaAssetsBatch.php (added)
-
tags/1.3.2/src/seed/PageBatch.php (added)
-
tags/1.3.2/src/seed/PostBatch.php (added)
-
tags/1.3.2/src/seed/TagBatch.php (added)
-
tags/1.3.2/src/seed/ThemeAssetsBatch.php (added)
-
tags/1.3.2/templates (added)
-
tags/1.3.2/templates/quant-validate.php (added)
-
tags/1.3.2/uninstall.php (added)
-
tags/1.3.2/wp-batch-processing (added)
-
tags/1.3.2/wp-batch-processing/README.md (added)
-
tags/1.3.2/wp-batch-processing/assets (added)
-
tags/1.3.2/wp-batch-processing/assets/processor.js (added)
-
tags/1.3.2/wp-batch-processing/changelog.txt (added)
-
tags/1.3.2/wp-batch-processing/examples (added)
-
tags/1.3.2/wp-batch-processing/examples/class-example-batch.php (added)
-
tags/1.3.2/wp-batch-processing/examples/processing.gif (added)
-
tags/1.3.2/wp-batch-processing/includes (added)
-
tags/1.3.2/wp-batch-processing/includes/class-batch-ajax-handler.php (added)
-
tags/1.3.2/wp-batch-processing/includes/class-batch-item.php (added)
-
tags/1.3.2/wp-batch-processing/includes/class-batch-list-table.php (added)
-
tags/1.3.2/wp-batch-processing/includes/class-batch-processor-admin.php (added)
-
tags/1.3.2/wp-batch-processing/includes/class-batch-processor.php (added)
-
tags/1.3.2/wp-batch-processing/includes/class-batch.php (added)
-
tags/1.3.2/wp-batch-processing/includes/class-bp-helper.php (added)
-
tags/1.3.2/wp-batch-processing/includes/class-bp-singleton.php (added)
-
tags/1.3.2/wp-batch-processing/views (added)
-
tags/1.3.2/wp-batch-processing/views/batch-list.php (added)
-
tags/1.3.2/wp-batch-processing/views/batch-manage.php (added)
-
tags/1.3.2/wp-batch-processing/views/batch-view.php (added)
-
tags/1.3.2/wp-batch-processing/wp-batch-processing.php (added)
-
trunk/quant.php (modified) (1 diff)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/src/Client.php (modified) (15 diffs)
-
trunk/src/Settings.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
quant/trunk/quant.php
r2689403 r2689658 6 6 * Author: Stuart Rowlands 7 7 * Plugin URI: https://www.quantcdn.io 8 * Version: 1.3. 18 * Version: 1.3.2 9 9 * License: GPL-2.0+ 10 10 * License URI: http://www.gnu.org/licenses/gpl-2.0.txt -
quant/trunk/readme.txt
r2689404 r2689658 6 6 Tested up to: 5.9.1 7 7 Requires PHP: 7.1 8 Stable tag: 1.3. 18 Stable tag: 1.3.2 9 9 License: GPLv2 or later 10 10 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 56 56 == Changelog == 57 57 58 = 1.3.2 = 59 * Improved multisite support: Quant Search (filter content by site) 60 * Multisite bugfix: Resolved some media assets not seeding correctly 61 * Added configurable HTTP timeout value 62 58 63 = 1.3.1 = 59 64 * Adds option to disable SSL verification if required. -
quant/trunk/src/Client.php
r2689403 r2689658 15 15 private $host; 16 16 private $disableTlsVerify = FALSE; 17 private $httpRequestTimeout = 15; 17 18 18 19 public function __construct() { … … 27 28 $this->headers['quant-token'] = $this->settings['api_token']; 28 29 $this->disableTlsVerify = $this->settings['disable_tls_verify']; 30 $this->httpRequestTimeout = intval($this->settings['http_request_timeout']) ?? 15; 29 31 } 30 32 … … 34 36 $args = [ 35 37 'headers' => $this->headers, 38 'timeout' => $this->httpRequestTimeout, 36 39 ]; 37 40 … … 56 59 $args = [ 57 60 'headers' => $headers, 58 'method' => 'PATCH' 61 'method' => 'PATCH', 62 'timeout' => $this->httpRequestTimeout, 59 63 ]; 60 64 … … 79 83 'headers' => $this->headers, 80 84 'body' => json_encode($data), 81 'timeout' => 30,85 'timeout' => $this->httpRequestTimeout, 82 86 ]; 83 87 … … 109 113 'headers' => $this->headers, 110 114 'body' => json_encode($data), 111 'timeout' => 30,115 'timeout' => $this->httpRequestTimeout, 112 116 ]; 113 117 … … 137 141 $args = [ 138 142 'headers' => $headers, 139 'timeout' => 30,143 'timeout' => $this->httpRequestTimeout, 140 144 ]; 141 145 … … 156 160 */ 157 161 public function sendAttachments($media) { 162 163 // Determine current site (multisite installs). 164 if (is_multisite()) { 165 $site = get_site(); 166 } 167 158 168 $attachments = []; 159 169 … … 167 177 168 178 // Strip query params. 169 $file = strtok($url, '?'); 179 $file = $url = strtok($url, '?'); 180 181 // Strip the site path from the front of the URL. 182 if (isset($site->path)) { 183 $file = preg_replace("#^{$site->path}#", '/', $file); 184 } 170 185 171 186 if (isset($item['existing_md5'])) { … … 177 192 178 193 if (file_exists(ABSPATH . $file)) { 179 $attachments[] = $file; 194 $attachments[] = [ 195 'file' => $file, 196 'url' => $url, 197 ]; 180 198 } 181 199 } … … 199 217 200 218 foreach ($files as $file) { 201 $headers['Quant-File-Url'] = $file ;202 $path = ABSPATH . $file ;219 $headers['Quant-File-Url'] = $file['url']; 220 $path = ABSPATH . $file['file']; 203 221 204 222 $requests[] = [ … … 207 225 'headers' => $headers, 208 226 'sslverify' => $this->disableTlsVerify ? FALSE : TRUE, 227 'timeout' => $this->httpRequestTimeout, 209 228 ]; 210 229 } … … 284 303 'headers' => [ 285 304 'content-type' => $content_type, 286 ] 305 ], 287 306 ]; 288 307 … … 352 371 'tags' => [], 353 372 'categories' => wp_get_post_categories($id, ['fields' => 'names']), 373 'site_id' => get_current_blog_id(), 354 374 ] 355 375 ] … … 388 408 'Quant-Token' => $token, 389 409 ], 410 'timeout' => $this->httpRequestTimeout, 390 411 ]; 391 412 -
quant/trunk/src/Settings.php
r2689403 r2689658 49 49 'description' => 'Optionally disable TLS verification.', 50 50 'value' => $options['disable_tls_verify'] ?? 0, 51 ]); 52 53 add_settings_field('quant_http_request_timeout', 'HTTP request timeout', ['Quant\Field', 'text'], $key, 'general', [ 54 'name' => "{$key}[http_request_timeout]", 55 'description' => 'Optionally increase the HTTP request timeout on slower servers.', 56 'value' => $options['http_request_timeout'] ?? 15, 51 57 ]); 52 58
Note: See TracChangeset
for help on using the changeset viewer.