Making WordPress.org

Changeset 6854


Ignore:
Timestamp:
03/10/2018 01:15:24 PM (7 years ago)
Author:
ocean90
Message:

Translate, Plugin Directory: Store ID of the plugin post as meta data when importing plugins.

See [6851].

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-plugin-directory/inc/cli/class-set-plugin-project.php

    r6536 r6854  
    3131     */
    3232    public function __invoke( $args, $assoc_args ) {
     33        global $wpdb;
     34
    3335        if ( ! preg_match( '/^[^\/]+$/', $args[0] ) ) {
    3436            WP_CLI::error( sprintf( "The plugin slug '%s' contains invalid characters.", $args[0] ), 1 );
     
    100102        }
    101103
     104        // Store ID of the post in the plugin directory. Used for retrieving plugin icons.
     105        $post_id = (int) $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM {$wpdb->base_prefix}%d_posts WHERE post_name = %s AND post_type = 'plugin' LIMIT 1", WPORG_PLUGIN_DIRECTORY_BLOGID, $project->slug ) );
     106        if ( $post_id ) {
     107            gp_update_meta( $plugin_project->id, 'directory-post-id', $post_id, 'wp-plugins' );
     108        }
     109
    102110        // The current stable SVN tag.
    103111        $stable_tag = empty( $plugin_details->stable_tag ) ? 'trunk' : $plugin_details->stable_tag;
Note: See TracChangeset for help on using the changeset viewer.