From 52fc1e744f524211375ced7fd08b91769296fcf9 Mon Sep 17 00:00:00 2001 From: Riddhesh Sanghvi Date: Tue, 25 Dec 2018 12:22:43 +0530 Subject: [PATCH 1/3] Rename publish help messages to share help messages Signed-off-by: Riddhesh Sanghvi --- src/helper/class-ee-site.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/helper/class-ee-site.php b/src/helper/class-ee-site.php index 660b4217..68fa86f4 100644 --- a/src/helper/class-ee-site.php +++ b/src/helper/class-ee-site.php @@ -1000,7 +1000,7 @@ public function share( $args, $assoc_args ) { if ( $this->site_data->site_url === $active_publish ) { $this->ngrok_curl( false, $refresh ); } else { - EE::error( $this->site_data->site_url . ' does not have active publish running.' ); + EE::error( $this->site_data->site_url . ' does not have active share running.' ); } if ( ! $refresh ) { @@ -1009,15 +1009,15 @@ public function share( $args, $assoc_args ) { } if ( $this->site_data->site_ssl ) { - EE::error( 'site publish is not yet supported for ssl sites.' ); + EE::error( 'site share is not yet supported for ssl sites.' ); } $this->maybe_setup_ngrok( $ngrok ); if ( ! empty( $active_publish ) ) { if ( ( $this->site_data->site_url === $active_publish ) ) { - $error = $refresh ? '' : "{$this->site_data->site_url} has already been published. Visit link: $publish_url to view it online.\nNote: This link is only valid for few hours. In case it has expired run: `ee site publish {$this->site_data->site_url} --refresh`"; + $error = $refresh ? '' : "{$this->site_data->site_url} has already been shared. Visit link: $publish_url to view it online.\nNote: This link is only valid for few hours. In case it has expired run: `ee site share {$this->site_data->site_url} --refresh`"; } else { - $error = "$active_publish site is published currently. Publishing of only one site at a time is supported.\nTo publish {$this->site_data->site_url} , first run: `ee site publish $active_publish --disable`"; + $error = "$active_publish site is shared currently. Sharing of only one site at a time is supported.\nTo publish {$this->site_data->site_url} , first run: `ee site share $active_publish --disable`"; } if ( ! empty( $error ) ) { EE::error( $error ); @@ -1029,7 +1029,7 @@ public function share( $args, $assoc_args ) { } $config_80_port = get_config_value( 'proxy_80_port', 80 ); if ( ! $refresh ) { - EE::log( "Publishing site: {$this->site_data->site_url} online." ); + EE::log( "Sharing site: {$this->site_data->site_url} online." ); } EE::debug( "$ngrok http -host-header={$this->site_data->site_url} $config_80_port > /dev/null &" ); EE::debug( shell_exec( "$ngrok http -host-header={$this->site_data->site_url} $config_80_port > /dev/null &" ) ); @@ -1037,7 +1037,7 @@ public function share( $args, $assoc_args ) { if ( empty( $published_url ) ) { EE::error( 'Could not publish site.' ); } - EE::success( "Successfully published {$this->site_data->site_url} to url: $published_url" ); + EE::success( "Successfully shared {$this->site_data->site_url} to url: $published_url" ); Option::set( 'publish_site', $this->site_data->site_url ); Option::set( 'publish_url', $published_url ); } @@ -1113,7 +1113,7 @@ private function ngrok_curl( $get_url = true, $refresh = false ) { } if ( $refresh ) { - EE::log( 'Refreshing site publish.' ); + EE::log( 'Refreshing site share.' ); } else { EE::log( 'Disabling publish.' ); } @@ -1129,7 +1129,7 @@ private function ngrok_curl( $get_url = true, $refresh = false ) { Option::set( 'publish_site', '' ); Option::set( 'publish_url', '' ); if ( ! $refresh ) { - EE::success( 'Site publish disabled.' ); + EE::success( 'Site share disabled.' ); } } From 061a688f858be5bf2141bbd026342b8f2cb4ae88 Mon Sep 17 00:00:00 2001 From: Riddhesh Sanghvi Date: Tue, 25 Dec 2018 14:38:20 +0530 Subject: [PATCH 2/3] Change remaining messages Signed-off-by: Riddhesh Sanghvi --- src/helper/class-ee-site.php | 6 +++--- src/helper/hooks.php | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/helper/class-ee-site.php b/src/helper/class-ee-site.php index 68fa86f4..4df6b627 100644 --- a/src/helper/class-ee-site.php +++ b/src/helper/class-ee-site.php @@ -1035,7 +1035,7 @@ public function share( $args, $assoc_args ) { EE::debug( shell_exec( "$ngrok http -host-header={$this->site_data->site_url} $config_80_port > /dev/null &" ) ); $published_url = $this->ngrok_curl(); if ( empty( $published_url ) ) { - EE::error( 'Could not publish site.' ); + EE::error( 'Could not share site.' ); } EE::success( "Successfully shared {$this->site_data->site_url} to url: $published_url" ); Option::set( 'publish_site', $this->site_data->site_url ); @@ -1109,13 +1109,13 @@ private function ngrok_curl( $get_url = true, $refresh = false ) { $ngrok_tunnel = str_replace( '+', '%20', urlencode( $ngrok_data['tunnels'][0]['name'] ) ); } } elseif ( $get_url ) { - EE::error( 'Could not publish site. Please check logs.' ); + EE::error( 'Could not share site. Please check logs.' ); } if ( $refresh ) { EE::log( 'Refreshing site share.' ); } else { - EE::log( 'Disabling publish.' ); + EE::log( 'Disabling share.' ); } if ( ! empty( $ngrok_tunnel ) ) { $ch = curl_init(); diff --git a/src/helper/hooks.php b/src/helper/hooks.php index 30fe76dc..741809b3 100644 --- a/src/helper/hooks.php +++ b/src/helper/hooks.php @@ -63,11 +63,11 @@ function cleanup_redis_entries( $site_url ) { } /** - * Hook to cleanup publishing if any on site delete. + * Hook to cleanup sharing if any on site delete. * * @param string $site_url The site to be cleaned up. */ -function cleanup_publishing( $site_url ) { +function cleanup_sharing( $site_url ) { $active_publish = Option::get( 'publish_site' ); $publish_url = Option::get( 'publish_url' ); @@ -80,5 +80,5 @@ function cleanup_publishing( $site_url ) { } EE::add_hook( 'site_cleanup', 'cleanup_redis_entries' ); -EE::add_hook( 'site_cleanup', 'cleanup_publishing' ); +EE::add_hook( 'site_cleanup', 'cleanup_sharing' ); EE::add_hook( 'before_invoke:help', 'ee_site_help_cmd_routing' ); From 8679edf9147ed4383061c59df9a8e8c4071527ca Mon Sep 17 00:00:00 2001 From: Riddhesh Sanghvi Date: Tue, 25 Dec 2018 15:00:36 +0530 Subject: [PATCH 3/3] Update message and comment Signed-off-by: Riddhesh Sanghvi --- src/helper/class-ee-site.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/helper/class-ee-site.php b/src/helper/class-ee-site.php index 4df6b627..93b30e71 100644 --- a/src/helper/class-ee-site.php +++ b/src/helper/class-ee-site.php @@ -1017,7 +1017,7 @@ public function share( $args, $assoc_args ) { if ( ( $this->site_data->site_url === $active_publish ) ) { $error = $refresh ? '' : "{$this->site_data->site_url} has already been shared. Visit link: $publish_url to view it online.\nNote: This link is only valid for few hours. In case it has expired run: `ee site share {$this->site_data->site_url} --refresh`"; } else { - $error = "$active_publish site is shared currently. Sharing of only one site at a time is supported.\nTo publish {$this->site_data->site_url} , first run: `ee site share $active_publish --disable`"; + $error = "$active_publish site is shared currently. Sharing of only one site at a time is supported.\nTo share {$this->site_data->site_url} , first run: `ee site share $active_publish --disable`"; } if ( ! empty( $error ) ) { EE::error( $error ); @@ -1067,7 +1067,7 @@ private function maybe_setup_ngrok( $ngrok ) { * Function to curl and get data from ngrok api. * * @param bool $get_url To get url of tunnel or not. - * @param bool $refresh Whether to disable for publish refresh or not. + * @param bool $refresh Whether to disable share refresh or not. */ private function ngrok_curl( $get_url = true, $refresh = false ) {