Making WordPress.org


Ignore:
Timestamp:
11/13/2016 11:17:57 PM (10 years ago)
Author:
ocean90
Message:

Translate, Project Stats: Store current time when updating stats.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-custom-stats/stats/project.php

    r2657 r4355  
    110110                unset( $projects );
    111111
     112                $now = current_time( 'mysql', 1 );
     113
    112114                foreach ( $this->projects_to_update as $project_id => $locale_sets ) {
    113115                        $locale_sets = array_keys( $locale_sets );
     
    118120                                $counts = $this->get_project_translation_counts( $project_id, $locale, $locale_slug );
    119121
    120                                 $values[] = $wpdb->prepare( '(%d, %s, %s, %d, %d, %d, %d, %d, %d)',
     122                                $values[] = $wpdb->prepare( '(%d, %s, %s, %d, %d, %d, %d, %d, %d, %s, %s)',
    121123                                        $project_id,
    122124                                        $locale,
     
    127129                                        $counts['fuzzy'],
    128130                                        $counts['warnings'],
    129                                         $counts['untranslated']
     131                                        $counts['untranslated'],
     132                                        $now,
     133                                        $now
    130134                                );
    131135                        }
     
    133137                        // If we're processing a large batch, add them as we go to avoid query lengths & memory limits
    134138                        if ( count( $values ) > 50 ) {
    135                                 $wpdb->query( "INSERT INTO {$wpdb->project_translation_status} (`project_id`, `locale`, `locale_slug`, `all`, `current`, `waiting`, `fuzzy`, `warnings`, `untranslated` ) VALUES " . implode( ', ', $values ) . " ON DUPLICATE KEY UPDATE `all`=VALUES(`all`), `current`=VALUES(`current`), `waiting`=VAlUES(`waiting`), `fuzzy`=VALUES(`fuzzy`), `warnings`=VALUES(`warnings`), `untranslated`=VALUES(`untranslated`)" );
     139                                $wpdb->query( "INSERT INTO {$wpdb->project_translation_status} (`project_id`, `locale`, `locale_slug`, `all`, `current`, `waiting`, `fuzzy`, `warnings`, `untranslated`, `date_added`, `date_modified` ) VALUES " . implode( ', ', $values ) . " ON DUPLICATE KEY UPDATE `all`=VALUES(`all`), `current`=VALUES(`current`), `waiting`=VAlUES(`waiting`), `fuzzy`=VALUES(`fuzzy`), `warnings`=VALUES(`warnings`), `untranslated`=VALUES(`untranslated`), `date_modified`=VALUES(`date_modified`)" );
    136140                                $values = array();
    137141                        }
     
    140144
    141145                if ( $values ) {
    142                         $wpdb->query( "INSERT INTO {$wpdb->project_translation_status} (`project_id`, `locale`, `locale_slug`, `all`, `current`, `waiting`, `fuzzy`, `warnings`, `untranslated` ) VALUES " . implode( ', ', $values ) . " ON DUPLICATE KEY UPDATE `all`=VALUES(`all`), `current`=VALUES(`current`), `waiting`=VALUES(`waiting`), `fuzzy`=VALUES(`fuzzy`), `warnings`=VALUES(`warnings`), `untranslated`=VALUES(`untranslated`)" );
     146                        $wpdb->query( "INSERT INTO {$wpdb->project_translation_status} (`project_id`, `locale`, `locale_slug`, `all`, `current`, `waiting`, `fuzzy`, `warnings`, `untranslated`, `date_added`, `date_modified` ) VALUES " . implode( ', ', $values ) . " ON DUPLICATE KEY UPDATE `all`=VALUES(`all`), `current`=VALUES(`current`), `waiting`=VALUES(`waiting`), `fuzzy`=VALUES(`fuzzy`), `warnings`=VALUES(`warnings`), `untranslated`=VALUES(`untranslated`), `date_modified`=VALUES(`date_modified`)" );
    143147                }
    144148        }
Note: See TracChangeset for help on using the changeset viewer.