Making WordPress.org


Ignore:
Timestamp:
04/14/2020 04:55:52 AM (4 years ago)
Author:
dd32
Message:

Translate: Move the stats generation for /stats from the Stats screen router to the Custom Stats plugin, store the data in the project translation status table rather than the options.

This also avoids the query-timeout problems by running the query as a INSERT INTO ... SELECT FROM which should be more resiliant to timeouts.

See #3155.

File:
1 edited

Legend:

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

    r9711 r9720  
    4747
    4848        add_action( 'init', [ $this, 'respect_robots_txt' ], 9 );
    49 
    50         add_action( 'init', [ $this, 'cron_tasks' ] );
    5149    }
    5250
     
    6058        // ?gp_route=robots.txt is here, as GlotPress ultimately is the router for the request.
    6159        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' ] );
    7260    }
    7361
Note: See TracChangeset for help on using the changeset viewer.