ActionScheduler_HybridStore::action_counts
Get a count of all actions in the store, grouped by status
Method of the class: ActionScheduler_HybridStore{}
No Hooks.
Returns
Array. Set of 'status' => int $count pairs for statuses with 1 or more actions of that status.
Usage
$ActionScheduler_HybridStore = new ActionScheduler_HybridStore(); $ActionScheduler_HybridStore->action_counts();
ActionScheduler_HybridStore::action_counts() ActionScheduler HybridStore::action counts code WC 10.9.4
public function action_counts() {
$unmigrated_actions_count = $this->secondary_store->action_counts();
$migrated_actions_count = $this->primary_store->action_counts();
$actions_count_by_status = array();
foreach ( $this->get_status_labels() as $status_key => $status_label ) {
$count = 0;
if ( isset( $unmigrated_actions_count[ $status_key ] ) ) {
$count += $unmigrated_actions_count[ $status_key ];
}
if ( isset( $migrated_actions_count[ $status_key ] ) ) {
$count += $migrated_actions_count[ $status_key ];
}
$actions_count_by_status[ $status_key ] = $count;
}
$actions_count_by_status = array_filter( $actions_count_by_status );
return $actions_count_by_status;
}