Making WordPress.org

Changeset 11370


Ignore:
Timestamp:
12/14/2021 05:20:19 AM (5 years ago)
Author:
dd32
Message:

SVN Watcher: Reports: Add an 'unknown props' report, simpler view to scan for known typos.

See #5978.

Location:
sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-trac-watcher/admin
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-trac-watcher/admin/list-table.php

    r11369 r11370  
    123123                        FROM {$props_table}
    124124                        WHERE revision IN({$revisions})
    125                         ORDER BY LENGTH(prop_name) DESC"
     125                        ORDER BY user_id IS NULL DESC, LENGTH(prop_name) DESC"
    126126                );
    127127
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-trac-watcher/admin/post.php

    r11362 r11370  
    3838                        $svn['props_table'],
    3939                        [
    40                                 'id'        => $the_prop->id,
    41                                 'revision'  => $rev,
     40                                'id'       => $the_prop->id,
     41                                'revision' => $rev,
    4242                        ]
    4343                );
    … …  
    7373                                [
    7474                                        'prop_name' => $the_prop->prop_name,
    75                                         'user_id' => null
     75                                        'user_id'   => null
    7676                                ]
    7777                        );
    … …  
    109109                        ]
    110110                );
     111
     112                // Update any other occurences of this typo.
     113                $wpdb->update(
     114                        $svn['props_table'],
     115                        [
     116                                'user_id'   => $user,
     117                        ],
     118                        [
     119                                'prop_name' => $prop_name,
     120                                'user_id'   => null
     121                        ]
     122                );
    111123        }
    112124
    … …  
    140152        }
    141153
    142         // Remove the props for the commit first.
     154        // Reparse
     155        $raw_props = Props\from_log( $details->message );
     156
     157        // Fetch all the user_id's
     158        $props = [];
     159        foreach ( $raw_props as $prop ) {
     160                $props[ $prop ] = Props\find_user_id( $prop, $svn );
     161        }
     162
     163        // Remove the props for the commit, after reparsing. This is so that any usernames only corrected within that commit get picked up.
    143164        $wpdb->delete(
    144165                $svn['props_table'],
    145                 [
    146                         'revision' => $rev
    147                 ]
     166                [ 'revision' => $rev ]
    148167        );
    149168
    150         // Reparse
    151         $props = Props\from_log( $details->message );
    152 
    153169        // Reinsert
    154         foreach ( $props as $prop ) {
     170        foreach ( $props as $prop => $user_id ) {
    155171                $data = [
    156172                        'revision'  => $rev,
    … …  
    158174                ];
    159175
    160                 $user_id = Props\find_user_id( $prop, $svn );
    161176                if ( $user_id ) {
    162177                        $data['user_id'] = $user_id;
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-trac-watcher/admin/reports-page.php

    r11369 r11370  
    2525                        <li><a href="<?php echo $url; ?>&what=cloud">Cloud of Props matching filter</a></li>
    2626                        <li><a href="<?php echo $url; ?>&what=typos">Props typos matching filter</a></li>
     27                        <li><a href="<?php echo $url; ?>&what=unknown-props">Unknown Props/typos matching filter</a></li>
    2728                        <li><a href="<?php echo $url; ?>&what=raw-contributors-and-committers">All Props+Committers matching filter grouped together</a></li>
    2829                       
    … …  
    354355
    355356                                break;
     357                        case 'unknown-props':
     358                                $details = $wpdb->get_results(
     359                                        "SELECT p.prop_name,
     360                                                COUNT( * ) as count,
     361                                                GROUP_CONCAT( p.revision ORDER BY p.revision ASC ) as revisions
     362                                        FROM {$details['props_table']} p
     363                                                LEFT JOIN {$details['rev_table']} r ON p.revision = r.id
     364                                        WHERE $where AND p.user_id IS NULL
     365                                        GROUP BY p.prop_name
     366                                        ORDER BY r.id DESC"
     367                                );
     368
     369                                echo '<table class="widefat striped">';
     370                                echo '<thead><tr><th>Prop</th><th>Count</th><th>Revisions</th></tr></thead>';
     371                                foreach ( $details as $c ) {
     372                                        $link = add_query_arg(
     373                                                [
     374                                                        'page' => str_replace( 'reports', 'edit', $_REQUEST['page'] ),
     375                                                        'revisions' => $c->revisions
     376                                                ],
     377                                                admin_url( 'admin.php' )
     378                                        );
     379                                        printf(
     380                                                '<tr><td>%s</td><td>%s</td><td><a href="%s">%s</a></td></tr>',
     381                                                esc_html( $c->prop_name ),
     382                                                $c->count,
     383                                                $link,
     384                                                '[' . str_replace( ',', '] [', $c->revisions ) . ']'
     385                                        );
     386                                }
     387                                echo '</table>';
     388
     389                                break;
    356390                        case 'raw-contributors-and-committers':
    357391                                $details = $wpdb->get_results(
Note: See TracChangeset for help on using the changeset viewer.