Making WordPress.org

Changeset 13279


Ignore:
Timestamp:
03/05/2024 01:17:22 PM (14 months ago)
Author:
amieiro
Message:

Translate: Sync "Translation Events" from GitHub

Location:
sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/stats-calculator.php

    r13268 r13279  
    6666    public function for_event( WP_Post $event ): Event_Stats {
    6767        $stats = new Event_Stats();
    68         global $wpdb;
     68        global $wpdb, $gp_table_prefix;
    6969
     70        // phpcs:disable WordPress.DB.PreparedSQL.InterpolatedNotPrepared
    7071        // phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery
    7172        // phpcs:disable WordPress.DB.DirectDatabaseQuery.NoCaching
     
    7980                       count(*) as total,
    8081                       count(distinct user_id) as users
    81                 from {$wpdb->base_prefix}event_actions
     82                from {$gp_table_prefix}event_actions
    8283                where event_id = %d
    8384                group by locale with rollup
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/stats-listener.php

    r13270 r13279  
    7676            /** @var GP_Translation_Set $translation_set Translation set */
    7777            $translation_set = ( new GP_Translation_Set() )->find_one( array( 'id' => $translation->translation_set_id ) );
    78             global $wpdb;
     78            global $wpdb, $gp_table_prefix;
    7979
    8080            foreach ( $events as $event ) {
    8181                // A given user can only do one action on a specific translation.
    8282                // So we insert ignore, which will keep only the first action.
     83                // phpcs:disable WordPress.DB.PreparedSQL.InterpolatedNotPrepared
    8384                // phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery
    8485                // phpcs:disable WordPress.DB.DirectDatabaseQuery.NoCaching
    8586                $wpdb->query(
    8687                    $wpdb->prepare(
    87                         "insert ignore into {$wpdb->base_prefix}event_actions (event_id, locale, user_id, original_id, action, happened_at) values (%d, %s, %d, %d, %s, %s)",
     88                        "insert ignore into {$gp_table_prefix}event_actions (event_id, locale, user_id, original_id, action, happened_at) values (%d, %s, %d, %d, %s, %s)",
    8889                        array(
    8990                            // Start unique key.
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/wporg-gp-translation-events.php

    r13269 r13279  
    7373
    7474    public function activate() {
    75         global $wpdb;
     75        global $gp_table_prefix;
    7676        $create_table = "
    77         CREATE TABLE `{$wpdb->base_prefix}event_actions` (
     77        CREATE TABLE `{$gp_table_prefix}event_actions` (
    7878            `translate_event_actions_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
    7979            `event_id` int(10) NOT NULL COMMENT 'Post_ID of the translation_event post in the wp_posts table',
Note: See TracChangeset for help on using the changeset viewer.