| 1 |
<?php |
| 2 |
/** |
| 3 |
* Divi Batch Process |
| 4 |
* |
| 5 |
* @package CartFlows |
| 6 |
* @since 1.1.1 |
| 7 |
*/ |
| 8 |
|
| 9 |
// Exit if accessed directly. |
| 10 |
if ( ! defined( 'ABSPATH' ) ) { |
| 11 |
exit; |
| 12 |
} |
| 13 |
if ( ! class_exists( 'Cartflows_Importer_Divi_Batch' ) && class_exists( 'WP_Background_Process' ) ) : |
| 14 |
|
| 15 |
/** |
| 16 |
* Image Background Process |
| 17 |
* |
| 18 |
* @since 1.1.1 |
| 19 |
*/ |
| 20 |
class Cartflows_Importer_Divi_Batch extends WP_Background_Process { |
| 21 |
|
| 22 |
/** |
| 23 |
* Image Process |
| 24 |
* |
| 25 |
* @var string |
| 26 |
*/ |
| 27 |
protected $action = 'cartflows_divi_image_process'; |
| 28 |
|
| 29 |
/** |
| 30 |
* Task |
| 31 |
* |
| 32 |
* Override this method to perform any actions required on each |
| 33 |
* queue item. Return the modified item for further processing |
| 34 |
* in the next pass through. Or, return false to remove the |
| 35 |
* item from the queue. |
| 36 |
* |
| 37 |
* @since 1.1.1 |
| 38 |
* |
| 39 |
* @param integer $post_id Post Id. |
| 40 |
* @return mixed |
| 41 |
*/ |
| 42 |
protected function task( $post_id ) { |
| 43 |
|
| 44 |
CartFlows_Importer_Divi::get_instance()->import_single_post( $post_id ); |
| 45 |
|
| 46 |
return false; |
| 47 |
} |
| 48 |
|
| 49 |
/** |
| 50 |
* Complete |
| 51 |
* |
| 52 |
* Override if applicable, but ensure that the below actions are |
| 53 |
* performed, or, call parent::complete(). |
| 54 |
* |
| 55 |
* @since 1.1.1 |
| 56 |
*/ |
| 57 |
protected function complete() { |
| 58 |
|
| 59 |
parent::complete(); |
| 60 |
|
| 61 |
do_action( 'cartflows_import_complete' ); |
| 62 |
|
| 63 |
} |
| 64 |
|
| 65 |
} |
| 66 |
|
| 67 |
endif; |
| 68 |
|