Plugin Directory

Changeset 3284088


Ignore:
Timestamp:
04/29/2025 12:19:47 PM (11 months ago)
Author:
emplibot
Message:

further enhanced blog processing

Location:
emplibot/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • emplibot/trunk/emplibot.php

    r3283317 r3284088  
    33 * Plugin Name:       Emplibot
    44 * Description:       Automated keyword research, automated blogging, with internal and external links, engaging infographics, unique featured images, and more.
    5  * Version:           1.0.7
     5 * Version:           1.0.8
    66 * Requires at least: 6.4
    77 * Requires PHP:      7.2
  • emplibot/trunk/includes/rest-api.php

    r3283317 r3284088  
    375375 *
    376376 * @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.
    378378 */
    379379function emplibot_process_zip_upload(WP_REST_Request $request) {
     
    393393    emplibot_insert_hash($request_hash);
    394394   
    395     // Create response object
    396     $response = new WP_REST_Response(array('status' => 'success'), 200);
    397    
    398     // Send the response to the client but continue processing
    399     if (!headers_sent()) {
    400         header('Content-Type: application/json');
    401         status_header(200);
    402         echo json_encode($response->get_data());
    403        
    404         // Flush output buffers
    405         if (function_exists('fastcgi_finish_request')) {
    406             fastcgi_finish_request();
    407         } else {
    408             // Fallback for non-FastCGI environments
    409             @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();
    412412    }
    413413   
     
    418418    set_time_limit(1800);
    419419   
    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
    421424    emplibot_process_zip_data($json_data, $request_hash);
    422425   
    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;
    426431}
    427432
  • emplibot/trunk/readme.txt

    r3283317 r3284088  
    44Requires at least: 6.4
    55Tested up to: 6.8
    6 Stable tag: 1.0.7
     6Stable tag: 1.0.8
    77Requires PHP: 7.1
    88License: GPLv3 or later
     
    5656= 1.0.7 =
    5757* Enhanced blogpost processing.
     58
     59= 1.0.8 =
     60* Enhanced blogpost processing.
Note: See TracChangeset for help on using the changeset viewer.