Making WordPress.org

Changeset 5209


Ignore:
Timestamp:
03/30/2017 08:27:56 AM (8 years ago)
Author:
dd32
Message:

Plugin Directory: Create the SVN directories upon plugin approval and send welcome email, even if there exist no uploaded ZIP files for the plugin.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/class-status-transitions.php

    r4474 r5209  
    8888    public function approved( $post_id, $post ) {
    8989        $attachments = get_attached_media( 'application/zip', $post_id );
    90 
    91         // If there is no zip we have nothing to commit. Bail.
    92         if ( empty( $attachments ) ) {
    93             return;
    94         }
    95 
    96         $attachment    = end( $attachments );
    9790        $plugin_author = get_user_by( 'id', $post->post_author );
    9891
    9992        // Create SVN repo.
    10093        $dir = Filesystem::temp_directory( $post->post_name );
    101         $dir = Filesystem::unzip( get_attached_file( $attachment->ID ), $dir );
    10294        foreach ( array( 'assets', 'branches', 'tags', 'trunk' ) as $folder ) {
    10395            mkdir( "$dir/$folder", 0777 );
    10496        }
    10597
    106         $plugin_root = $this->get_plugin_root( $dir );
    107         // If there is no plugin file we have nothing to commit. Bail.
    108         if ( empty( $plugin_root ) ) {
    109             return;
    110         }
    111         rename( $plugin_root, "$dir/trunk" );
     98        if ( $attachments ) {
     99            $attachment = end( $attachments );
     100
     101            $unzip_dir = Filesystem::unzip( get_attached_file( $attachment->ID ) );
     102
     103            $plugin_root = $this->get_plugin_root( $unzip_dir );
     104
     105            if ( $plugin_root ) {
     106                rename( $plugin_root, "$dir/trunk" );
     107            }
     108        }
    112109
    113110        SVN::import( $dir, 'http://plugins.svn.wordpress.org/' . $post->post_name, sprintf( 'Adding %1$s by %2$s.', $post->post_title, $plugin_author->user_login ) );
     
    121118        Tools::grant_plugin_committer( $post->post_name, $plugin_author );
    122119
    123         // Promote author if they don't have access yet.
    124         if ( ! user_can( $plugin_author, 'plugin_dashboard_access' ) ) {
    125             $plugin_author->add_role( 'plugin_committer' );
    126         }
    127 
    128120        // Send email.
    129121        $subject = sprintf( __( '[WordPress Plugin Directory] %s has been approved!', 'wporg-plugins' ), $post->post_title );
     
    134126        $content .= __( 'Within one hour you will have access to your SVN repository with the WordPress.org username and password you used to log in and submit your request. Your username is case sensitive.', 'wporg-plugins' ) . "\n\n";
    135127
    136         $content .= "http://plugins.svn.wordpress.org/{$post->post_name}\n\n";
     128        $content .= "https://plugins.svn.wordpress.org/{$post->post_name}\n\n";
    137129
    138130        $content .= __( 'Here are some handy links to help you get started.', 'wporg-plugins' ) . "\n\n";
     
    148140
    149141        $content .= __( 'WordPress Plugin Directory readme.txt standard:', 'wporg-plugins' ) . "\n";
    150         $content .= "https://wordpress.org/plugins/about/readme.txt\n\n";
     142        $content .= "https://wordpress.org/plugins/developers/#readme\n\n";
    151143
    152144        $content .= __( 'A readme.txt validator:', 'wporg-plugins' ) . "\n";
    153         $content .= "https://wordpress.org/plugins/about/validator/\n\n";
     145        $content .= "https://wordpress.org/plugins/developers/readme-validator/\n\n";
    154146
    155147        $content .= __( 'Plugin Assets (header images etc):', 'wporg-plugins' ) . "\n";
Note: See TracChangeset for help on using the changeset viewer.