Bg process feedback - start send data to heartbeat ( ref. #130 )
This commit is contained in:
parent
12e8808a41
commit
f861202836
|
@ -162,6 +162,9 @@ $Tainacan_Gutenberg_Block = \Tainacan\GutenbergBlock::get_instance();
|
|||
$Tainacan_Search_Engine = new \Tainacan\Search_Engine();
|
||||
$Tainacan_Elastic_press = new \Tainacan\Elastic_Press();
|
||||
|
||||
require_once(__DIR__ . '/../importer/class-tainacan-bg-importer-heartbeat.php');
|
||||
$Tainacan_Importer_Heartbeat = new \Tainacan\Importer\Background_Importer_Heartbeat();
|
||||
|
||||
$Tainacan_Capabilities = \Tainacan\Capabilities::get_instance();
|
||||
|
||||
?>
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
<?php
|
||||
namespace Tainacan\Importer;
|
||||
use Tainacan;
|
||||
|
||||
class Background_Importer_Heartbeat {
|
||||
|
||||
public function __construct() {
|
||||
add_filter( 'heartbeat_received', array( &$this, 'bg_process_feedback' ), 10, 2 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Receive Heartbeat data and respond.
|
||||
*
|
||||
* Processes data received via a Heartbeat request, and returns additional data to pass back to the front end.
|
||||
*
|
||||
* @param array $response Heartbeat response data to pass back to front end.
|
||||
* @param array $data Data received from the front end (unslashed).
|
||||
*/
|
||||
public function bg_process_feedback( $response, $data ){
|
||||
$response['bg_process_feedback'] = true;
|
||||
|
||||
//TODO: list all bg process
|
||||
|
||||
return $response;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue