Skip to content
Snippets Groups Projects
Commit fbd89188 authored by Erick Hitter's avatar Erick Hitter
Browse files

Move scheduling to a trait as it's mostly universal

parent 56976f63
Branches
No related tags found
No related merge requests found
......@@ -23,22 +23,6 @@ class Delete_Permanently {
const ADMIN_NOTICE_KEY = 'bulk_actions_cron_offload_delete_permanently';
/**
* Handle a request to delete selected posts from the trash
*
* @param object $vars Bulk-request variables.
*/
public static function process( $vars ) {
$action_scheduled = Main::next_scheduled( $vars );
if ( empty( $action_scheduled ) ) {
Main::schedule_processing( $vars );
Main::do_admin_redirect( self::ADMIN_NOTICE_KEY, true );
} else {
Main::do_admin_redirect( self::ADMIN_NOTICE_KEY, false );
}
}
/**
* Cron callback to move requested items to trash
*
......
......@@ -23,22 +23,6 @@ class Edit {
const ADMIN_NOTICE_KEY = 'bulk_actions_cron_offload_edit';
/**
* Handle a request to edit some posts
*
* @param object $vars Bulk-request variables.
*/
public static function process( $vars ) {
$action_scheduled = Main::next_scheduled( $vars );
if ( empty( $action_scheduled ) ) {
Main::schedule_processing( $vars );
Main::do_admin_redirect( self::ADMIN_NOTICE_KEY, true );
} else {
Main::do_admin_redirect( self::ADMIN_NOTICE_KEY, false );
}
}
/**
* Cron callback to edit requested items
*
......
......@@ -23,22 +23,6 @@ class Move_To_Trash {
const ADMIN_NOTICE_KEY = 'bulk_actions_cron_offload_move_to_trash';
/**
* Handle a request to move some posts to the trash
*
* @param object $vars Bulk-request variables.
*/
public static function process( $vars ) {
$action_scheduled = Main::next_scheduled( $vars );
if ( empty( $action_scheduled ) ) {
Main::schedule_processing( $vars );
Main::do_admin_redirect( self::ADMIN_NOTICE_KEY, true );
} else {
Main::do_admin_redirect( self::ADMIN_NOTICE_KEY, false );
}
}
/**
* Cron callback to move requested items to trash
*
......
......@@ -23,22 +23,6 @@ class Restore_From_Trash {
const ADMIN_NOTICE_KEY = 'bulk_actions_cron_offload_restore_from_trash';
/**
* Handle a request to restore some posts from the trash
*
* @param object $vars Bulk-request variables.
*/
public static function process( $vars ) {
$action_scheduled = Main::next_scheduled( $vars );
if ( empty( $action_scheduled ) ) {
Main::schedule_processing( $vars );
Main::do_admin_redirect( self::ADMIN_NOTICE_KEY, true );
} else {
Main::do_admin_redirect( self::ADMIN_NOTICE_KEY, false );
}
}
/**
* Cron callback to restore requested items from trash
*
......
......@@ -28,6 +28,22 @@ trait Bulk_Actions {
*/
public static function register_extra_hooks() {}
/**
* Process request
*
* @param object $vars Bulk-request variables.
*/
public static function process( $vars ) {
$action_scheduled = Main::next_scheduled( $vars );
if ( empty( $action_scheduled ) ) {
Main::schedule_processing( $vars );
Main::do_admin_redirect( self::ADMIN_NOTICE_KEY, true );
} else {
Main::do_admin_redirect( self::ADMIN_NOTICE_KEY, false );
}
}
/**
* When an edit is pending for a given post type, hide those posts in the admin
*
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment