Changeset 6157
- Timestamp:
- 11/22/2017 11:31:00 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-routes/inc/cli/class-update-caches.php
r3002 r6157 11 11 private $cache_group = 'wporg-translate'; 12 12 13 private $running_all = false; 14 13 15 /** 14 16 * Update all caches. 15 17 */ 16 18 public function all() { 19 $this->running_all = true; 17 20 $this->contributors_count(); 18 21 $this->translation_status(); 19 22 $this->existing_locales(); 23 $this->running_all = false; 20 24 } 21 25 … … 33 37 } 34 38 35 $locales = GP::$translation_set->existing_locales();39 $locales = GP::$translation_set->existing_locales(); 36 40 $db_counts = $wpdb->get_results( 37 41 "SELECT `locale`, COUNT( DISTINCT user_id ) as `count` FROM {$wpdb->user_translations_count} WHERE `accepted` > 0 GROUP BY `locale`", 38 42 OBJECT_K 39 43 ); 44 45 if ( ! $db_counts || ! $locales ) { 46 if ( $this->running_all ) { 47 WP_CLI::warning( 'Retrieving contributors count failed.' ); 48 return; 49 } else { 50 WP_CLI::error( 'Retrieving contributors count failed.' ); 51 } 52 } 40 53 41 54 $counts = array(); … … 61 74 62 75 if ( ! isset( $wpdb->project_translation_status ) ) { 63 WP_CLI::error( 'The stats plugin seems not to be activated.' ); 64 return; 76 if ( $this->running_all ) { 77 WP_CLI::warning( 'Retrieving translation status failed: The stats plugin seems not to be activated.' ); 78 return; 79 } else { 80 WP_CLI::error( 'Retrieving translation status failed: The stats plugin seems not to be activated.' ); 81 } 65 82 } 66 83 … … 71 88 2, 'default' // 2 = wp/dev 72 89 ), OBJECT_K ); 90 91 if ( ! $translation_status ) { 92 if ( $this->running_all ) { 93 WP_CLI::warning( 'Retrieving translation status failed.' ); 94 return; 95 } else { 96 WP_CLI::error( 'Retrieving translation status failed.' ); 97 } 98 } 73 99 74 100 wp_cache_set( 'translation-status', $translation_status, $this->cache_group ); … … 84 110 $existing_locales = GP::$translation_set->existing_locales(); 85 111 112 if ( ! $existing_locales ) { 113 if ( $this->running_all ) { 114 WP_CLI::warning( 'Retrieving existing locales failed.' ); 115 return; 116 } else { 117 WP_CLI::error( 'Retrieving existing locales failed.' ); 118 } 119 } 120 86 121 wp_cache_set( 'existing-locales', $existing_locales, $this->cache_group ); 87 122 WP_CLI::success( 'Existing locales were updated.' );
Note: See TracChangeset
for help on using the changeset viewer.