Example #1
0
 public static function bgworker()
 {
     if (!defined('MW_NO_SESSION')) {
         define('MW_NO_SESSION', 1);
     }
     $url = site_url();
     //header("Location: " . $url);
     // redirect the url to the 'busy importing' page
     ob_end_clean();
     //Erase the output buffer
     header('Connection: close');
     //Tell the browser that the connection's closed
     ignore_user_abort(true);
     //Ignore the user's abort (which we caused with the redirect).
     set_time_limit(0);
     //Extend time limit
     ob_start();
     //Start output buffering again
     header('Content-Length: 0');
     //Tell the browser we're serious... there's really nothing else to receive from this page.
     ob_end_flush();
     //Send the output buffer and turn output buffering off.
     flush();
     //Yes... flush again.
     //session_write_close();
     //$back_log_action = "Creating full backup";
     //self::log_bg_action($back_log_action);
     if (!defined('MW_BACKUP_BG_WORKER_STARTED')) {
         define('MW_BACKUP_BG_WORKER_STARTED', 1);
         $backup_api = new \Microweber\Utils\Backup();
         $backup_api->exec_create_full();
         unset($backup_api);
     } else {
     }
     //  exit();
 }