Passed
Push — main ( aaef5c...e4c121 )
by TARIQ
71:39
created
woocommerce/packages/action-scheduler/classes/ActionScheduler_AdminView.php 2 patches
Indentation   +145 added lines, -145 removed lines patch added patch discarded remove patch
@@ -6,149 +6,149 @@
 block discarded – undo
6 6
  */
7 7
 class ActionScheduler_AdminView extends ActionScheduler_AdminView_Deprecated {
8 8
 
9
-	private static $admin_view = NULL;
10
-
11
-	private static $screen_id = 'tools_page_action-scheduler';
12
-
13
-	/** @var ActionScheduler_ListTable */
14
-	protected $list_table;
15
-
16
-	/**
17
-	 * @return ActionScheduler_AdminView
18
-	 * @codeCoverageIgnore
19
-	 */
20
-	public static function instance() {
21
-
22
-		if ( empty( self::$admin_view ) ) {
23
-			$class = apply_filters('action_scheduler_admin_view_class', 'ActionScheduler_AdminView');
24
-			self::$admin_view = new $class();
25
-		}
26
-
27
-		return self::$admin_view;
28
-	}
29
-
30
-	/**
31
-	 * @codeCoverageIgnore
32
-	 */
33
-	public function init() {
34
-		if ( is_admin() && ( ! defined( 'DOING_AJAX' ) || false == DOING_AJAX ) ) {
35
-
36
-			if ( class_exists( 'WooCommerce' ) ) {
37
-				add_action( 'woocommerce_admin_status_content_action-scheduler', array( $this, 'render_admin_ui' ) );
38
-				add_action( 'woocommerce_system_status_report', array( $this, 'system_status_report' ) );
39
-				add_filter( 'woocommerce_admin_status_tabs', array( $this, 'register_system_status_tab' ) );
40
-			}
41
-
42
-			add_action( 'admin_menu', array( $this, 'register_menu' ) );
43
-
44
-			add_action( 'current_screen', array( $this, 'add_help_tabs' ) );
45
-		}
46
-	}
47
-
48
-	public function system_status_report() {
49
-		$table = new ActionScheduler_wcSystemStatus( ActionScheduler::store() );
50
-		$table->render();
51
-	}
52
-
53
-	/**
54
-	 * Registers action-scheduler into WooCommerce > System status.
55
-	 *
56
-	 * @param array $tabs An associative array of tab key => label.
57
-	 * @return array $tabs An associative array of tab key => label, including Action Scheduler's tabs
58
-	 */
59
-	public function register_system_status_tab( array $tabs ) {
60
-		$tabs['action-scheduler'] = __( 'Scheduled Actions', 'woocommerce' );
61
-
62
-		return $tabs;
63
-	}
64
-
65
-	/**
66
-	 * Include Action Scheduler's administration under the Tools menu.
67
-	 *
68
-	 * A menu under the Tools menu is important for backward compatibility (as that's
69
-	 * where it started), and also provides more convenient access than the WooCommerce
70
-	 * System Status page, and for sites where WooCommerce isn't active.
71
-	 */
72
-	public function register_menu() {
73
-		$hook_suffix = add_submenu_page(
74
-			'tools.php',
75
-			__( 'Scheduled Actions', 'woocommerce' ),
76
-			__( 'Scheduled Actions', 'woocommerce' ),
77
-			'manage_options',
78
-			'action-scheduler',
79
-			array( $this, 'render_admin_ui' )
80
-		);
81
-		add_action( 'load-' . $hook_suffix , array( $this, 'process_admin_ui' ) );
82
-	}
83
-
84
-	/**
85
-	 * Triggers processing of any pending actions.
86
-	 */
87
-	public function process_admin_ui() {
88
-		$this->get_list_table();
89
-	}
90
-
91
-	/**
92
-	 * Renders the Admin UI
93
-	 */
94
-	public function render_admin_ui() {
95
-		$table = $this->get_list_table();
96
-		$table->display_page();
97
-	}
98
-
99
-	/**
100
-	 * Get the admin UI object and process any requested actions.
101
-	 *
102
-	 * @return ActionScheduler_ListTable
103
-	 */
104
-	protected function get_list_table() {
105
-		if ( null === $this->list_table ) {
106
-			$this->list_table = new ActionScheduler_ListTable( ActionScheduler::store(), ActionScheduler::logger(), ActionScheduler::runner() );
107
-			$this->list_table->process_actions();
108
-		}
109
-
110
-		return $this->list_table;
111
-	}
112
-
113
-	/**
114
-	 * Provide more information about the screen and its data in the help tab.
115
-	 */
116
-	public function add_help_tabs() {
117
-		$screen = get_current_screen();
118
-
119
-		if ( ! $screen || self::$screen_id != $screen->id ) {
120
-			return;
121
-		}
122
-
123
-		$as_version = ActionScheduler_Versions::instance()->latest_version();
124
-		$screen->add_help_tab(
125
-			array(
126
-				'id'      => 'action_scheduler_about',
127
-				'title'   => __( 'About', 'woocommerce' ),
128
-				'content' =>
129
-					'<h2>' . sprintf( __( 'About Action Scheduler %s', 'woocommerce' ), $as_version ) . '</h2>' .
130
-					'<p>' .
131
-						__( 'Action Scheduler is a scalable, traceable job queue for background processing large sets of actions. Action Scheduler works by triggering an action hook to run at some time in the future. Scheduled actions can also be scheduled to run on a recurring schedule.', 'woocommerce' ) .
132
-					'</p>',
133
-			)
134
-		);
135
-
136
-		$screen->add_help_tab(
137
-			array(
138
-				'id'      => 'action_scheduler_columns',
139
-				'title'   => __( 'Columns', 'woocommerce' ),
140
-				'content' =>
141
-					'<h2>' . __( 'Scheduled Action Columns', 'woocommerce' ) . '</h2>' .
142
-					'<ul>' .
143
-					sprintf( '<li><strong>%1$s</strong>: %2$s</li>', __( 'Hook', 'woocommerce' ), __( 'Name of the action hook that will be triggered.', 'woocommerce' ) ) .
144
-					sprintf( '<li><strong>%1$s</strong>: %2$s</li>', __( 'Status', 'woocommerce' ), __( 'Action statuses are Pending, Complete, Canceled, Failed', 'woocommerce' ) ) .
145
-					sprintf( '<li><strong>%1$s</strong>: %2$s</li>', __( 'Arguments', 'woocommerce' ), __( 'Optional data array passed to the action hook.', 'woocommerce' ) ) .
146
-					sprintf( '<li><strong>%1$s</strong>: %2$s</li>', __( 'Group', 'woocommerce' ), __( 'Optional action group.', 'woocommerce' ) ) .
147
-					sprintf( '<li><strong>%1$s</strong>: %2$s</li>', __( 'Recurrence', 'woocommerce' ), __( 'The action\'s schedule frequency.', 'woocommerce' ) ) .
148
-					sprintf( '<li><strong>%1$s</strong>: %2$s</li>', __( 'Scheduled', 'woocommerce' ), __( 'The date/time the action is/was scheduled to run.', 'woocommerce' ) ) .
149
-					sprintf( '<li><strong>%1$s</strong>: %2$s</li>', __( 'Log', 'woocommerce' ), __( 'Activity log for the action.', 'woocommerce' ) ) .
150
-					'</ul>',
151
-			)
152
-		);
153
-	}
9
+    private static $admin_view = NULL;
10
+
11
+    private static $screen_id = 'tools_page_action-scheduler';
12
+
13
+    /** @var ActionScheduler_ListTable */
14
+    protected $list_table;
15
+
16
+    /**
17
+     * @return ActionScheduler_AdminView
18
+     * @codeCoverageIgnore
19
+     */
20
+    public static function instance() {
21
+
22
+        if ( empty( self::$admin_view ) ) {
23
+            $class = apply_filters('action_scheduler_admin_view_class', 'ActionScheduler_AdminView');
24
+            self::$admin_view = new $class();
25
+        }
26
+
27
+        return self::$admin_view;
28
+    }
29
+
30
+    /**
31
+     * @codeCoverageIgnore
32
+     */
33
+    public function init() {
34
+        if ( is_admin() && ( ! defined( 'DOING_AJAX' ) || false == DOING_AJAX ) ) {
35
+
36
+            if ( class_exists( 'WooCommerce' ) ) {
37
+                add_action( 'woocommerce_admin_status_content_action-scheduler', array( $this, 'render_admin_ui' ) );
38
+                add_action( 'woocommerce_system_status_report', array( $this, 'system_status_report' ) );
39
+                add_filter( 'woocommerce_admin_status_tabs', array( $this, 'register_system_status_tab' ) );
40
+            }
41
+
42
+            add_action( 'admin_menu', array( $this, 'register_menu' ) );
43
+
44
+            add_action( 'current_screen', array( $this, 'add_help_tabs' ) );
45
+        }
46
+    }
47
+
48
+    public function system_status_report() {
49
+        $table = new ActionScheduler_wcSystemStatus( ActionScheduler::store() );
50
+        $table->render();
51
+    }
52
+
53
+    /**
54
+     * Registers action-scheduler into WooCommerce > System status.
55
+     *
56
+     * @param array $tabs An associative array of tab key => label.
57
+     * @return array $tabs An associative array of tab key => label, including Action Scheduler's tabs
58
+     */
59
+    public function register_system_status_tab( array $tabs ) {
60
+        $tabs['action-scheduler'] = __( 'Scheduled Actions', 'woocommerce' );
61
+
62
+        return $tabs;
63
+    }
64
+
65
+    /**
66
+     * Include Action Scheduler's administration under the Tools menu.
67
+     *
68
+     * A menu under the Tools menu is important for backward compatibility (as that's
69
+     * where it started), and also provides more convenient access than the WooCommerce
70
+     * System Status page, and for sites where WooCommerce isn't active.
71
+     */
72
+    public function register_menu() {
73
+        $hook_suffix = add_submenu_page(
74
+            'tools.php',
75
+            __( 'Scheduled Actions', 'woocommerce' ),
76
+            __( 'Scheduled Actions', 'woocommerce' ),
77
+            'manage_options',
78
+            'action-scheduler',
79
+            array( $this, 'render_admin_ui' )
80
+        );
81
+        add_action( 'load-' . $hook_suffix , array( $this, 'process_admin_ui' ) );
82
+    }
83
+
84
+    /**
85
+     * Triggers processing of any pending actions.
86
+     */
87
+    public function process_admin_ui() {
88
+        $this->get_list_table();
89
+    }
90
+
91
+    /**
92
+     * Renders the Admin UI
93
+     */
94
+    public function render_admin_ui() {
95
+        $table = $this->get_list_table();
96
+        $table->display_page();
97
+    }
98
+
99
+    /**
100
+     * Get the admin UI object and process any requested actions.
101
+     *
102
+     * @return ActionScheduler_ListTable
103
+     */
104
+    protected function get_list_table() {
105
+        if ( null === $this->list_table ) {
106
+            $this->list_table = new ActionScheduler_ListTable( ActionScheduler::store(), ActionScheduler::logger(), ActionScheduler::runner() );
107
+            $this->list_table->process_actions();
108
+        }
109
+
110
+        return $this->list_table;
111
+    }
112
+
113
+    /**
114
+     * Provide more information about the screen and its data in the help tab.
115
+     */
116
+    public function add_help_tabs() {
117
+        $screen = get_current_screen();
118
+
119
+        if ( ! $screen || self::$screen_id != $screen->id ) {
120
+            return;
121
+        }
122
+
123
+        $as_version = ActionScheduler_Versions::instance()->latest_version();
124
+        $screen->add_help_tab(
125
+            array(
126
+                'id'      => 'action_scheduler_about',
127
+                'title'   => __( 'About', 'woocommerce' ),
128
+                'content' =>
129
+                    '<h2>' . sprintf( __( 'About Action Scheduler %s', 'woocommerce' ), $as_version ) . '</h2>' .
130
+                    '<p>' .
131
+                        __( 'Action Scheduler is a scalable, traceable job queue for background processing large sets of actions. Action Scheduler works by triggering an action hook to run at some time in the future. Scheduled actions can also be scheduled to run on a recurring schedule.', 'woocommerce' ) .
132
+                    '</p>',
133
+            )
134
+        );
135
+
136
+        $screen->add_help_tab(
137
+            array(
138
+                'id'      => 'action_scheduler_columns',
139
+                'title'   => __( 'Columns', 'woocommerce' ),
140
+                'content' =>
141
+                    '<h2>' . __( 'Scheduled Action Columns', 'woocommerce' ) . '</h2>' .
142
+                    '<ul>' .
143
+                    sprintf( '<li><strong>%1$s</strong>: %2$s</li>', __( 'Hook', 'woocommerce' ), __( 'Name of the action hook that will be triggered.', 'woocommerce' ) ) .
144
+                    sprintf( '<li><strong>%1$s</strong>: %2$s</li>', __( 'Status', 'woocommerce' ), __( 'Action statuses are Pending, Complete, Canceled, Failed', 'woocommerce' ) ) .
145
+                    sprintf( '<li><strong>%1$s</strong>: %2$s</li>', __( 'Arguments', 'woocommerce' ), __( 'Optional data array passed to the action hook.', 'woocommerce' ) ) .
146
+                    sprintf( '<li><strong>%1$s</strong>: %2$s</li>', __( 'Group', 'woocommerce' ), __( 'Optional action group.', 'woocommerce' ) ) .
147
+                    sprintf( '<li><strong>%1$s</strong>: %2$s</li>', __( 'Recurrence', 'woocommerce' ), __( 'The action\'s schedule frequency.', 'woocommerce' ) ) .
148
+                    sprintf( '<li><strong>%1$s</strong>: %2$s</li>', __( 'Scheduled', 'woocommerce' ), __( 'The date/time the action is/was scheduled to run.', 'woocommerce' ) ) .
149
+                    sprintf( '<li><strong>%1$s</strong>: %2$s</li>', __( 'Log', 'woocommerce' ), __( 'Activity log for the action.', 'woocommerce' ) ) .
150
+                    '</ul>',
151
+            )
152
+        );
153
+    }
154 154
 }
Please login to merge, or discard this patch.
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 	 */
20 20
 	public static function instance() {
21 21
 
22
-		if ( empty( self::$admin_view ) ) {
22
+		if (empty(self::$admin_view)) {
23 23
 			$class = apply_filters('action_scheduler_admin_view_class', 'ActionScheduler_AdminView');
24 24
 			self::$admin_view = new $class();
25 25
 		}
@@ -31,22 +31,22 @@  discard block
 block discarded – undo
31 31
 	 * @codeCoverageIgnore
32 32
 	 */
33 33
 	public function init() {
34
-		if ( is_admin() && ( ! defined( 'DOING_AJAX' ) || false == DOING_AJAX ) ) {
34
+		if (is_admin() && (!defined('DOING_AJAX') || false == DOING_AJAX)) {
35 35
 
36
-			if ( class_exists( 'WooCommerce' ) ) {
37
-				add_action( 'woocommerce_admin_status_content_action-scheduler', array( $this, 'render_admin_ui' ) );
38
-				add_action( 'woocommerce_system_status_report', array( $this, 'system_status_report' ) );
39
-				add_filter( 'woocommerce_admin_status_tabs', array( $this, 'register_system_status_tab' ) );
36
+			if (class_exists('WooCommerce')) {
37
+				add_action('woocommerce_admin_status_content_action-scheduler', array($this, 'render_admin_ui'));
38
+				add_action('woocommerce_system_status_report', array($this, 'system_status_report'));
39
+				add_filter('woocommerce_admin_status_tabs', array($this, 'register_system_status_tab'));
40 40
 			}
41 41
 
42
-			add_action( 'admin_menu', array( $this, 'register_menu' ) );
42
+			add_action('admin_menu', array($this, 'register_menu'));
43 43
 
44
-			add_action( 'current_screen', array( $this, 'add_help_tabs' ) );
44
+			add_action('current_screen', array($this, 'add_help_tabs'));
45 45
 		}
46 46
 	}
47 47
 
48 48
 	public function system_status_report() {
49
-		$table = new ActionScheduler_wcSystemStatus( ActionScheduler::store() );
49
+		$table = new ActionScheduler_wcSystemStatus(ActionScheduler::store());
50 50
 		$table->render();
51 51
 	}
52 52
 
@@ -56,8 +56,8 @@  discard block
 block discarded – undo
56 56
 	 * @param array $tabs An associative array of tab key => label.
57 57
 	 * @return array $tabs An associative array of tab key => label, including Action Scheduler's tabs
58 58
 	 */
59
-	public function register_system_status_tab( array $tabs ) {
60
-		$tabs['action-scheduler'] = __( 'Scheduled Actions', 'woocommerce' );
59
+	public function register_system_status_tab(array $tabs) {
60
+		$tabs['action-scheduler'] = __('Scheduled Actions', 'woocommerce');
61 61
 
62 62
 		return $tabs;
63 63
 	}
@@ -72,13 +72,13 @@  discard block
 block discarded – undo
72 72
 	public function register_menu() {
73 73
 		$hook_suffix = add_submenu_page(
74 74
 			'tools.php',
75
-			__( 'Scheduled Actions', 'woocommerce' ),
76
-			__( 'Scheduled Actions', 'woocommerce' ),
75
+			__('Scheduled Actions', 'woocommerce'),
76
+			__('Scheduled Actions', 'woocommerce'),
77 77
 			'manage_options',
78 78
 			'action-scheduler',
79
-			array( $this, 'render_admin_ui' )
79
+			array($this, 'render_admin_ui')
80 80
 		);
81
-		add_action( 'load-' . $hook_suffix , array( $this, 'process_admin_ui' ) );
81
+		add_action('load-' . $hook_suffix, array($this, 'process_admin_ui'));
82 82
 	}
83 83
 
84 84
 	/**
@@ -102,8 +102,8 @@  discard block
 block discarded – undo
102 102
 	 * @return ActionScheduler_ListTable
103 103
 	 */
104 104
 	protected function get_list_table() {
105
-		if ( null === $this->list_table ) {
106
-			$this->list_table = new ActionScheduler_ListTable( ActionScheduler::store(), ActionScheduler::logger(), ActionScheduler::runner() );
105
+		if (null === $this->list_table) {
106
+			$this->list_table = new ActionScheduler_ListTable(ActionScheduler::store(), ActionScheduler::logger(), ActionScheduler::runner());
107 107
 			$this->list_table->process_actions();
108 108
 		}
109 109
 
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 	public function add_help_tabs() {
117 117
 		$screen = get_current_screen();
118 118
 
119
-		if ( ! $screen || self::$screen_id != $screen->id ) {
119
+		if (!$screen || self::$screen_id != $screen->id) {
120 120
 			return;
121 121
 		}
122 122
 
@@ -124,11 +124,11 @@  discard block
 block discarded – undo
124 124
 		$screen->add_help_tab(
125 125
 			array(
126 126
 				'id'      => 'action_scheduler_about',
127
-				'title'   => __( 'About', 'woocommerce' ),
127
+				'title'   => __('About', 'woocommerce'),
128 128
 				'content' =>
129
-					'<h2>' . sprintf( __( 'About Action Scheduler %s', 'woocommerce' ), $as_version ) . '</h2>' .
129
+					'<h2>' . sprintf(__('About Action Scheduler %s', 'woocommerce'), $as_version) . '</h2>' .
130 130
 					'<p>' .
131
-						__( 'Action Scheduler is a scalable, traceable job queue for background processing large sets of actions. Action Scheduler works by triggering an action hook to run at some time in the future. Scheduled actions can also be scheduled to run on a recurring schedule.', 'woocommerce' ) .
131
+						__('Action Scheduler is a scalable, traceable job queue for background processing large sets of actions. Action Scheduler works by triggering an action hook to run at some time in the future. Scheduled actions can also be scheduled to run on a recurring schedule.', 'woocommerce') .
132 132
 					'</p>',
133 133
 			)
134 134
 		);
@@ -136,17 +136,17 @@  discard block
 block discarded – undo
136 136
 		$screen->add_help_tab(
137 137
 			array(
138 138
 				'id'      => 'action_scheduler_columns',
139
-				'title'   => __( 'Columns', 'woocommerce' ),
139
+				'title'   => __('Columns', 'woocommerce'),
140 140
 				'content' =>
141
-					'<h2>' . __( 'Scheduled Action Columns', 'woocommerce' ) . '</h2>' .
141
+					'<h2>' . __('Scheduled Action Columns', 'woocommerce') . '</h2>' .
142 142
 					'<ul>' .
143
-					sprintf( '<li><strong>%1$s</strong>: %2$s</li>', __( 'Hook', 'woocommerce' ), __( 'Name of the action hook that will be triggered.', 'woocommerce' ) ) .
144
-					sprintf( '<li><strong>%1$s</strong>: %2$s</li>', __( 'Status', 'woocommerce' ), __( 'Action statuses are Pending, Complete, Canceled, Failed', 'woocommerce' ) ) .
145
-					sprintf( '<li><strong>%1$s</strong>: %2$s</li>', __( 'Arguments', 'woocommerce' ), __( 'Optional data array passed to the action hook.', 'woocommerce' ) ) .
146
-					sprintf( '<li><strong>%1$s</strong>: %2$s</li>', __( 'Group', 'woocommerce' ), __( 'Optional action group.', 'woocommerce' ) ) .
147
-					sprintf( '<li><strong>%1$s</strong>: %2$s</li>', __( 'Recurrence', 'woocommerce' ), __( 'The action\'s schedule frequency.', 'woocommerce' ) ) .
148
-					sprintf( '<li><strong>%1$s</strong>: %2$s</li>', __( 'Scheduled', 'woocommerce' ), __( 'The date/time the action is/was scheduled to run.', 'woocommerce' ) ) .
149
-					sprintf( '<li><strong>%1$s</strong>: %2$s</li>', __( 'Log', 'woocommerce' ), __( 'Activity log for the action.', 'woocommerce' ) ) .
143
+					sprintf('<li><strong>%1$s</strong>: %2$s</li>', __('Hook', 'woocommerce'), __('Name of the action hook that will be triggered.', 'woocommerce')) .
144
+					sprintf('<li><strong>%1$s</strong>: %2$s</li>', __('Status', 'woocommerce'), __('Action statuses are Pending, Complete, Canceled, Failed', 'woocommerce')) .
145
+					sprintf('<li><strong>%1$s</strong>: %2$s</li>', __('Arguments', 'woocommerce'), __('Optional data array passed to the action hook.', 'woocommerce')) .
146
+					sprintf('<li><strong>%1$s</strong>: %2$s</li>', __('Group', 'woocommerce'), __('Optional action group.', 'woocommerce')) .
147
+					sprintf('<li><strong>%1$s</strong>: %2$s</li>', __('Recurrence', 'woocommerce'), __('The action\'s schedule frequency.', 'woocommerce')) .
148
+					sprintf('<li><strong>%1$s</strong>: %2$s</li>', __('Scheduled', 'woocommerce'), __('The date/time the action is/was scheduled to run.', 'woocommerce')) .
149
+					sprintf('<li><strong>%1$s</strong>: %2$s</li>', __('Log', 'woocommerce'), __('Activity log for the action.', 'woocommerce')) .
150 150
 					'</ul>',
151 151
 			)
152 152
 		);
Please login to merge, or discard this patch.
packages/action-scheduler/classes/actions/ActionScheduler_Action.php 2 patches
Indentation   +57 added lines, -57 removed lines patch added patch discarded remove patch
@@ -4,72 +4,72 @@
 block discarded – undo
4 4
  * Class ActionScheduler_Action
5 5
  */
6 6
 class ActionScheduler_Action {
7
-	protected $hook = '';
8
-	protected $args = array();
9
-	/** @var ActionScheduler_Schedule */
10
-	protected $schedule = NULL;
11
-	protected $group = '';
7
+    protected $hook = '';
8
+    protected $args = array();
9
+    /** @var ActionScheduler_Schedule */
10
+    protected $schedule = NULL;
11
+    protected $group = '';
12 12
 
13
-	public function __construct( $hook, array $args = array(), ActionScheduler_Schedule $schedule = NULL, $group = '' ) {
14
-		$schedule = empty( $schedule ) ? new ActionScheduler_NullSchedule() : $schedule;
15
-		$this->set_hook($hook);
16
-		$this->set_schedule($schedule);
17
-		$this->set_args($args);
18
-		$this->set_group($group);
19
-	}
13
+    public function __construct( $hook, array $args = array(), ActionScheduler_Schedule $schedule = NULL, $group = '' ) {
14
+        $schedule = empty( $schedule ) ? new ActionScheduler_NullSchedule() : $schedule;
15
+        $this->set_hook($hook);
16
+        $this->set_schedule($schedule);
17
+        $this->set_args($args);
18
+        $this->set_group($group);
19
+    }
20 20
 
21
-	public function execute() {
22
-		return do_action_ref_array( $this->get_hook(), array_values( $this->get_args() ) );
23
-	}
21
+    public function execute() {
22
+        return do_action_ref_array( $this->get_hook(), array_values( $this->get_args() ) );
23
+    }
24 24
 
25
-	/**
26
-	 * @param string $hook
27
-	 */
28
-	protected function set_hook( $hook ) {
29
-		$this->hook = $hook;
30
-	}
25
+    /**
26
+     * @param string $hook
27
+     */
28
+    protected function set_hook( $hook ) {
29
+        $this->hook = $hook;
30
+    }
31 31
 
32
-	public function get_hook() {
33
-		return $this->hook;
34
-	}
32
+    public function get_hook() {
33
+        return $this->hook;
34
+    }
35 35
 
36
-	protected function set_schedule( ActionScheduler_Schedule $schedule ) {
37
-		$this->schedule = $schedule;
38
-	}
36
+    protected function set_schedule( ActionScheduler_Schedule $schedule ) {
37
+        $this->schedule = $schedule;
38
+    }
39 39
 
40
-	/**
41
-	 * @return ActionScheduler_Schedule
42
-	 */
43
-	public function get_schedule() {
44
-		return $this->schedule;
45
-	}
40
+    /**
41
+     * @return ActionScheduler_Schedule
42
+     */
43
+    public function get_schedule() {
44
+        return $this->schedule;
45
+    }
46 46
 
47
-	protected function set_args( array $args ) {
48
-		$this->args = $args;
49
-	}
47
+    protected function set_args( array $args ) {
48
+        $this->args = $args;
49
+    }
50 50
 
51
-	public function get_args() {
52
-		return $this->args;
53
-	}
51
+    public function get_args() {
52
+        return $this->args;
53
+    }
54 54
 
55
-	/**
56
-	 * @param string $group
57
-	 */
58
-	protected function set_group( $group ) {
59
-		$this->group = $group;
60
-	}
55
+    /**
56
+     * @param string $group
57
+     */
58
+    protected function set_group( $group ) {
59
+        $this->group = $group;
60
+    }
61 61
 
62
-	/**
63
-	 * @return string
64
-	 */
65
-	public function get_group() {
66
-		return $this->group;
67
-	}
62
+    /**
63
+     * @return string
64
+     */
65
+    public function get_group() {
66
+        return $this->group;
67
+    }
68 68
 
69
-	/**
70
-	 * @return bool If the action has been finished
71
-	 */
72
-	public function is_finished() {
73
-		return FALSE;
74
-	}
69
+    /**
70
+     * @return bool If the action has been finished
71
+     */
72
+    public function is_finished() {
73
+        return FALSE;
74
+    }
75 75
 }
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -10,8 +10,8 @@  discard block
 block discarded – undo
10 10
 	protected $schedule = NULL;
11 11
 	protected $group = '';
12 12
 
13
-	public function __construct( $hook, array $args = array(), ActionScheduler_Schedule $schedule = NULL, $group = '' ) {
14
-		$schedule = empty( $schedule ) ? new ActionScheduler_NullSchedule() : $schedule;
13
+	public function __construct($hook, array $args = array(), ActionScheduler_Schedule $schedule = NULL, $group = '') {
14
+		$schedule = empty($schedule) ? new ActionScheduler_NullSchedule() : $schedule;
15 15
 		$this->set_hook($hook);
16 16
 		$this->set_schedule($schedule);
17 17
 		$this->set_args($args);
@@ -19,13 +19,13 @@  discard block
 block discarded – undo
19 19
 	}
20 20
 
21 21
 	public function execute() {
22
-		return do_action_ref_array( $this->get_hook(), array_values( $this->get_args() ) );
22
+		return do_action_ref_array($this->get_hook(), array_values($this->get_args()));
23 23
 	}
24 24
 
25 25
 	/**
26 26
 	 * @param string $hook
27 27
 	 */
28
-	protected function set_hook( $hook ) {
28
+	protected function set_hook($hook) {
29 29
 		$this->hook = $hook;
30 30
 	}
31 31
 
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 		return $this->hook;
34 34
 	}
35 35
 
36
-	protected function set_schedule( ActionScheduler_Schedule $schedule ) {
36
+	protected function set_schedule(ActionScheduler_Schedule $schedule) {
37 37
 		$this->schedule = $schedule;
38 38
 	}
39 39
 
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 		return $this->schedule;
45 45
 	}
46 46
 
47
-	protected function set_args( array $args ) {
47
+	protected function set_args(array $args) {
48 48
 		$this->args = $args;
49 49
 	}
50 50
 
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 	/**
56 56
 	 * @param string $group
57 57
 	 */
58
-	protected function set_group( $group ) {
58
+	protected function set_group($group) {
59 59
 		$this->group = $group;
60 60
 	}
61 61
 
Please login to merge, or discard this patch.
packages/action-scheduler/classes/actions/ActionScheduler_NullAction.php 2 patches
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -5,12 +5,12 @@
 block discarded – undo
5 5
  */
6 6
 class ActionScheduler_NullAction extends ActionScheduler_Action {
7 7
 
8
-	public function __construct( $hook = '', array $args = array(), ActionScheduler_Schedule $schedule = NULL ) {
9
-		$this->set_schedule( new ActionScheduler_NullSchedule() );
10
-	}
8
+    public function __construct( $hook = '', array $args = array(), ActionScheduler_Schedule $schedule = NULL ) {
9
+        $this->set_schedule( new ActionScheduler_NullSchedule() );
10
+    }
11 11
 
12
-	public function execute() {
13
-		// don't execute
14
-	}
12
+    public function execute() {
13
+        // don't execute
14
+    }
15 15
 }
16
- 
17 16
\ No newline at end of file
17
+    
18 18
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -5,8 +5,8 @@
 block discarded – undo
5 5
  */
6 6
 class ActionScheduler_NullAction extends ActionScheduler_Action {
7 7
 
8
-	public function __construct( $hook = '', array $args = array(), ActionScheduler_Schedule $schedule = NULL ) {
9
-		$this->set_schedule( new ActionScheduler_NullSchedule() );
8
+	public function __construct($hook = '', array $args = array(), ActionScheduler_Schedule $schedule = NULL) {
9
+		$this->set_schedule(new ActionScheduler_NullSchedule());
10 10
 	}
11 11
 
12 12
 	public function execute() {
Please login to merge, or discard this patch.
action-scheduler/classes/actions/ActionScheduler_CanceledAction.php 2 patches
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -8,16 +8,16 @@
 block discarded – undo
8 8
  */
9 9
 class ActionScheduler_CanceledAction extends ActionScheduler_FinishedAction {
10 10
 
11
-	/**
12
-	 * @param string $hook
13
-	 * @param array $args
14
-	 * @param ActionScheduler_Schedule $schedule
15
-	 * @param string $group
16
-	 */
17
-	public function __construct( $hook, array $args = array(), ActionScheduler_Schedule $schedule = null, $group = '' ) {
18
-		parent::__construct( $hook, $args, $schedule, $group );
19
-		if ( is_null( $schedule ) ) {
20
-			$this->set_schedule( new ActionScheduler_NullSchedule() );
21
-		}
22
-	}
11
+    /**
12
+     * @param string $hook
13
+     * @param array $args
14
+     * @param ActionScheduler_Schedule $schedule
15
+     * @param string $group
16
+     */
17
+    public function __construct( $hook, array $args = array(), ActionScheduler_Schedule $schedule = null, $group = '' ) {
18
+        parent::__construct( $hook, $args, $schedule, $group );
19
+        if ( is_null( $schedule ) ) {
20
+            $this->set_schedule( new ActionScheduler_NullSchedule() );
21
+        }
22
+    }
23 23
 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -14,10 +14,10 @@
 block discarded – undo
14 14
 	 * @param ActionScheduler_Schedule $schedule
15 15
 	 * @param string $group
16 16
 	 */
17
-	public function __construct( $hook, array $args = array(), ActionScheduler_Schedule $schedule = null, $group = '' ) {
18
-		parent::__construct( $hook, $args, $schedule, $group );
19
-		if ( is_null( $schedule ) ) {
20
-			$this->set_schedule( new ActionScheduler_NullSchedule() );
17
+	public function __construct($hook, array $args = array(), ActionScheduler_Schedule $schedule = null, $group = '') {
18
+		parent::__construct($hook, $args, $schedule, $group);
19
+		if (is_null($schedule)) {
20
+			$this->set_schedule(new ActionScheduler_NullSchedule());
21 21
 		}
22 22
 	}
23 23
 }
Please login to merge, or discard this patch.
action-scheduler/classes/actions/ActionScheduler_FinishedAction.php 1 patch
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -5,12 +5,12 @@
 block discarded – undo
5 5
  */
6 6
 class ActionScheduler_FinishedAction extends ActionScheduler_Action {
7 7
 
8
-	public function execute() {
9
-		// don't execute
10
-	}
8
+    public function execute() {
9
+        // don't execute
10
+    }
11 11
 
12
-	public function is_finished() {
13
-		return TRUE;
14
-	}
12
+    public function is_finished() {
13
+        return TRUE;
14
+    }
15 15
 }
16
- 
17 16
\ No newline at end of file
17
+    
18 18
\ No newline at end of file
Please login to merge, or discard this patch.
packages/action-scheduler/classes/ActionScheduler_ActionClaim.php 2 patches
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -4,20 +4,20 @@
 block discarded – undo
4 4
  * Class ActionScheduler_ActionClaim
5 5
  */
6 6
 class ActionScheduler_ActionClaim {
7
-	private $id = '';
8
-	private $action_ids = array();
7
+    private $id = '';
8
+    private $action_ids = array();
9 9
 
10
-	public function __construct( $id, array $action_ids ) {
11
-		$this->id = $id;
12
-		$this->action_ids = $action_ids;
13
-	}
10
+    public function __construct( $id, array $action_ids ) {
11
+        $this->id = $id;
12
+        $this->action_ids = $action_ids;
13
+    }
14 14
 
15
-	public function get_id() {
16
-		return $this->id;
17
-	}
15
+    public function get_id() {
16
+        return $this->id;
17
+    }
18 18
 
19
-	public function get_actions() {
20
-		return $this->action_ids;
21
-	}
19
+    public function get_actions() {
20
+        return $this->action_ids;
21
+    }
22 22
 }
23
- 
24 23
\ No newline at end of file
24
+    
25 25
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@
 block discarded – undo
7 7
 	private $id = '';
8 8
 	private $action_ids = array();
9 9
 
10
-	public function __construct( $id, array $action_ids ) {
10
+	public function __construct($id, array $action_ids) {
11 11
 		$this->id = $id;
12 12
 		$this->action_ids = $action_ids;
13 13
 	}
Please login to merge, or discard this patch.
woocommerce/packages/action-scheduler/classes/ActionScheduler_Versions.php 2 patches
Indentation   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -4,59 +4,59 @@
 block discarded – undo
4 4
  * Class ActionScheduler_Versions
5 5
  */
6 6
 class ActionScheduler_Versions {
7
-	/**
8
-	 * @var ActionScheduler_Versions
9
-	 */
10
-	private static $instance = NULL;
11
-
12
-	private $versions = array();
13
-
14
-	public function register( $version_string, $initialization_callback ) {
15
-		if ( isset($this->versions[$version_string]) ) {
16
-			return FALSE;
17
-		}
18
-		$this->versions[$version_string] = $initialization_callback;
19
-		return TRUE;
20
-	}
21
-
22
-	public function get_versions() {
23
-		return $this->versions;
24
-	}
25
-
26
-	public function latest_version() {
27
-		$keys = array_keys($this->versions);
28
-		if ( empty($keys) ) {
29
-			return false;
30
-		}
31
-		uasort( $keys, 'version_compare' );
32
-		return end($keys);
33
-	}
34
-
35
-	public function latest_version_callback() {
36
-		$latest = $this->latest_version();
37
-		if ( empty($latest) || !isset($this->versions[$latest]) ) {
38
-			return '__return_null';
39
-		}
40
-		return $this->versions[$latest];
41
-	}
42
-
43
-	/**
44
-	 * @return ActionScheduler_Versions
45
-	 * @codeCoverageIgnore
46
-	 */
47
-	public static function instance() {
48
-		if ( empty(self::$instance) ) {
49
-			self::$instance = new self();
50
-		}
51
-		return self::$instance;
52
-	}
53
-
54
-	/**
55
-	 * @codeCoverageIgnore
56
-	 */
57
-	public static function initialize_latest_version() {
58
-		$self = self::instance();
59
-		call_user_func($self->latest_version_callback());
60
-	}
7
+    /**
8
+     * @var ActionScheduler_Versions
9
+     */
10
+    private static $instance = NULL;
11
+
12
+    private $versions = array();
13
+
14
+    public function register( $version_string, $initialization_callback ) {
15
+        if ( isset($this->versions[$version_string]) ) {
16
+            return FALSE;
17
+        }
18
+        $this->versions[$version_string] = $initialization_callback;
19
+        return TRUE;
20
+    }
21
+
22
+    public function get_versions() {
23
+        return $this->versions;
24
+    }
25
+
26
+    public function latest_version() {
27
+        $keys = array_keys($this->versions);
28
+        if ( empty($keys) ) {
29
+            return false;
30
+        }
31
+        uasort( $keys, 'version_compare' );
32
+        return end($keys);
33
+    }
34
+
35
+    public function latest_version_callback() {
36
+        $latest = $this->latest_version();
37
+        if ( empty($latest) || !isset($this->versions[$latest]) ) {
38
+            return '__return_null';
39
+        }
40
+        return $this->versions[$latest];
41
+    }
42
+
43
+    /**
44
+     * @return ActionScheduler_Versions
45
+     * @codeCoverageIgnore
46
+     */
47
+    public static function instance() {
48
+        if ( empty(self::$instance) ) {
49
+            self::$instance = new self();
50
+        }
51
+        return self::$instance;
52
+    }
53
+
54
+    /**
55
+     * @codeCoverageIgnore
56
+     */
57
+    public static function initialize_latest_version() {
58
+        $self = self::instance();
59
+        call_user_func($self->latest_version_callback());
60
+    }
61 61
 }
62
- 
63 62
\ No newline at end of file
63
+    
64 64
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -11,8 +11,8 @@  discard block
 block discarded – undo
11 11
 
12 12
 	private $versions = array();
13 13
 
14
-	public function register( $version_string, $initialization_callback ) {
15
-		if ( isset($this->versions[$version_string]) ) {
14
+	public function register($version_string, $initialization_callback) {
15
+		if (isset($this->versions[$version_string])) {
16 16
 			return FALSE;
17 17
 		}
18 18
 		$this->versions[$version_string] = $initialization_callback;
@@ -25,16 +25,16 @@  discard block
 block discarded – undo
25 25
 
26 26
 	public function latest_version() {
27 27
 		$keys = array_keys($this->versions);
28
-		if ( empty($keys) ) {
28
+		if (empty($keys)) {
29 29
 			return false;
30 30
 		}
31
-		uasort( $keys, 'version_compare' );
31
+		uasort($keys, 'version_compare');
32 32
 		return end($keys);
33 33
 	}
34 34
 
35 35
 	public function latest_version_callback() {
36 36
 		$latest = $this->latest_version();
37
-		if ( empty($latest) || !isset($this->versions[$latest]) ) {
37
+		if (empty($latest) || !isset($this->versions[$latest])) {
38 38
 			return '__return_null';
39 39
 		}
40 40
 		return $this->versions[$latest];
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 	 * @codeCoverageIgnore
46 46
 	 */
47 47
 	public static function instance() {
48
-		if ( empty(self::$instance) ) {
48
+		if (empty(self::$instance)) {
49 49
 			self::$instance = new self();
50 50
 		}
51 51
 		return self::$instance;
Please login to merge, or discard this patch.
packages/action-scheduler/classes/ActionScheduler_FatalErrorMonitor.php 2 patches
Indentation   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -4,52 +4,52 @@
 block discarded – undo
4 4
  * Class ActionScheduler_FatalErrorMonitor
5 5
  */
6 6
 class ActionScheduler_FatalErrorMonitor {
7
-	/** @var ActionScheduler_ActionClaim */
8
-	private $claim = NULL;
9
-	/** @var ActionScheduler_Store */
10
-	private $store = NULL;
11
-	private $action_id = 0;
7
+    /** @var ActionScheduler_ActionClaim */
8
+    private $claim = NULL;
9
+    /** @var ActionScheduler_Store */
10
+    private $store = NULL;
11
+    private $action_id = 0;
12 12
 
13
-	public function __construct( ActionScheduler_Store $store ) {
14
-		$this->store = $store;
15
-	}
13
+    public function __construct( ActionScheduler_Store $store ) {
14
+        $this->store = $store;
15
+    }
16 16
 
17
-	public function attach( ActionScheduler_ActionClaim $claim ) {
18
-		$this->claim = $claim;
19
-		add_action( 'shutdown', array( $this, 'handle_unexpected_shutdown' ) );
20
-		add_action( 'action_scheduler_before_execute', array( $this, 'track_current_action' ), 0, 1 );
21
-		add_action( 'action_scheduler_after_execute',  array( $this, 'untrack_action' ), 0, 0 );
22
-		add_action( 'action_scheduler_execution_ignored',  array( $this, 'untrack_action' ), 0, 0 );
23
-		add_action( 'action_scheduler_failed_execution',  array( $this, 'untrack_action' ), 0, 0 );
24
-	}
17
+    public function attach( ActionScheduler_ActionClaim $claim ) {
18
+        $this->claim = $claim;
19
+        add_action( 'shutdown', array( $this, 'handle_unexpected_shutdown' ) );
20
+        add_action( 'action_scheduler_before_execute', array( $this, 'track_current_action' ), 0, 1 );
21
+        add_action( 'action_scheduler_after_execute',  array( $this, 'untrack_action' ), 0, 0 );
22
+        add_action( 'action_scheduler_execution_ignored',  array( $this, 'untrack_action' ), 0, 0 );
23
+        add_action( 'action_scheduler_failed_execution',  array( $this, 'untrack_action' ), 0, 0 );
24
+    }
25 25
 
26
-	public function detach() {
27
-		$this->claim = NULL;
28
-		$this->untrack_action();
29
-		remove_action( 'shutdown', array( $this, 'handle_unexpected_shutdown' ) );
30
-		remove_action( 'action_scheduler_before_execute', array( $this, 'track_current_action' ), 0 );
31
-		remove_action( 'action_scheduler_after_execute',  array( $this, 'untrack_action' ), 0 );
32
-		remove_action( 'action_scheduler_execution_ignored',  array( $this, 'untrack_action' ), 0 );
33
-		remove_action( 'action_scheduler_failed_execution',  array( $this, 'untrack_action' ), 0 );
34
-	}
26
+    public function detach() {
27
+        $this->claim = NULL;
28
+        $this->untrack_action();
29
+        remove_action( 'shutdown', array( $this, 'handle_unexpected_shutdown' ) );
30
+        remove_action( 'action_scheduler_before_execute', array( $this, 'track_current_action' ), 0 );
31
+        remove_action( 'action_scheduler_after_execute',  array( $this, 'untrack_action' ), 0 );
32
+        remove_action( 'action_scheduler_execution_ignored',  array( $this, 'untrack_action' ), 0 );
33
+        remove_action( 'action_scheduler_failed_execution',  array( $this, 'untrack_action' ), 0 );
34
+    }
35 35
 
36
-	public function track_current_action( $action_id ) {
37
-		$this->action_id = $action_id;
38
-	}
36
+    public function track_current_action( $action_id ) {
37
+        $this->action_id = $action_id;
38
+    }
39 39
 
40
-	public function untrack_action() {
41
-		$this->action_id = 0;
42
-	}
40
+    public function untrack_action() {
41
+        $this->action_id = 0;
42
+    }
43 43
 
44
-	public function handle_unexpected_shutdown() {
45
-		if ( $error = error_get_last() ) {
46
-			if ( in_array( $error['type'], array( E_ERROR, E_PARSE, E_COMPILE_ERROR, E_USER_ERROR, E_RECOVERABLE_ERROR ) ) ) {
47
-				if ( !empty($this->action_id) ) {
48
-					$this->store->mark_failure( $this->action_id );
49
-					do_action( 'action_scheduler_unexpected_shutdown', $this->action_id, $error );
50
-				}
51
-			}
52
-			$this->store->release_claim( $this->claim );
53
-		}
54
-	}
44
+    public function handle_unexpected_shutdown() {
45
+        if ( $error = error_get_last() ) {
46
+            if ( in_array( $error['type'], array( E_ERROR, E_PARSE, E_COMPILE_ERROR, E_USER_ERROR, E_RECOVERABLE_ERROR ) ) ) {
47
+                if ( !empty($this->action_id) ) {
48
+                    $this->store->mark_failure( $this->action_id );
49
+                    do_action( 'action_scheduler_unexpected_shutdown', $this->action_id, $error );
50
+                }
51
+            }
52
+            $this->store->release_claim( $this->claim );
53
+        }
54
+    }
55 55
 }
Please login to merge, or discard this patch.
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -10,30 +10,30 @@  discard block
 block discarded – undo
10 10
 	private $store = NULL;
11 11
 	private $action_id = 0;
12 12
 
13
-	public function __construct( ActionScheduler_Store $store ) {
13
+	public function __construct(ActionScheduler_Store $store) {
14 14
 		$this->store = $store;
15 15
 	}
16 16
 
17
-	public function attach( ActionScheduler_ActionClaim $claim ) {
17
+	public function attach(ActionScheduler_ActionClaim $claim) {
18 18
 		$this->claim = $claim;
19
-		add_action( 'shutdown', array( $this, 'handle_unexpected_shutdown' ) );
20
-		add_action( 'action_scheduler_before_execute', array( $this, 'track_current_action' ), 0, 1 );
21
-		add_action( 'action_scheduler_after_execute',  array( $this, 'untrack_action' ), 0, 0 );
22
-		add_action( 'action_scheduler_execution_ignored',  array( $this, 'untrack_action' ), 0, 0 );
23
-		add_action( 'action_scheduler_failed_execution',  array( $this, 'untrack_action' ), 0, 0 );
19
+		add_action('shutdown', array($this, 'handle_unexpected_shutdown'));
20
+		add_action('action_scheduler_before_execute', array($this, 'track_current_action'), 0, 1);
21
+		add_action('action_scheduler_after_execute', array($this, 'untrack_action'), 0, 0);
22
+		add_action('action_scheduler_execution_ignored', array($this, 'untrack_action'), 0, 0);
23
+		add_action('action_scheduler_failed_execution', array($this, 'untrack_action'), 0, 0);
24 24
 	}
25 25
 
26 26
 	public function detach() {
27 27
 		$this->claim = NULL;
28 28
 		$this->untrack_action();
29
-		remove_action( 'shutdown', array( $this, 'handle_unexpected_shutdown' ) );
30
-		remove_action( 'action_scheduler_before_execute', array( $this, 'track_current_action' ), 0 );
31
-		remove_action( 'action_scheduler_after_execute',  array( $this, 'untrack_action' ), 0 );
32
-		remove_action( 'action_scheduler_execution_ignored',  array( $this, 'untrack_action' ), 0 );
33
-		remove_action( 'action_scheduler_failed_execution',  array( $this, 'untrack_action' ), 0 );
29
+		remove_action('shutdown', array($this, 'handle_unexpected_shutdown'));
30
+		remove_action('action_scheduler_before_execute', array($this, 'track_current_action'), 0);
31
+		remove_action('action_scheduler_after_execute', array($this, 'untrack_action'), 0);
32
+		remove_action('action_scheduler_execution_ignored', array($this, 'untrack_action'), 0);
33
+		remove_action('action_scheduler_failed_execution', array($this, 'untrack_action'), 0);
34 34
 	}
35 35
 
36
-	public function track_current_action( $action_id ) {
36
+	public function track_current_action($action_id) {
37 37
 		$this->action_id = $action_id;
38 38
 	}
39 39
 
@@ -42,14 +42,14 @@  discard block
 block discarded – undo
42 42
 	}
43 43
 
44 44
 	public function handle_unexpected_shutdown() {
45
-		if ( $error = error_get_last() ) {
46
-			if ( in_array( $error['type'], array( E_ERROR, E_PARSE, E_COMPILE_ERROR, E_USER_ERROR, E_RECOVERABLE_ERROR ) ) ) {
47
-				if ( !empty($this->action_id) ) {
48
-					$this->store->mark_failure( $this->action_id );
49
-					do_action( 'action_scheduler_unexpected_shutdown', $this->action_id, $error );
45
+		if ($error = error_get_last()) {
46
+			if (in_array($error['type'], array(E_ERROR, E_PARSE, E_COMPILE_ERROR, E_USER_ERROR, E_RECOVERABLE_ERROR))) {
47
+				if (!empty($this->action_id)) {
48
+					$this->store->mark_failure($this->action_id);
49
+					do_action('action_scheduler_unexpected_shutdown', $this->action_id, $error);
50 50
 				}
51 51
 			}
52
-			$this->store->release_claim( $this->claim );
52
+			$this->store->release_claim($this->claim);
53 53
 		}
54 54
 	}
55 55
 }
Please login to merge, or discard this patch.
packages/action-scheduler/classes/schema/ActionScheduler_StoreSchema.php 2 patches
Indentation   +75 added lines, -75 removed lines patch added patch discarded remove patch
@@ -8,42 +8,42 @@  discard block
 block discarded – undo
8 8
  * Creates custom tables for storing scheduled actions
9 9
  */
10 10
 class ActionScheduler_StoreSchema extends ActionScheduler_Abstract_Schema {
11
-	const ACTIONS_TABLE = 'actionscheduler_actions';
12
-	const CLAIMS_TABLE  = 'actionscheduler_claims';
13
-	const GROUPS_TABLE  = 'actionscheduler_groups';
14
-	const DEFAULT_DATE  = '0000-00-00 00:00:00';
15
-
16
-	/**
17
-	 * @var int Increment this value to trigger a schema update.
18
-	 */
19
-	protected $schema_version = 6;
20
-
21
-	public function __construct() {
22
-		$this->tables = [
23
-			self::ACTIONS_TABLE,
24
-			self::CLAIMS_TABLE,
25
-			self::GROUPS_TABLE,
26
-		];
27
-	}
28
-
29
-	/**
30
-	 * Performs additional setup work required to support this schema.
31
-	 */
32
-	public function init() {
33
-		add_action( 'action_scheduler_before_schema_update', array( $this, 'update_schema_5_0' ), 10, 2 );
34
-	}
35
-
36
-	protected function get_table_definition( $table ) {
37
-		global $wpdb;
38
-		$table_name       = $wpdb->$table;
39
-		$charset_collate  = $wpdb->get_charset_collate();
40
-		$max_index_length = 191; // @see wp_get_db_schema()
41
-		$default_date     = self::DEFAULT_DATE;
42
-		switch ( $table ) {
43
-
44
-			case self::ACTIONS_TABLE:
45
-
46
-				return "CREATE TABLE {$table_name} (
11
+    const ACTIONS_TABLE = 'actionscheduler_actions';
12
+    const CLAIMS_TABLE  = 'actionscheduler_claims';
13
+    const GROUPS_TABLE  = 'actionscheduler_groups';
14
+    const DEFAULT_DATE  = '0000-00-00 00:00:00';
15
+
16
+    /**
17
+     * @var int Increment this value to trigger a schema update.
18
+     */
19
+    protected $schema_version = 6;
20
+
21
+    public function __construct() {
22
+        $this->tables = [
23
+            self::ACTIONS_TABLE,
24
+            self::CLAIMS_TABLE,
25
+            self::GROUPS_TABLE,
26
+        ];
27
+    }
28
+
29
+    /**
30
+     * Performs additional setup work required to support this schema.
31
+     */
32
+    public function init() {
33
+        add_action( 'action_scheduler_before_schema_update', array( $this, 'update_schema_5_0' ), 10, 2 );
34
+    }
35
+
36
+    protected function get_table_definition( $table ) {
37
+        global $wpdb;
38
+        $table_name       = $wpdb->$table;
39
+        $charset_collate  = $wpdb->get_charset_collate();
40
+        $max_index_length = 191; // @see wp_get_db_schema()
41
+        $default_date     = self::DEFAULT_DATE;
42
+        switch ( $table ) {
43
+
44
+            case self::ACTIONS_TABLE:
45
+
46
+                return "CREATE TABLE {$table_name} (
47 47
 				        action_id bigint(20) unsigned NOT NULL auto_increment,
48 48
 				        hook varchar(191) NOT NULL,
49 49
 				        status varchar(20) NOT NULL,
@@ -67,63 +67,63 @@  discard block
 block discarded – undo
67 67
 				        KEY `claim_id_status_scheduled_date_gmt` (`claim_id`, `status`, `scheduled_date_gmt`)
68 68
 				        ) $charset_collate";
69 69
 
70
-			case self::CLAIMS_TABLE:
70
+            case self::CLAIMS_TABLE:
71 71
 
72
-				return "CREATE TABLE {$table_name} (
72
+                return "CREATE TABLE {$table_name} (
73 73
 				        claim_id bigint(20) unsigned NOT NULL auto_increment,
74 74
 				        date_created_gmt datetime NULL default '${default_date}',
75 75
 				        PRIMARY KEY  (claim_id),
76 76
 				        KEY date_created_gmt (date_created_gmt)
77 77
 				        ) $charset_collate";
78 78
 
79
-			case self::GROUPS_TABLE:
79
+            case self::GROUPS_TABLE:
80 80
 
81
-				return "CREATE TABLE {$table_name} (
81
+                return "CREATE TABLE {$table_name} (
82 82
 				        group_id bigint(20) unsigned NOT NULL auto_increment,
83 83
 				        slug varchar(255) NOT NULL,
84 84
 				        PRIMARY KEY  (group_id),
85 85
 				        KEY slug (slug($max_index_length))
86 86
 				        ) $charset_collate";
87 87
 
88
-			default:
89
-				return '';
90
-		}
91
-	}
92
-
93
-	/**
94
-	 * Update the actions table schema, allowing datetime fields to be NULL.
95
-	 *
96
-	 * This is needed because the NOT NULL constraint causes a conflict with some versions of MySQL
97
-	 * configured with sql_mode=NO_ZERO_DATE, which can for instance lead to tables not being created.
98
-	 *
99
-	 * Most other schema updates happen via ActionScheduler_Abstract_Schema::update_table(), however
100
-	 * that method relies on dbDelta() and this change is not possible when using that function.
101
-	 *
102
-	 * @param string $table Name of table being updated.
103
-	 * @param string $db_version The existing schema version of the table.
104
-	 */
105
-	public function update_schema_5_0( $table, $db_version ) {
106
-		global $wpdb;
107
-
108
-		if ( 'actionscheduler_actions' !== $table || version_compare( $db_version, '5', '>=' ) ) {
109
-			return;
110
-		}
111
-
112
-		// phpcs:disable WordPress.DB.PreparedSQL.InterpolatedNotPrepared
113
-		$table_name   = $wpdb->prefix . 'actionscheduler_actions';
114
-		$table_list   = $wpdb->get_col( "SHOW TABLES LIKE '${table_name}'" );
115
-		$default_date = self::DEFAULT_DATE;
116
-
117
-		if ( ! empty( $table_list ) ) {
118
-			$query = "
88
+            default:
89
+                return '';
90
+        }
91
+    }
92
+
93
+    /**
94
+     * Update the actions table schema, allowing datetime fields to be NULL.
95
+     *
96
+     * This is needed because the NOT NULL constraint causes a conflict with some versions of MySQL
97
+     * configured with sql_mode=NO_ZERO_DATE, which can for instance lead to tables not being created.
98
+     *
99
+     * Most other schema updates happen via ActionScheduler_Abstract_Schema::update_table(), however
100
+     * that method relies on dbDelta() and this change is not possible when using that function.
101
+     *
102
+     * @param string $table Name of table being updated.
103
+     * @param string $db_version The existing schema version of the table.
104
+     */
105
+    public function update_schema_5_0( $table, $db_version ) {
106
+        global $wpdb;
107
+
108
+        if ( 'actionscheduler_actions' !== $table || version_compare( $db_version, '5', '>=' ) ) {
109
+            return;
110
+        }
111
+
112
+        // phpcs:disable WordPress.DB.PreparedSQL.InterpolatedNotPrepared
113
+        $table_name   = $wpdb->prefix . 'actionscheduler_actions';
114
+        $table_list   = $wpdb->get_col( "SHOW TABLES LIKE '${table_name}'" );
115
+        $default_date = self::DEFAULT_DATE;
116
+
117
+        if ( ! empty( $table_list ) ) {
118
+            $query = "
119 119
 				ALTER TABLE ${table_name}
120 120
 				MODIFY COLUMN scheduled_date_gmt datetime NULL default '${default_date}',
121 121
 				MODIFY COLUMN scheduled_date_local datetime NULL default '${default_date}',
122 122
 				MODIFY COLUMN last_attempt_gmt datetime NULL default '${default_date}',
123 123
 				MODIFY COLUMN last_attempt_local datetime NULL default '${default_date}'
124 124
 		";
125
-			$wpdb->query( $query ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
126
-		}
127
-		// phpcs:enable WordPress.DB.PreparedSQL.InterpolatedNotPrepared
128
-	}
125
+            $wpdb->query( $query ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
126
+        }
127
+        // phpcs:enable WordPress.DB.PreparedSQL.InterpolatedNotPrepared
128
+    }
129 129
 }
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -30,16 +30,16 @@  discard block
 block discarded – undo
30 30
 	 * Performs additional setup work required to support this schema.
31 31
 	 */
32 32
 	public function init() {
33
-		add_action( 'action_scheduler_before_schema_update', array( $this, 'update_schema_5_0' ), 10, 2 );
33
+		add_action('action_scheduler_before_schema_update', array($this, 'update_schema_5_0'), 10, 2);
34 34
 	}
35 35
 
36
-	protected function get_table_definition( $table ) {
36
+	protected function get_table_definition($table) {
37 37
 		global $wpdb;
38 38
 		$table_name       = $wpdb->$table;
39 39
 		$charset_collate  = $wpdb->get_charset_collate();
40 40
 		$max_index_length = 191; // @see wp_get_db_schema()
41 41
 		$default_date     = self::DEFAULT_DATE;
42
-		switch ( $table ) {
42
+		switch ($table) {
43 43
 
44 44
 			case self::ACTIONS_TABLE:
45 45
 
@@ -102,19 +102,19 @@  discard block
 block discarded – undo
102 102
 	 * @param string $table Name of table being updated.
103 103
 	 * @param string $db_version The existing schema version of the table.
104 104
 	 */
105
-	public function update_schema_5_0( $table, $db_version ) {
105
+	public function update_schema_5_0($table, $db_version) {
106 106
 		global $wpdb;
107 107
 
108
-		if ( 'actionscheduler_actions' !== $table || version_compare( $db_version, '5', '>=' ) ) {
108
+		if ('actionscheduler_actions' !== $table || version_compare($db_version, '5', '>=')) {
109 109
 			return;
110 110
 		}
111 111
 
112 112
 		// phpcs:disable WordPress.DB.PreparedSQL.InterpolatedNotPrepared
113 113
 		$table_name   = $wpdb->prefix . 'actionscheduler_actions';
114
-		$table_list   = $wpdb->get_col( "SHOW TABLES LIKE '${table_name}'" );
114
+		$table_list   = $wpdb->get_col("SHOW TABLES LIKE '${table_name}'");
115 115
 		$default_date = self::DEFAULT_DATE;
116 116
 
117
-		if ( ! empty( $table_list ) ) {
117
+		if (!empty($table_list)) {
118 118
 			$query = "
119 119
 				ALTER TABLE ${table_name}
120 120
 				MODIFY COLUMN scheduled_date_gmt datetime NULL default '${default_date}',
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 				MODIFY COLUMN last_attempt_gmt datetime NULL default '${default_date}',
123 123
 				MODIFY COLUMN last_attempt_local datetime NULL default '${default_date}'
124 124
 		";
125
-			$wpdb->query( $query ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
125
+			$wpdb->query($query); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
126 126
 		}
127 127
 		// phpcs:enable WordPress.DB.PreparedSQL.InterpolatedNotPrepared
128 128
 	}
Please login to merge, or discard this patch.