From 09b450642f3a8b0ae55b60a792aa447909d59591 Mon Sep 17 00:00:00 2001 From: Caleb Stauffer Date: Thu, 13 Jul 2023 11:52:28 -0400 Subject: [PATCH 1/3] save --- collectors/conditionals.php | 1 + collectors/environment.php | 1 + output/html/environment.php | 1 + 3 files changed, 3 insertions(+) diff --git a/collectors/conditionals.php b/collectors/conditionals.php index 22d3372b0..b069619d1 100644 --- a/collectors/conditionals.php +++ b/collectors/conditionals.php @@ -49,6 +49,7 @@ public function process() { 'is_feed', 'is_front_page', 'is_home', + 'is_login', 'is_main_network', 'is_main_site', 'is_month', diff --git a/collectors/environment.php b/collectors/environment.php index 0275d1283..f704d184d 100644 --- a/collectors/environment.php +++ b/collectors/environment.php @@ -224,6 +224,7 @@ public function process() { 'host' => null, 'OS' => null, 'arch' => null, + 'basicauth' => wp_is_site_protected_by_basic_auth() ? 'true' : 'false', ); if ( function_exists( 'php_uname' ) ) { diff --git a/output/html/environment.php b/output/html/environment.php index 99a7a28b0..81f4889d6 100644 --- a/output/html/environment.php +++ b/output/html/environment.php @@ -274,6 +274,7 @@ public function output() { /* translators: OS stands for Operating System */ 'OS' => __( 'OS', 'query-monitor' ), 'arch' => __( 'Architecture', 'query-monitor' ), + 'basicauth' => __( 'Basic Auth', 'query-monitor' ), ); echo ''; From e2f50a191f896a1808fc9815b1502db1cae9fc27 Mon Sep 17 00:00:00 2001 From: Caleb Stauffer Date: Wed, 2 Aug 2023 13:32:06 -0400 Subject: [PATCH 2/3] check function exists --- collectors/environment.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/collectors/environment.php b/collectors/environment.php index f704d184d..7f0518528 100644 --- a/collectors/environment.php +++ b/collectors/environment.php @@ -224,9 +224,12 @@ public function process() { 'host' => null, 'OS' => null, 'arch' => null, - 'basicauth' => wp_is_site_protected_by_basic_auth() ? 'true' : 'false', ); + if ( function_exists( 'wp_is_site_protected_by_basic_auth' ) ) { + $this->data->server['basicauth'] = wp_is_site_protected_by_basic_auth() ? 'true' : 'false'; + } + if ( function_exists( 'php_uname' ) ) { $this->data->server['host'] = php_uname( 'n' ); $this->data->server['OS'] = php_uname( 's' ) . ' ' . php_uname( 'r' ); From 2c2c40c8a42f00d7bf27e6c125fbd9c61f805559 Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Sat, 27 Jul 2024 23:47:03 +0100 Subject: [PATCH 3/3] This function exists since 5.6.1. --- collectors/environment.php | 5 +---- data/environment.php | 1 + 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/collectors/environment.php b/collectors/environment.php index 5cb9547b3..a402838a2 100644 --- a/collectors/environment.php +++ b/collectors/environment.php @@ -224,12 +224,9 @@ public function process() { 'host' => null, 'OS' => null, 'arch' => null, + 'basicauth' => wp_is_site_protected_by_basic_auth() ? 'true' : 'false', ); - if ( function_exists( 'wp_is_site_protected_by_basic_auth' ) ) { - $this->data->server['basicauth'] = wp_is_site_protected_by_basic_auth() ? 'true' : 'false'; - } - if ( function_exists( 'php_uname' ) ) { $this->data->server['host'] = php_uname( 'n' ); $this->data->server['OS'] = php_uname( 's' ) . ' ' . php_uname( 'r' ); diff --git a/data/environment.php b/data/environment.php index 72b42ede7..364533b16 100644 --- a/data/environment.php +++ b/data/environment.php @@ -62,6 +62,7 @@ class QM_Data_Environment extends QM_Data { * host: string|null, * OS: string|null, * arch: string|null, + * basicauth: 'true'|'false', * }> */ public $server;