Skip to content

Commit

Permalink
reinstate the skip_tools() check
Browse files Browse the repository at this point in the history
We know the defaults can change what tools should be installed, same as saving multisite settings. There could be other things we're not aware of, and the unit tests don't work without skip_tools() running within install_tools(), so we'll put it back.
  • Loading branch information
nosilver4u committed Feb 11, 2025
1 parent 804cd5d commit b3f5181
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
4 changes: 4 additions & 0 deletions classes/class-local.php
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,10 @@ public function check_permissions( $file, $minimum ) {
public function install_tools() {
$this->debug_message( '<b>' . __METHOD__ . '()</b>' );
$this->debug_message( 'Checking/Installing tools in ' . $this->content_dir );
// If anything changed, we need to re-init the tools list. For instance, setting defaults
// and saving network settings, both of those change what tools should be installed.
// There may arise other circumstances that have similar impact, so better to be safe.
$this->skip_tools();
$toolfail = false;
if ( $this->function_exists( '\php_uname' ) ) {
$arch_type = \php_uname( 'm' );
Expand Down
2 changes: 0 additions & 2 deletions classes/class-plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -868,8 +868,6 @@ public function set_defaults() {
\add_site_option( 'exactdn_sub_folder', false );
\add_site_option( 'exactdn_prevent_db_queries', true );
\add_site_option( 'ewww_image_optimizer_ll_autoscale', true );
// If anything changed, need to re-init the tools list.
$this->local->skip_tools();
}

/**
Expand Down
1 change: 0 additions & 1 deletion common.php
Original file line number Diff line number Diff line change
Expand Up @@ -707,7 +707,6 @@ function ewww_image_optimizer_save_network_settings() {
update_site_option( 'ewww_image_optimizer_enable_help', $ewww_image_optimizer_enable_help );
$ewww_image_optimizer_allow_tracking = empty( $_POST['ewww_image_optimizer_allow_tracking'] ) ? false : ewwwio()->tracking->check_for_settings_optin( (bool) $_POST['ewww_image_optimizer_allow_tracking'] );
update_site_option( 'ewww_image_optimizer_allow_tracking', $ewww_image_optimizer_allow_tracking );
ewwwio()->local->skip_tools();
add_action( 'network_admin_notices', 'ewww_image_optimizer_network_settings_saved' );
add_settings_error( 'general', 'settings_updated', __( 'Settings saved.' ), 'success' ); // phpcs:ignore WordPress.WP.I18n.MissingArgDomain
} elseif (
Expand Down

0 comments on commit b3f5181

Please sign in to comment.