Bg process feedback - start send data to heartbeat ( ref. #130 )

This commit is contained in:
Eduardo Humberto 2018-12-06 21:15:06 -02:00
parent 12e8808a41
commit f861202836
2 changed files with 29 additions and 0 deletions

View File

@ -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();
?>

View File

@ -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;
}
}