Making WordPress.org


Ignore:
Timestamp:
04/09/2020 06:54:12 AM (5 years ago)
Author:
dd32
Message:

Translate: Restore the Waiting Counts for Plugins/Themes as their own columns.

The column values are updated twice daily on a cron.

Fixes #3155.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-routes/inc/class-plugin.php

    r9616 r9711  
    4747
    4848        add_action( 'init', [ $this, 'respect_robots_txt' ], 9 );
     49
     50        add_action( 'init', [ $this, 'cron_tasks' ] );
    4951    }
    5052
     
    5860        // ?gp_route=robots.txt is here, as GlotPress ultimately is the router for the request.
    5961        add_rewrite_rule( '^robots\.txt$', 'index.php?robots=1&gp_route=robots.txt', 'top' );
     62    }
     63
     64    /**
     65     * Some pages rely upon a regular cron task to update the stats rather than live updates.
     66     */
     67    function cron_tasks() {
     68        if ( ! wp_next_scheduled ( 'wporg_gp_stats_cache_waiting_strings' ) ) {
     69            wp_schedule_event( time(), 'twicedaily', 'wporg_gp_stats_cache_waiting_strings' );
     70        }
     71        add_action( 'wporg_gp_stats_cache_waiting_strings', [ __NAMESPACE__ . '\Routes\Stats', 'cache_waiting_strings' ] );
    6072    }
    6173
Note: See TracChangeset for help on using the changeset viewer.