diff --git a/classes/abstracts/ActionScheduler_Store.php b/classes/abstracts/ActionScheduler_Store.php index 632fd4aaa..8d1d04f40 100644 --- a/classes/abstracts/ActionScheduler_Store.php +++ b/classes/abstracts/ActionScheduler_Store.php @@ -4,7 +4,7 @@ * Class ActionScheduler_Store * @codeCoverageIgnore */ -abstract class ActionScheduler_Store { +abstract class ActionScheduler_Store extends ActionScheduler_Store_Deprecated { const STATUS_COMPLETE = 'complete'; const STATUS_PENDING = 'pending'; const STATUS_RUNNING = 'in-progress'; @@ -239,35 +239,6 @@ public function has_pending_actions_due() { public function init() {} - /** - * Mark an action that failed to fetch correctly as failed. - * - * @since 2.2.6 - * - * @param int $action_id The ID of the action. - */ - public function mark_failed_fetch_action( $action_id ) { - self::$store->mark_failure( $action_id ); - } - - /** - * Add base hooks - * - * @since 2.2.6 - */ - public static function hook() { - add_action( 'action_scheduler_failed_fetch_action', array( self::$store, 'mark_failed_fetch_action' ), 20 ); - } - - /** - * Remove base hooks - * - * @since 2.2.6 - */ - public static function unhook() { - remove_action( 'action_scheduler_failed_fetch_action', array( self::$store, 'mark_failed_fetch_action' ), 20 ); - } - /** * @return ActionScheduler_Store */ @@ -275,19 +246,7 @@ public static function instance() { if ( empty( self::$store ) ) { $class = apply_filters( 'action_scheduler_store_class', self::DEFAULT_CLASS ); self::$store = new $class(); - self::hook(); } return self::$store; } - - /** - * Get the site's local time. - * - * @deprecated 2.1.0 - * @return DateTimeZone - */ - protected function get_local_timezone() { - _deprecated_function( __FUNCTION__, '2.1.0', 'ActionScheduler_TimezoneHelper::set_local_timezone()' ); - return ActionScheduler_TimezoneHelper::get_local_timezone(); - } } diff --git a/deprecated/ActionScheduler_Store_Deprecated.php b/deprecated/ActionScheduler_Store_Deprecated.php new file mode 100644 index 000000000..002dc75b4 --- /dev/null +++ b/deprecated/ActionScheduler_Store_Deprecated.php @@ -0,0 +1,49 @@ +mark_failure( $action_id ); + } + + /** + * Add base hooks + * + * @since 2.2.6 + */ + protected static function hook() { + _deprecated_function( __METHOD__, '3.0.0' ); + } + + /** + * Remove base hooks + * + * @since 2.2.6 + */ + protected static function unhook() { + _deprecated_function( __METHOD__, '3.0.0' ); + } + + /** + * Get the site's local time. + * + * @deprecated 2.1.0 + * @return DateTimeZone + */ + protected function get_local_timezone() { + _deprecated_function( __FUNCTION__, '2.1.0', 'ActionScheduler_TimezoneHelper::set_local_timezone()' ); + return ActionScheduler_TimezoneHelper::get_local_timezone(); + } +} diff --git a/tests/phpunit/jobstore/ActionScheduler_wpPostStore_Test.php b/tests/phpunit/jobstore/ActionScheduler_wpPostStore_Test.php index ce6795cbf..cba33e935 100644 --- a/tests/phpunit/jobstore/ActionScheduler_wpPostStore_Test.php +++ b/tests/phpunit/jobstore/ActionScheduler_wpPostStore_Test.php @@ -54,9 +54,7 @@ public function test_action_bad_args( $content ) { 'post_content' => $content, ) ); - ActionScheduler_Store::unhook(); $fetched = $store->fetch_action( $post_id ); - ActionScheduler_Store::hook(); $this->assertInstanceOf( 'ActionScheduler_NullSchedule', $fetched->get_schedule() ); }