Skip to content

Commit

Permalink
Refactor is_autoupdatable and is_updated for better readability and m…
Browse files Browse the repository at this point in the history
…aintainability (renaming variables, rewriting docstring...) Linked to #17
  • Loading branch information
jaz-on committed Aug 8, 2023
1 parent 4c884be commit 47dfac9
Showing 1 changed file with 5 additions and 15 deletions.
20 changes: 5 additions & 15 deletions includes/system/Environment.php
Original file line number Diff line number Diff line change
Expand Up @@ -723,25 +723,15 @@ public static function is_updated($old) {
}

/**
* Is the WP update system enabled?
*
* @since 3.1.3
*/
public static function is_updatable() {
$result = true;
if (defined('AUTOMATIC_UPDATER_DISABLED')) {
$result = !AUTOMATIC_UPDATER_DISABLED;
}
return $result;
}

/**
* Is the plugin auto-update enabled?
* Checks if the plugin's auto-update is enabled.
*
* @since 3.1.3
* @return bool Returns true if auto-update is enabled, false otherwise.
*/
public static function is_autoupdatable() {
return (self::is_updatable() && get_option('live_weather_station_auto_update'));
$is_updatable = self::is_updatable();
$auto_update_option = get_option('live_weather_station_auto_update');
return ($is_updatable && $auto_update_option);
}

/**
Expand Down

0 comments on commit 47dfac9

Please sign in to comment.