PSR-4ify the action schedule post store subclass.

This commit is contained in:
Jeff Stieler 2019-08-01 17:03:40 -06:00
parent e509e51552
commit 416ab09653
5 changed files with 8 additions and 5 deletions

View File

@ -174,7 +174,7 @@ class WC_Admin_Notes {
public static function clear_queued_actions() {
$store = \ActionScheduler::store();
if ( is_a( $store, 'WC_Admin_ActionScheduler_WPPostStore' ) ) {
if ( is_a( $store, 'Automattic\WooCommerce\Admin\WC_Admin_ActionScheduler_WPPostStore' ) ) {
// If we're using our data store, call our bespoke deletion method.
$action_types = array( self::UNSNOOZE_HOOK );
$store->clear_pending_wcadmin_actions( $action_types );

View File

@ -5,10 +5,12 @@
* @package WooCommerce Admin/Classes
*/
namespace Automattic\WooCommerce\Admin;
/**
* Class WC Admin Action Scheduler Store.
*/
class WC_Admin_ActionScheduler_WPPostStore extends ActionScheduler_wpPostStore {
class WC_Admin_ActionScheduler_WPPostStore extends \ActionScheduler_wpPostStore {
/**
* Action scheduler job priority (lower numbers are claimed first).
*/
@ -24,7 +26,7 @@ class WC_Admin_ActionScheduler_WPPostStore extends ActionScheduler_wpPostStore {
* @param DateTime $scheduled_date Action schedule.
* @return array Post data array for usage in wp_insert_post().
*/
protected function create_post_array( ActionScheduler_Action $action, DateTime $scheduled_date = null ) {
protected function create_post_array( \ActionScheduler_Action $action, \DateTime $scheduled_date = null ) {
$postdata = parent::create_post_array( $action, $scheduled_date );
if ( 0 === strpos( $postdata['post_title'], 'wc-admin_' ) ) {

View File

@ -209,7 +209,7 @@ class WC_Admin_Reports_Sync {
public static function clear_queued_actions() {
$store = \ActionScheduler::store();
if ( is_a( $store, 'WC_Admin_ActionScheduler_WPPostStore' ) ) {
if ( is_a( $store, 'Automattic\WooCommerce\Admin\WC_Admin_ActionScheduler_WPPostStore' ) ) {
// If we're using our data store, call our bespoke deletion method.
$action_types = array(
self::QUEUE_BATCH_ACTION,

View File

@ -7,6 +7,7 @@
*/
use Automattic\WooCommerce\Admin\WC_Admin_Reports_Sync;
use Automattic\WooCommerce\Admin\WC_Admin_ActionScheduler_wpPostStore;
/**
* Reports Generation Batch Queue Prioritizaion Test Class

View File

@ -222,7 +222,7 @@ class WC_Admin_Feature_Plugin {
return $store_class;
}
return 'WC_Admin_ActionScheduler_WPPostStore';
return 'Automattic\WooCommerce\Admin\WC_Admin_ActionScheduler_WPPostStore';
}
/**