From 2429e171309a51dddc6b457d8e5eba971987f70b Mon Sep 17 00:00:00 2001 From: matt Date: Sun, 24 Sep 2023 16:54:58 -0500 Subject: [PATCH 1/2] Fixes #323 --- includes/classes/class-scans-stats.php | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/includes/classes/class-scans-stats.php b/includes/classes/class-scans-stats.php index f8d53a9d..5dd75017 100644 --- a/includes/classes/class-scans-stats.php +++ b/includes/classes/class-scans-stats.php @@ -53,7 +53,7 @@ class Scans_Stats { public function __construct( $cache_time = 60 * 60 * 24 ) { $this->cache_time = $cache_time; - $this->cache_name_prefix = 'edac_scans_stats_' . $this->record_limit; + $this->cache_name_prefix = 'edac_scans_stats_' . EDAC_VERSION . '_' . $this->record_limit; $this->rule_count = count( edac_register_rules() ); } @@ -122,7 +122,10 @@ public function summary() { $transient_name = $this->cache_name_prefix . '_summary'; $cache = get_transient( $transient_name ); - + + // TODO: + $cache = false; + if ( $this->cache_time && $cache ) { @@ -145,6 +148,7 @@ public function summary() { $scannable_posts_count = Settings::get_scannable_posts_count(); $tests_count = $scannable_posts_count * $this->rule_count; + $siteid = get_current_blog_id(); $data['scannable_posts_count'] = (int) $scannable_posts_count; @@ -236,6 +240,7 @@ public function summary() { ) . ') and post_status IN(' . Helpers::array_to_sql_safe_list( Settings::get_scannable_post_statuses() ) . ')'; + // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared $data['posts_without_issues'] = $wpdb->get_var( $sql ); @@ -251,8 +256,10 @@ public function summary() { $wpdb->get_var( $wpdb->prepare( 'SELECT avg(meta_value) from ' . $wpdb->postmeta . ' - WHERE meta_key = %s and meta_value > %d;', - array( '_edac_issue_density', 0 ) + JOIN ' . $wpdb->prefix . 'accessibility_checker ON postid=post_id + WHERE meta_key = %s and meta_value > %d + and ' . $wpdb->prefix . 'accessibility_checker.siteid=%d and ignre=%d and ignre_global=%d LIMIT %d', + array( '_edac_issue_density', 0, $siteid, 0, 0, $this->record_limit ) ) ); From b2e57eb28ea5d48daa8a47de19aba3c5880b0570 Mon Sep 17 00:00:00 2001 From: matt Date: Tue, 26 Sep 2023 15:25:26 -0500 Subject: [PATCH 2/2] Remove TODO --- includes/classes/class-scans-stats.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/includes/classes/class-scans-stats.php b/includes/classes/class-scans-stats.php index 5dd75017..f640d7d3 100644 --- a/includes/classes/class-scans-stats.php +++ b/includes/classes/class-scans-stats.php @@ -123,9 +123,6 @@ public function summary() { $cache = get_transient( $transient_name ); - // TODO: - $cache = false; - if ( $this->cache_time && $cache ) {