Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a flag to skip cache when getting scan stats #834

Merged
merged 3 commits into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/phpunit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ jobs:
# Bust the cache at least once a month - output format: YYYY-MM-DD.
custom-cache-suffix: $(date -u -d "-0 month -$(($(date +%d)-1)) days" "+%F")

# Some images won't have svn available. Install it if that's the case.
- name: Install SVN
run: sudo apt-get update && sudo apt-get install -y subversion

- name: Install WP
shell: bash
run: tests/bin/install-wp-tests.sh wordpress_tests root '' 127.0.0.1:3306 ${{ matrix.wp_version }}
Expand Down
7 changes: 4 additions & 3 deletions admin/class-scans-stats.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,17 +109,18 @@ public function clear_cache() {
/**
* Gets summary information about all scans
*
* @return array .
* @param boolean $skip_cache whether to skip the cache.
* @return array
*/
public function summary() {
public function summary( $skip_cache = false ) {

global $wpdb;

$transient_name = $this->cache_name_prefix . '_summary';

$cache = get_transient( $transient_name );

if ( $this->cache_time && $cache ) {
if ( ! $skip_cache && ( $this->cache_time && $cache ) ) {

if ( $cache['expires_at'] >= time() && $cache['cached_at'] + $this->cache_time >= time()
) {
Expand Down
4 changes: 2 additions & 2 deletions tests/phpunit/helper-functions/OrdinalTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,15 +132,15 @@ public function edac_ordinal_data() {
// Tests for the `ar` locale.
'integer 1, ar' => [
'numeric_value' => 1,
'ordinal_value' => '١.',
'ordinal_value' => '١',
'locale' => 'ar',
'ordinal_value_no_php-intl' => '1st',
],

// Tests for the `el_GR` locale.
'integer 1, el_GR' => [
'numeric_value' => 1,
'ordinal_value' => '1.',
'ordinal_value' => '1',
'locale' => 'el_GR',
'ordinal_value_no_php-intl' => '1st',
],
Expand Down
Loading