Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up coming soon logic #892

Merged
merged 5 commits into from
Jan 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
},
"require": {
"newfold-labs/wp-module-business-reviews": "^1.1.1",
"newfold-labs/wp-module-coming-soon": "^1.1.15",
"newfold-labs/wp-module-coming-soon": "^1.1.16",
"newfold-labs/wp-module-ctb": "^1.1.2",
"newfold-labs/wp-module-customer-bluehost": "^1.6.0",
"newfold-labs/wp-module-data": "^2.4.16",
Expand Down
14 changes: 7 additions & 7 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 8 additions & 3 deletions inc/RestApi/SettingsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace Bluehost\RestApi;

use function NewfoldLabs\WP\ModuleLoader\container;

/**
* Class SettingsController
*/
Expand Down Expand Up @@ -67,8 +69,11 @@ public function update_item( $request ) {
$new_value = $params[ $setting ];
switch ( $setting ) {
case 'comingSoon':
$new_value = ( $new_value ) ? 'true' : 'false';
update_option( 'nfd_coming_soon', $new_value );
if ( $new_value ) {
container()->get( 'comingSoon' )->enable();
} else {
container()->get( 'comingSoon' )->disable();
}
break;
case 'autoUpdatesMajorCore':
$new_value = ( $new_value ) ? 'true' : 'false';
Expand Down Expand Up @@ -170,7 +175,7 @@ public function get_current_settings() {
}

$settings = array(
'comingSoon' => ( 'true' === get_option( 'nfd_coming_soon', 'false' ) ),
'comingSoon' => container()->get( 'comingSoon' )->is_enabled(),
'autoUpdatesAll' => $major && $plugins && $themes,
'autoUpdatesMajorCore' => $major,
'autoUpdatesMinorCore' => $minor,
Expand Down
16 changes: 0 additions & 16 deletions inc/base.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,19 +87,3 @@ function bluehost_install_date_filter( $install_date ) {
return bluehost_get_plugin_install_date();
}
add_filter( 'nfd_install_date_filter', __NAMESPACE__ . '\\bluehost_install_date_filter' );


/**
* Update mm value when updating nfd one
*
* @param mixed $new_option New option value.
* @param mixed $old_option Previous option value.
*
* @return mixed
*/
function site_launched( $new_option, $old_option ) {
update_option( 'mm_coming_soon', $new_option );
return $new_option;
}

add_filter( 'pre_update_option_nfd_coming_soon', __NAMESPACE__ . '\\site_launched', 10, 2 );
13 changes: 1 addition & 12 deletions inc/jetpack.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,4 @@ function jetpack_unregister_blocks( $blocks ) {
return $blocks;
}

add_filter( 'jetpack_set_available_blocks', __NAMESPACE__ . '\\jetpack_unregister_blocks' );

/**
* Tell jetpack that the site is in construction mode.
* See https://github.com/Automattic/jetpack/blob/trunk/projects/plugins/jetpack/_inc/lib/class.core-rest-api-endpoints.php#L1122-L1143
*/
function jetpack_construction() {
if ( 'true' === get_option( 'nfd_coming_soon', 'false' ) ) {
return true;
}
}
add_filter( 'jetpack_is_under_construction_plugin', __NAMESPACE__ . '\\jetpack_construction' );
add_filter( 'jetpack_set_available_blocks', __NAMESPACE__ . '\\jetpack_unregister_blocks' );
13 changes: 0 additions & 13 deletions inc/upgrades/2.12.11.php

This file was deleted.

79 changes: 0 additions & 79 deletions inc/upgrades/3.0.3.php

This file was deleted.

Loading