Changeset 3284088
- Timestamp:
- 04/29/2025 12:19:47 PM (11 months ago)
- Location:
- emplibot/trunk
- Files:
-
- 3 edited
-
emplibot.php (modified) (1 diff)
-
includes/rest-api.php (modified) (3 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
emplibot/trunk/emplibot.php
r3283317 r3284088 3 3 * Plugin Name: Emplibot 4 4 * Description: Automated keyword research, automated blogging, with internal and external links, engaging infographics, unique featured images, and more. 5 * Version: 1.0. 75 * Version: 1.0.8 6 6 * Requires at least: 6.4 7 7 * Requires PHP: 7.2 -
emplibot/trunk/includes/rest-api.php
r3283317 r3284088 375 375 * 376 376 * @param WP_REST_Request $request The request object. 377 * @return WP_REST_Response The response containing the result of the operation.377 * @return void This function sends a response and exits directly. 378 378 */ 379 379 function emplibot_process_zip_upload(WP_REST_Request $request) { … … 393 393 emplibot_insert_hash($request_hash); 394 394 395 // Create response object396 $response = new WP_REST_Response(array('status' => 'success'), 200);397 398 // Send the response to the client but continue processing399 if (!headers_sent()) {400 header('Content-Type: application/json');401 status_header(200);402 echo json_encode($response->get_data());403 404 // Flush output buffers405 if (function_exists('fastcgi_finish_request')) {406 fastcgi_finish_request();407 } else {408 // Fallback for non-FastCGI environments409 @ob_end_flush();410 flush();411 }395 // Store the data we need for background processing 396 update_option('emplibot_zip_processing_' . $request_hash, $post_body, false); 397 398 // Send headers manually 399 header('Content-Type: application/json'); 400 status_header(200); 401 echo json_encode(array('status' => 'success')); 402 403 // Flush output buffers and end the connection to the client 404 if (function_exists('fastcgi_finish_request')) { 405 fastcgi_finish_request(); 406 } else { 407 // Fallback for non-FastCGI environments 408 while (ob_get_level()) { 409 ob_end_flush(); 410 } 411 flush(); 412 412 } 413 413 … … 418 418 set_time_limit(1800); 419 419 420 // Process the ZIP data directly instead of using WordPress cron 420 // Log the start of processing 421 error_log('Emplibot: Starting ZIP processing for hash: ' . $request_hash); 422 423 // Process the ZIP data directly 421 424 emplibot_process_zip_data($json_data, $request_hash); 422 425 423 // This part will only execute in non-FastCGI environments 424 // We still need to return a response object for WordPress 425 return $response; 426 // Clean up the stored data 427 delete_option('emplibot_zip_processing_' . $request_hash); 428 429 // Important: exit to prevent WordPress from trying to send another response 430 exit; 426 431 } 427 432 -
emplibot/trunk/readme.txt
r3283317 r3284088 4 4 Requires at least: 6.4 5 5 Tested up to: 6.8 6 Stable tag: 1.0. 76 Stable tag: 1.0.8 7 7 Requires PHP: 7.1 8 8 License: GPLv3 or later … … 56 56 = 1.0.7 = 57 57 * Enhanced blogpost processing. 58 59 = 1.0.8 = 60 * Enhanced blogpost processing.
Note: See TracChangeset
for help on using the changeset viewer.