Making WordPress.org

Changeset 12114


Ignore:
Timestamp:
10/11/2022 10:34:54 AM (4 years ago)
Author:
amieiro
Message:

Translate: Add the stats generator to the daily cron

Location:
sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-customizations/inc
Files:
2 added
1 deleted
1 edited

Legend:

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

    r12112 r12114  
    66use GP_Locales;
    77use GP_Translation;
    8 use WordPressdotorg\GlotPress\Customizations\CLI\Show_Stats;
     8use WordPressdotorg\GlotPress\Customizations\CLI\Stats;
    99use WP_CLI;
    1010
     
    6161                add_action( 'init', [ $this, 'register_cron_events' ] );
    6262                add_action( 'wporg_translate_update_contributor_profile_badges', [ $this, 'update_contributor_profile_badges' ] );
     63                add_action( 'wporg_translate_update_polyglots_stats', [ $this, 'update_polyglots_stats' ] );
    6364
    6465                // Toolbar.
     
    130131                if ( ! wp_next_scheduled( 'wporg_translate_update_contributor_profile_badges' ) ) {
    131132                        wp_schedule_event( time(), '15_minutes', 'wporg_translate_update_contributor_profile_badges' );
     133                }
     134                if ( ! wp_next_scheduled( 'wporg_translate_update_polyglots_stats' ) ) {
     135                        wp_schedule_event( time(), 'daily', 'wporg_translate_update_polyglots_stats' );
    132136                }
    133137        }
     
    179183
    180184                update_option( 'wporg_translate_last_badges_sync', $now );
     185        }
     186
     187        /**
     188         * Updates the Polyglots stats at https://make.wordpress.org/polyglots/stats/
     189         *
     190         * @return void
     191         */
     192        public function update_polyglots_stats() {
     193                $stats = new Stats();
     194                $stats();
    181195        }
    182196
     
    449463                WP_CLI::add_command( 'wporg-translate export', __NAMESPACE__ . '\CLI\Export' );
    450464                WP_CLI::add_command( 'wporg-translate export-json', __NAMESPACE__ . '\CLI\Export_Json' );
    451                 WP_CLI::add_command( 'wporg-translate show-stats', __NAMESPACE__ . '\CLI\Show_Stats' );
     465                WP_CLI::add_command( 'wporg-translate show-stats', __NAMESPACE__ . '\CLI\Stats_Print' );
    452466
    453467        }
Note: See TracChangeset for help on using the changeset viewer.