Description: Disable auto update site checks
 If this WordPress package is installed then you cannot use the standard WordPress
core auto-update system so any warnings about it need to be removed.
Files should not be writable by the webserver user so reverse that check too.
Added a note that updates are done by the Debian package system.
Author: Craig Small <csmall@debian.org>
Forwarded: no-needed
Reviewed-by: Craig Small <csmall@debian.org>
Last-Update: 2024-11-20
---
--- a/wp-admin/includes/class-wp-site-health-auto-updates.php
+++ b/wp-admin/includes/class-wp-site-health-auto-updates.php
@@ -28,16 +28,17 @@
 	 */
 	public function run_tests() {
 		$tests = array(
-			$this->test_constants( 'WP_AUTO_UPDATE_CORE', array( true, 'beta', 'rc', 'development', 'branch-development', 'minor' ) ),
+			$this->test_debian_note(),
+//			$this->test_constants( 'WP_AUTO_UPDATE_CORE', array( true, 'beta', 'rc', 'development', 'branch-development', 'minor' ) ),
 			$this->test_wp_version_check_attached(),
 			$this->test_filters_automatic_updater_disabled(),
 			$this->test_wp_automatic_updates_disabled(),
-			$this->test_if_failed_update(),
+//			$this->test_if_failed_update(),
 			$this->test_vcs_abspath(),
 			$this->test_check_wp_filesystem_method(),
-			$this->test_all_files_writable(),
-			$this->test_accepts_dev_updates(),
-			$this->test_accepts_minor_updates(),
+			$this->test_all_files_unwritable(),
+//			$this->test_accepts_dev_updates(),
+//			$this->test_accepts_minor_updates(),
 		);
 
 		$tests = array_filter( $tests );
@@ -57,6 +58,17 @@
 		return $tests;
 	}
 
+        /**
+         * Adds an info note that Debian is used for updates
+         *
+         */
+        public function test_debian_note() {
+            return array(
+                'description' => 'Updates are managed by the Debian package system',
+                'severity' => 'info',
+            );
+        }
+
 	/**
 	 * Tests if auto-updates related constants are set correctly.
 	 *
@@ -306,7 +318,9 @@
 	}
 
 	/**
-	 * Checks if core files are writable by the web user/group.
+	 * Checks if core files are unwritable by the web user/group.
+         * Debian systems should not have these files writable as the packaging system
+         * updates them
 	 *
 	 * @since 5.2.0
 	 *
@@ -314,7 +328,7 @@
 	 *
 	 * @return array|false The test results. False if they're not writeable.
 	 */
-	public function test_all_files_writable() {
+	public function test_all_files_unwritable() {
 		global $wp_filesystem;
 
 		require ABSPATH . WPINC . '/version.php'; // $wp_version; // x.y.z
@@ -370,7 +384,7 @@
 			if ( ! file_exists( ABSPATH . $file ) ) {
 				continue;
 			}
-			if ( ! is_writable( ABSPATH . $file ) ) {
+			if ( is_writable( ABSPATH . $file ) ) {
 				$unwritable_files[] = $file;
 			}
 		}
@@ -381,12 +395,12 @@
 				$unwritable_files[] = '...';
 			}
 			return array(
-				'description' => __( 'Some files are not writable by WordPress:' ) . ' <ul><li>' . implode( '</li><li>', $unwritable_files ) . '</li></ul>',
+				'description' => __( 'Some files are writable by WordPress:' ) . ' <ul><li>' . implode( '</li><li>', $unwritable_files ) . '</li></ul>',
 				'severity'    => 'fail',
 			);
 		} else {
 			return array(
-				'description' => __( 'All of your WordPress files are writable.' ),
+				'description' => __( 'All of your WordPress files are unwritable.' ),
 				'severity'    => 'pass',
 			);
 		}
