Changeset 1782
- Timestamp:
- 07/23/2015 08:08:28 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/translate.wordpress.org/includes/gp-plugins/wporg-routes/cli/wporg-update-cached-data.php
r1530 r1782 9 9 public $cache_group = 'wporg-translate'; 10 10 11 private $locales = array(); 12 11 13 public function run() { 14 $this->locales = GP::$translation_set->existing_locales(); 15 12 16 $this->update_contributors_count(); 13 17 $this->update_translation_status(); … … 20 24 global $gpdb; 21 25 22 $results = $gpdb->get_results( " 23 SELECT ts.locale, COUNT( DISTINCT( t.user_id ) ) AS count 24 FROM $gpdb->translations t 25 INNER JOIN $gpdb->translation_sets AS ts 26 ON ts.id = t.translation_set_id 27 WHERE 28 ( t.status = 'current' || t.status = 'old' ) 29 AND t.user_id IS NOT NULL 30 AND t.user_id <> '0' 31 GROUP BY ts.locale 32 " ); 26 $counts = array(); 27 foreach ( $this->locales as $locale ) { 28 $result = $gpdb->get_var( $gpdb->prepare( " 29 SELECT COUNT( DISTINCT( t.user_id ) ) AS count 30 FROM {$gpdb->translations} t 31 INNER JOIN {$gpdb->translation_sets} AS ts 32 ON ts.id = t.translation_set_id 33 WHERE 34 ( t.status = 'current' || t.status = 'old' ) 35 AND t.user_id IS NOT NULL 36 AND t.user_id <> '0' 37 AND ts.locale = %s 38 ", $locale ) ); 33 39 34 $counts = array();35 if ( $results ) {36 foreach ( $results as $result ){37 $counts[ $ result->locale ] = $result->count;40 if ( $result ) { 41 $counts[ $locale ] = $result; 42 } else { 43 $counts[ $locale ] = 0; 38 44 } 39 45 } … … 48 54 global $gpdb; 49 55 50 $locales = GP::$translation_set->existing_locales();51 56 $projects = GP::$project->many( " 52 57 SELECT * 53 FROM $gpdb->projects58 FROM {$gpdb->projects} 54 59 WHERE 55 60 path LIKE 'wp/dev%' … … 58 63 $translation_status = array(); 59 64 foreach ( $projects as $project ) { 60 foreach ( $ locales as $locale ) {65 foreach ( $this->locales as $locale ) { 61 66 $set = GP::$translation_set->by_project_id_slug_and_locale( 62 67 $project->id,
Note: See TracChangeset
for help on using the changeset viewer.