Making WordPress.org


Ignore:
Timestamp:
04/03/2024 05:46:47 AM (13 months ago)
Author:
dd32
Message:

Plugin Directory: Split the SVN repo creation step out from the approval function, to allow manually calling when it fails.

File:
1 edited

Legend:

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

    r13033 r13440  
    211211
    212212        // Create SVN repo.
     213        $this->approved_create_svn_repo( $post, $plugin_author );
     214
     215        // Grant commit access.
     216        Tools::grant_plugin_committer( $post->post_name, $plugin_author );
     217
     218        // Send email.
     219        $email = new Plugin_Approved_Email( $post, $plugin_author );
     220        $email->send();
     221
     222        Tools::audit_log( 'Plugin approved.', $post_id );
     223    }
     224
     225    /**
     226     * Create a SVN repository for this plugin.
     227     *
     228     * @param \WP_Post $post          Post object.
     229     * @param \WP_User $plugin_author Plugin author.
     230     * @return bool
     231     */
     232    public function approved_create_svn_repo( $post, $plugin_author ) {
    213233        $dir = Filesystem::temp_directory( $post->post_name );
    214234        foreach ( array( 'assets', 'tags', 'trunk' ) as $folder ) {
     
    232252        */
    233253
    234         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 ) );
    235 
    236         // Grant commit access.
    237         Tools::grant_plugin_committer( $post->post_name, $plugin_author );
    238 
    239         // Send email.
    240         $email = new Plugin_Approved_Email( $post, $plugin_author );
    241         $email->send();
    242 
    243         Tools::audit_log( 'Plugin approved.', $post_id );
     254        $result = 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 ) );
     255
     256        if ( $result['errors'] ) {
     257            Tools::audit_log( 'Error creating SVN repository: ' . var_export( $result['errors'], true ), $post->ID );
     258            return false;
     259        }
     260
     261        return true;
    244262    }
    245263
Note: See TracChangeset for help on using the changeset viewer.