diff --git a/code/wp-content/mu-plugins/hostforge-systems.php b/code/wp-content/mu-plugins/hostforge-systems.php
index 6595b756ce..d5ba1343a3 100644
--- a/code/wp-content/mu-plugins/hostforge-systems.php
+++ b/code/wp-content/mu-plugins/hostforge-systems.php
@@ -1,9 +1,11 @@
updates = [];
+ $clean->version_checked = $current_version;
+ $clean->last_checked = time();
+
+ if (isset($transient->translations) && is_array($transient->translations)) {
+ $clean->translations = $transient->translations;
+ } else {
+ $clean->translations = [];
}
- $transient->updates = [];
- $transient->version_checked = get_bloginfo('version');
- $transient->last_checked = time();
-
- return $transient;
+ return $clean;
}
/**
- * Remove the default WordPress update nag from the admin area.
+ * Remove the default WordPress core update nag.
*
* @return void
*/
@@ -69,80 +75,63 @@ class Disable_Core_Updates implements Module_Interface
}
/**
- * Block manual WordPress core upgrade attempts from wp-admin.
+ * Clear any previously cached core update transient.
*
* @return void
*/
- public function block_manual_core_upgrade(): void
+ public function clear_existing_core_update_transient(): void
{
if (! is_admin()) {
return;
}
+ delete_site_transient('update_core');
+ }
+
+ /**
+ * Remove the WordPress Updates submenu.
+ *
+ * @return void
+ */
+ public function remove_update_core_submenu(): void
+ {
if (! current_user_can('update_core')) {
return;
}
- $page = isset($_GET['page']) ? sanitize_text_field(wp_unslash($_GET['page'])) : '';
- $action = isset($_GET['action']) ? sanitize_text_field(wp_unslash($_GET['action'])) : '';
-
- $is_core_upgrade_request =
- $action === 'do-core-upgrade' ||
- $page === 'update-core.php' ||
- (isset($_SERVER['PHP_SELF']) && str_contains(wp_unslash($_SERVER['PHP_SELF']), 'update-core.php'));
-
- if (! $is_core_upgrade_request) {
- return;
- }
-
- if ($action !== 'do-core-upgrade') {
- return;
- }
-
- wp_die(
- esc_html__(
- 'WordPress core updates are disabled in wp-admin. Please use the HostForge Dashboard to manage core updates.',
- 'hostforge-systems'
- ),
- esc_html__('Core Updates Disabled', 'hostforge-systems'),
- ['response' => 403]
- );
+ remove_submenu_page('index.php', 'update-core.php');
+ remove_submenu_page('options-general.php', 'update-core.php');
}
/**
- * Render a HostForge notice on the Updates screen.
+ * Render a HostForge notice on dashboard and update-related screens.
*
* @return void
*/
- public function render_updates_screen_notice(): void
+ public function render_dashboard_notice(): void
{
- if (! $this->is_updates_screen()) {
+ if (! is_admin()) {
+ return;
+ }
+
+ $screen = function_exists('get_current_screen') ? get_current_screen() : null;
+
+ if (! $screen || empty($screen->id)) {
+ return;
+ }
+
+ $allowed_screens = [
+ 'dashboard',
+ 'update-core',
+ ];
+
+ if (! in_array($screen->id, $allowed_screens, true)) {
return;
}
Notice::render(
- 'HostForge Notice: WordPress core updates are managed through the HostForge Dashboard and are disabled in wp-admin.',
+ 'HostForge Notice: WordPress core updates are managed through the HostForge Dashboard.',
'info'
);
}
-
- /**
- * Determine whether the current screen is the Updates screen.
- *
- * @return bool
- */
- protected function is_updates_screen(): bool
- {
- if (! is_admin() || ! function_exists('get_current_screen')) {
- return false;
- }
-
- $screen = get_current_screen();
-
- if (! $screen || empty($screen->id)) {
- return false;
- }
-
- return $screen->id === 'update-core';
- }
}
\ No newline at end of file