From 2dfcdc5bfc6ee28604f113ae0dbd5afc245cce56 Mon Sep 17 00:00:00 2001 From: Riddhesh Sanghvi Date: Wed, 10 Oct 2018 19:35:11 +0530 Subject: [PATCH 1/3] Add hook for site cleanup Signed-off-by: Riddhesh Sanghvi --- src/helper/class-ee-site.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/helper/class-ee-site.php b/src/helper/class-ee-site.php index b6b61d71..7221e651 100644 --- a/src/helper/class-ee-site.php +++ b/src/helper/class-ee-site.php @@ -223,6 +223,7 @@ protected function delete_site( $level, $site_url, $site_fs_path, $db_data = [] } } + \EE::do_hook( 'site_cleanup', $site_url ); if ( $level > 4 ) { if ( $this->site_data['site_ssl'] ) { From 7ce303c151c77f08c9e239598dc3ef591e448492 Mon Sep 17 00:00:00 2001 From: Riddhesh Sanghvi Date: Thu, 11 Oct 2018 12:13:42 +0530 Subject: [PATCH 2/3] Update comment explaining hook Signed-off-by: Riddhesh Sanghvi --- src/helper/class-ee-site.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/helper/class-ee-site.php b/src/helper/class-ee-site.php index 7221e651..fc00cf77 100644 --- a/src/helper/class-ee-site.php +++ b/src/helper/class-ee-site.php @@ -223,6 +223,11 @@ protected function delete_site( $level, $site_url, $site_fs_path, $db_data = [] } } + /** + * Site cleanup hook is a hook for different packages to initiate cleanup, for data related to given site. + * Cleanup may be required by a package if it maintains its own database table or some files or both that are specific to the site being deleted. + * In those cases, this hook can be used. It is placed just before removing the site entry from database table `sites`. The hook provides `site_url` with the help of which `id` of the site can be found as well as anything else related to that site can be deleted. + */ \EE::do_hook( 'site_cleanup', $site_url ); if ( $level > 4 ) { From 0aa22616d8aaeea7c546208f2b20a15e09696944 Mon Sep 17 00:00:00 2001 From: Riddhesh Sanghvi Date: Mon, 15 Oct 2018 20:04:41 +0530 Subject: [PATCH 3/3] Update hook description Signed-off-by: Riddhesh Sanghvi --- src/helper/class-ee-site.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/helper/class-ee-site.php b/src/helper/class-ee-site.php index fc00cf77..e8744497 100644 --- a/src/helper/class-ee-site.php +++ b/src/helper/class-ee-site.php @@ -224,9 +224,10 @@ protected function delete_site( $level, $site_url, $site_fs_path, $db_data = [] } /** - * Site cleanup hook is a hook for different packages to initiate cleanup, for data related to given site. - * Cleanup may be required by a package if it maintains its own database table or some files or both that are specific to the site being deleted. - * In those cases, this hook can be used. It is placed just before removing the site entry from database table `sites`. The hook provides `site_url` with the help of which `id` of the site can be found as well as anything else related to that site can be deleted. + * Execute before site db data cleanup and after site services cleanup. + * Note: This can be use to cleanup site data added by any package command. + * + * @param string $site_url Url of site which data is cleanup. */ \EE::do_hook( 'site_cleanup', $site_url );