Changeset 13063 for sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/tools/class-stats-report.php
- Timestamp:
- 12/18/2023 01:32:39 AM (10 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/tools/class-stats-report.php
r13033 r13063 94 94 global $wpdb; 95 95 96 $stats['as_of_date'] = gmdate( 'Y-m-d' );97 98 96 $defaults = array( 99 'date' => $stats['as_of_date'],97 'date' => gmdate( 'Y-m-d' ), 100 98 'num_days' => 7, 101 99 'recentdays' => 7, … … 235 233 global $wpdb; 236 234 237 $stats['as_of_date'] = gmdate( 'Y-m-d' );238 239 235 $defaults = array( 240 'date' => $stats['as_of_date'],236 'date' => gmdate( 'Y-m-d' ), 241 237 'num_days' => 7, 242 238 'recentdays' => 7, … … 248 244 249 245 $stats = $args; 250 $stats['data'] = []; 246 $stats['start_date'] = gmdate( 'Y-m-d', time() - ( $args['num_days'] * DAY_IN_SECONDS ) ); 247 $stats['data'] = []; 251 248 252 249 $reviewers = get_users( [ … … 298 295 299 296 // Fetch HelpScout stats from our stats. We might be able to pull some information from HS Stats instead. 297 $stats_field_prefix = 'hs-plugins-'; 298 if ( 299 // See https://meta.trac.wordpress.org/changeset/13010 300 strtotime( $stats['start_date'] ) < strtotime('2023-12-06') 301 ) { 302 $stats_field_prefix = 'hs-'; 303 $stats['all-hs-warning'] = true; 304 } 305 300 306 $emails = $wpdb->get_results( $wpdb->prepare( 301 307 "SELECT `name`, `value`, SUM(views) AS count 302 308 FROM %i 303 WHERE `name` IN( 'hs-total', 'hs-replies')309 WHERE `name` IN( %s, %s ) 304 310 AND `value` IN( {$reviewer_nicenames_list} ) 305 AND `date` > DATE_SUB( %s, INTERVAL %d DAY )311 AND `date` > %s 306 312 GROUP BY `name`, `value`", 307 313 'stats_extras', 308 $args['date'], 309 $args['num_days'] 314 $stats_field_prefix . 'total', 315 $stats_field_prefix . 'replies', 316 $stats['start_date'] 310 317 ) ); 311 318 312 319 foreach ( $emails as $row ) { 313 320 $user = get_user_by( 'slug', $row->value ); 314 $field = 'hs-total' === $row->name? 'Email Actions' : 'Email Replies';321 $field = str_ends_with( $row->name, '-total' ) ? 'Email Actions' : 'Email Replies'; 315 322 $stats['data'][ $user->ID ] ??= []; 316 323 $stats['data'][ $user->ID ][ $field ] = $row->count; … … 725 732 ?> 726 733 <ul style="font-style:italic;"> 727 <li><code>^</code> : This is currently of all Helpscout mailboxes, not Plugins specific. Requires your Helpscout email to be the same as your WordPress.org email, or as one of your profiles alternate emails.</li> 734 <?php if ( isset( $user_stats['all-hs-warning'] ) ) : ?> 735 <li><code>^</code> : This is of all Helpscout mailboxes, not Plugins specific, as plugins-only data is only available after <a href="https://meta.trac.wordpress.org/changeset/13010">2023-12-05</a>.</li> 736 <?php endif; ?> 737 <li><code>^</code> : Requires your Helpscout email to be the same as your WordPress.org email, or as one of your profiles alternate emails.</li> 728 738 <li><code>^</code> : Email "Actions" include sending emails, replying to emails, marking as spam, moving to different inbox, etc.</li> 729 739 </ul>
Note: See TracChangeset
for help on using the changeset viewer.