Changeset 14917
- Timestamp:
- 05/25/2026 08:09:58 AM (6 hours ago)
- Location:
- sites/trunk/wordpress.org/public_html/wp-content/plugins
- Files:
-
- 3 edited
-
wporg-gp-custom-stats/stats/project.php (modified) (9 diffs)
-
wporg-gp-customizations/inc/cli/class-update-project-stats.php (modified) (3 diffs)
-
wporg-gp-routes/inc/routes/class-locale.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-custom-stats/stats/project.php
r11767 r14917 95 95 96 96 // Store the counts for these parent projects as the sum of their children. 97 $sql = "INSERT INTO {$wpdb->project_translation_status} ( `project_id`, `locale`, `locale_slug`, `all`, `current`, `waiting`, `fuzzy`, `warnings`, `untranslated`, ` date_added`, `date_modified`)97 $sql = "INSERT INTO {$wpdb->project_translation_status} ( `project_id`, `locale`, `locale_slug`, `all`, `current`, `waiting`, `fuzzy`, `warnings`, `untranslated`, `has_pending`, `date_added`, `date_modified`) 98 98 SELECT 99 99 p.parent_project_id as project_id, … … 101 101 SUM( stats.all ) as `all`, SUM( stats.current ) as `current`, SUM( stats.waiting ) as `waiting`, 102 102 SUM( stats.fuzzy ) as `fuzzy`, SUM( stats.warnings ) as `warnings`, SUM( stats.untranslated ) as `untranslated`, 103 ( SUM( stats.waiting ) > 0 OR SUM( stats.fuzzy ) > 0 ) as `has_pending`, 103 104 NOW() as `date_added`, NOW() as `date_modified` 104 105 FROM {$wpdb->project_translation_status} stats … … 112 113 `waiting` = VALUES(`waiting`), `fuzzy` = VALUES(`fuzzy`), 113 114 `warnings` = VALUES(`warnings`), `untranslated` = VALUES(`untranslated`), 115 `has_pending` = VALUES(`has_pending`), 114 116 `date_modified` = VALUES(`date_modified`); 115 117 "; … … 164 166 $counts = $this->get_project_translation_counts( $project_id, $locale, $locale_slug ); 165 167 166 $values[] = $wpdb->prepare( '(%d, %s, %s, %d, %d, %d, %d, %d, %d, % s, %s)',168 $values[] = $wpdb->prepare( '(%d, %s, %s, %d, %d, %d, %d, %d, %d, %d, %s, %s)', 167 169 $project_id, 168 170 $locale, … … 174 176 $counts['warnings'], 175 177 $counts['untranslated'], 178 ( $counts['waiting'] > 0 || $counts['fuzzy'] > 0 ) ? 1 : 0, 176 179 $now, 177 180 $now … … 181 184 // If we're processing a large batch, add them as we go to avoid query lengths & memory limits 182 185 if ( count( $values ) > 50 ) { 183 $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`)" ); 186 $wpdb->query( 187 "INSERT INTO {$wpdb->project_translation_status} 188 ( `project_id`, `locale`, `locale_slug`, 189 `all`, `current`, `waiting`, `fuzzy`, `warnings`, `untranslated`, `has_pending`, 190 `date_added`, `date_modified` ) 191 VALUES " . implode( ', ', $values ) . " 192 ON DUPLICATE KEY UPDATE 193 `all` = VALUES(`all`), 194 `current` = VALUES(`current`), 195 `waiting` = VALUES(`waiting`), 196 `fuzzy` = VALUES(`fuzzy`), 197 `warnings` = VALUES(`warnings`), 198 `untranslated` = VALUES(`untranslated`), 199 `has_pending` = VALUES(`has_pending`), 200 `date_modified` = VALUES(`date_modified`)" 201 ); 184 202 $values = array(); 185 203 } … … 188 206 189 207 if ( $values ) { 190 $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`)" ); 208 $wpdb->query( 209 "INSERT INTO {$wpdb->project_translation_status} 210 ( `project_id`, `locale`, `locale_slug`, 211 `all`, `current`, `waiting`, `fuzzy`, `warnings`, `untranslated`, `has_pending`, 212 `date_added`, `date_modified` ) 213 VALUES " . implode( ', ', $values ) . " 214 ON DUPLICATE KEY UPDATE 215 `all` = VALUES(`all`), 216 `current` = VALUES(`current`), 217 `waiting` = VALUES(`waiting`), 218 `fuzzy` = VALUES(`fuzzy`), 219 `warnings` = VALUES(`warnings`), 220 `untranslated` = VALUES(`untranslated`), 221 `has_pending` = VALUES(`has_pending`), 222 `date_modified` = VALUES(`date_modified`)" 223 ); 191 224 } 192 225 } … … 198 231 199 232 CREATE TABLE `gp_project_translation_status` ( 200 `id` int(10) unsigned NOT NULL AUTO_INCREMENT,233 `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, 201 234 `project_id` int(10) unsigned NOT NULL, 202 235 `locale` varchar(10) NOT NULL, … … 208 241 `warnings` int(10) unsigned NOT NULL DEFAULT '0', 209 242 `untranslated` int(10) unsigned NOT NULL DEFAULT '0', 243 `has_pending` tinyint(1) NOT NULL DEFAULT 0, 244 `date_added` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', 245 `date_modified` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', 210 246 PRIMARY KEY (`id`), 211 247 UNIQUE KEY `project_locale` (`project_id`,`locale`,`locale_slug`), 212 KEY `all` (`all`), 213 KEY `current` (`current`), 214 KEY `waiting` (`waiting`), 215 KEY `fuzzy` (`fuzzy`), 216 KEY `warnings` (`warnings`), 217 KEY `untranslated` (`untranslated`) 248 KEY `locale` (`locale`,`locale_slug`,`has_pending`), 249 KEY `date_added` (`date_added`), 250 KEY `date_modified` (`date_modified`) 218 251 ) ENGINE=InnoDB DEFAULT CHARSET=latin1; 219 252 -
sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-customizations/inc/cli/class-update-project-stats.php
r14594 r14917 273 273 'warnings' => isset( $stats['warnings'] ) ? $stats['warnings'] : 0, 274 274 'untranslated' => $stats['untranslated'], 275 'has_pending' => ( $stats['waiting'] > 0 || $stats['fuzzy'] > 0 ) ? 1 : 0, 275 276 'date_modified' => current_time( 'mysql' ), 276 277 ); … … 306 307 '%d', // warnings 307 308 '%d', // untranslated 309 '%d', // has_pending 308 310 '%s', // date_modified 309 311 ), 310 312 array( '%d' ) 311 313 ); 312 } 314 } 313 315 // else { 314 316 // // Insert new record 315 317 // $data['date_added'] = current_time( 'mysql' ); 316 318 317 319 // $result = $wpdb->insert( 318 320 // "{$wpdb->project_translation_status}", … … 328 330 // '%d', // warnings 329 331 // '%d', // untranslated 332 // '%d', // has_pending 330 333 // '%s', // date_added 331 334 // '%s', // date_modified -
sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-routes/inc/routes/class-locale.php
r14915 r14917 785 785 if ( $can_approve_for_all ) { 786 786 // The current user can approve for all projects, so just grab all with any waiting strings. 787 $stats_where = ' AND ( stats.waiting > 0 OR stats.fuzzy > 0 )';787 $stats_where = ' AND stats.has_pending = 1'; 788 788 $tp_where = $base_level_project_sql; 789 789 } elseif ( $allowed_projects || $allowed_base_level_projects ) { 790 $stats_where = ' AND ( stats.waiting > 0 OR stats.fuzzy > 0 )';790 $stats_where = ' AND stats.has_pending = 1'; 791 791 $tp_where = ' AND ( ('; 792 792 … … 885 885 886 886 case 'strings-waiting-and-fuzzy': 887 $stats_where .= ' AND ( stats.waiting > 0 OR stats.fuzzy > 0 )';888 $filter_order_by = "tp.path LIKE 'wp/%%' AND (stats.fuzzy + stats.waiting) > 0DESC, (stats.fuzzy + stats.waiting) $sort_order, tp.name ASC";887 $stats_where .= ' AND stats.has_pending = 1'; 888 $filter_order_by = "tp.path LIKE 'wp/%%' DESC, (stats.fuzzy + stats.waiting) $sort_order, tp.name ASC"; 889 889 break; 890 890 891 891 case 'strings-waiting-and-fuzzy-by-modified-date': 892 $stats_where .= ' AND ( stats.waiting > 0 OR stats.fuzzy > 0 )AND stats.date_modified > "0000-00-00 00:00:00"';892 $stats_where .= ' AND stats.has_pending = 1 AND stats.date_modified > "0000-00-00 00:00:00"'; 893 893 $filter_order_by = "stats.date_modified $sort_order, tp.name ASC"; 894 894 break;
Note: See TracChangeset
for help on using the changeset viewer.