Making WordPress.org

Changeset 7030


Ignore:
Timestamp:
04/05/2018 04:16:43 AM (7 years ago)
Author:
dd32
Message:

Plugin Directory: Ratings/Reviews: Enhance the bin script from r7029 to also operate on a singular plugin.

See #2606.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/bin/resync-ratings.php

    r7029 r7030  
    88    die();
    99}
    10 $opts = getopt( '', array( 'post:', 'url:', 'abspath:', 'age:' ) );
     10$opts = getopt( '', array( 'plugin:', 'url:', 'abspath:' ) );
    1111
    1212if ( empty( $opts['url'] ) ) {
     
    3232}
    3333
    34 $slugs = $wpdb->get_col( "SELECT post_name FROM {$wpdb->posts} WHERE post_type = 'plugin' and post_status = 'publish'" );
     34if ( !empty( $opts['plugin'] ) ) {
     35    $sql = $wpdb->prepare( "SELECT post_name FROM {$wpdb->posts} WHERE post_type = 'plugin' and post_status = 'publish' AND post_name = %s", $opts['plugin'] );
     36} else {
     37    // All plugins.
     38    $sql = "SELECT post_name FROM {$wpdb->posts} WHERE post_type = 'plugin' and post_status = 'publish'";
     39}
     40
     41$slugs = $wpdb->get_col( $sql );
    3542
    3643foreach ( $slugs as $i => $slug ) {
Note: See TracChangeset for help on using the changeset viewer.