@@ -24,10 +24,25 @@ final class Runtime_Environment_Setup {
2424 *
2525 * @global wpdb $wpdb WordPress database abstraction object.
2626 * @global WP_Filesystem_Base $wp_filesystem WordPress filesystem subclass.
27+ *
28+ * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
2729 */
2830 public function set_up () {
2931 global $ wpdb , $ wp_filesystem ;
3032
33+ /**
34+ * Fires before the runtime environment is set up.
35+ *
36+ * @since 2.0.0
37+ *
38+ * @param array $context {
39+ * Context for the hook.
40+ *
41+ * @type bool $early_exit Whether the method exited before completing all setup steps.
42+ * }
43+ */
44+ do_action ( 'wp_plugin_check_before_runtime_setup ' , array ( 'early_exit ' => false ) );
45+
3146 require_once ABSPATH . '/wp-admin/includes/upgrade.php ' ;
3247
3348 // Get the existing site URL.
@@ -82,6 +97,18 @@ static function () use ( $permalink_structure ) {
8297
8398 // Return early if the plugin check object cache already exists.
8499 if ( defined ( 'WP_PLUGIN_CHECK_OBJECT_CACHE_DROPIN_VERSION ' ) && WP_PLUGIN_CHECK_OBJECT_CACHE_DROPIN_VERSION ) {
100+ /**
101+ * Fires after the runtime environment is set up, including when it exits early.
102+ *
103+ * @since 2.0.0
104+ *
105+ * @param array $context {
106+ * Context for the hook.
107+ *
108+ * @type bool $early_exit Whether the method exited before completing all setup steps.
109+ * }
110+ */
111+ do_action ( 'wp_plugin_check_after_runtime_setup ' , array ( 'early_exit ' => true ) );
85112 return ;
86113 }
87114
@@ -92,6 +119,19 @@ static function () use ( $permalink_structure ) {
92119 $ wp_filesystem ->copy ( WP_PLUGIN_CHECK_PLUGIN_DIR_PATH . 'drop-ins/object-cache.copy.php ' , WP_CONTENT_DIR . '/object-cache.php ' );
93120 }
94121 }
122+
123+ /**
124+ * Fires after the runtime environment is set up, including when it exits early.
125+ *
126+ * @since 2.0.0
127+ *
128+ * @param array $context {
129+ * Context for the hook.
130+ *
131+ * @type bool $early_exit Whether the method exited before completing all setup steps.
132+ * }
133+ */
134+ do_action ( 'wp_plugin_check_after_runtime_setup ' , array ( 'early_exit ' => false ) );
95135 }
96136
97137 /**
@@ -105,6 +145,19 @@ static function () use ( $permalink_structure ) {
105145 public function clean_up () {
106146 global $ wpdb , $ wp_filesystem ;
107147
148+ /**
149+ * Fires before the runtime environment is cleaned up.
150+ *
151+ * @since 2.0.0
152+ *
153+ * @param array $context {
154+ * Context for the hook.
155+ *
156+ * @type bool $early_exit Whether the method exited before completing all cleanup steps.
157+ * }
158+ */
159+ do_action ( 'wp_plugin_check_before_runtime_cleanup ' , array ( 'early_exit ' => false ) );
160+
108161 require_once ABSPATH . '/wp-admin/includes/upgrade.php ' ;
109162
110163 $ prefix_cleanup = $ this ->amend_db_base_prefix ();
@@ -121,12 +174,36 @@ public function clean_up() {
121174
122175 // Return early if the plugin check object cache does not exist.
123176 if ( ! defined ( 'WP_PLUGIN_CHECK_OBJECT_CACHE_DROPIN_VERSION ' ) || ! WP_PLUGIN_CHECK_OBJECT_CACHE_DROPIN_VERSION ) {
177+ /**
178+ * Fires after the runtime environment is cleaned up, including when it exits early.
179+ *
180+ * @since 2.0.0
181+ *
182+ * @param array $context {
183+ * Context for the hook.
184+ *
185+ * @type bool $early_exit Whether the method exited before completing all cleanup steps.
186+ * }
187+ */
188+ do_action ( 'wp_plugin_check_after_runtime_cleanup ' , array ( 'early_exit ' => true ) );
124189 return ;
125190 }
126191
127192 // Remove the object-cache.php file.
128193 if ( $ wp_filesystem || WP_Filesystem () ) {
129194 if ( ! $ wp_filesystem ->exists ( WP_CONTENT_DIR . '/object-cache.php ' ) ) {
195+ /**
196+ * Fires after the runtime environment is cleaned up, including when it exits early.
197+ *
198+ * @since 2.0.0
199+ *
200+ * @param array $context {
201+ * Context for the hook.
202+ *
203+ * @type bool $early_exit Whether the method exited before completing all cleanup steps.
204+ * }
205+ */
206+ do_action ( 'wp_plugin_check_after_runtime_cleanup ' , array ( 'early_exit ' => true ) );
130207 return ;
131208 }
132209
@@ -138,6 +215,19 @@ public function clean_up() {
138215 $ wp_filesystem ->delete ( WP_CONTENT_DIR . '/object-cache.php ' );
139216 }
140217 }
218+
219+ /**
220+ * Fires after the runtime environment is cleaned up, including when it exits early.
221+ *
222+ * @since 2.0.0
223+ *
224+ * @param array $context {
225+ * Context for the hook.
226+ *
227+ * @type bool $early_exit Whether the method exited before completing all cleanup steps.
228+ * }
229+ */
230+ do_action ( 'wp_plugin_check_after_runtime_cleanup ' , array ( 'early_exit ' => false ) );
141231 }
142232
143233 /**
0 commit comments