Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
100 changes: 50 additions & 50 deletions includes/fbbackground.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,22 @@
*/
class WC_Facebookcommerce_Background_Process extends WP_Background_Process {

/**
* @var WC_Facebookcommerce_Integration instance.
*/
private $commerce;
/**
* @var WC_Facebookcommerce_Integration instance.
*/
private $commerce;

public function __construct( $commerce ) {
$this->commerce = $commerce; // Full WC_Facebookcommerce_Integration obj
}

/**
* __get method for backward compatibility.
*
* @param string $key property name
* @return mixed
* @since 3.0.32
*/
/**
* __get method for backward compatibility.
*
* @param string $key property name
* @return mixed
* @since 3.0.32
*/
public function __get( $key ) {
// Add warning for private properties.
if ( 'commerce' === $key ) {
Expand All @@ -49,10 +49,10 @@ public function __get( $key ) {
return null;
}

/**
* @var string
*/
protected $action = 'fb_commerce_background_process';
/**
* @var string
*/
protected $action = 'fb_commerce_background_process';

public function dispatch() {
$commerce = $this->commerce;
Expand All @@ -73,12 +73,12 @@ public function get_item_count() {
return (int) get_transient( $commerce::FB_SYNC_REMAINING );
}

/**
* Handle cron healthcheck
*
* Restart the background process if not already running
* and data exists in the queue.
*/
/**
* Handle cron healthcheck
*
* Restart the background process if not already running
* and data exists in the queue.
*/
public function handle_cron_healthcheck() {
$commerce = $this->commerce;
if ( $this->is_process_running() ) {
Expand All @@ -97,9 +97,9 @@ public function handle_cron_healthcheck() {
return true;
}

/**
* Schedule fallback event.
*/
/**
* Schedule fallback event.
*/
protected function schedule_event() {
if ( ! wp_next_scheduled( $this->cron_hook_identifier ) ) {
wp_schedule_event(
Expand All @@ -110,34 +110,34 @@ protected function schedule_event() {
}
}

/**
* Is the processor updating?
*
* @return boolean
*/
/**
* Is the processor updating?
*
* @return boolean
*/
public function is_updating() {
return false === $this->is_queue_empty();
}

/**
* Is the processor running?
*
* @return boolean
*/
/**
* Is the processor running?
*
* @return boolean
*/
public function is_running() {
return $this->is_process_running();
}

/**
* Process individual product
*
* Returns false to remove the item from the queue
* (would return item if it needed additional processing).
*
* @param mixed $item Queue item to iterate over
*
* @return mixed
*/
/**
* Process individual product
*
* Returns false to remove the item from the queue
* (would return item if it needed additional processing).
*
* @param mixed $item Queue item to iterate over
*
* @return mixed
*/
protected function task( $item ) {
$commerce = $this->commerce; // PHP5 compatibility for static access
$remaining = $this->get_item_count();
Expand All @@ -163,12 +163,12 @@ protected function task( $item ) {
return false;
}

/**
* Complete
*
* Override if applicable, but ensure that the below actions are
* performed, or, call parent::complete().
*/
/**
* Complete
*
* Override if applicable, but ensure that the below actions are
* performed, or, call parent::complete().
*/
protected function complete() {
$commerce = $this->commerce; // PHP5 compatibility for static access
delete_transient( $commerce::FB_SYNC_IN_PROGRESS );
Expand Down