Making WordPress.org


Ignore:
Timestamp:
10/21/2024 02:25:39 AM (17 months ago)
Author:
dd32
Message:

Plugin Directory: When we fail to create a SVN repo for a plugin, retry it through Cron.

File:
1 edited

Legend:

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

    r13507 r14126  
    244244     *
    245245     * @param \WP_Post $post          Post object.
    246      * @param \WP_User $plugin_author Plugin author.
     246     * @param \WP_User $plugin_author Plugin author. Optional.
    247247     * @return bool
    248248     */
    249     public function approved_create_svn_repo( $post, $plugin_author ) {
     249    public function approved_create_svn_repo( $post, $plugin_author = null ) {
     250        $post            = get_post( $post );
     251        $plugin_author ??= get_user_by( 'id', $post->post_author );
     252
    250253        $dir = Filesystem::temp_directory( $post->post_name );
    251254        foreach ( array( 'assets', 'tags', 'trunk' ) as $folder ) {
     
    269272        */
    270273
    271         $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 ) );
    272 
     274        $result = SVN::import(
     275            $dir,
     276            'http://plugins-testing.svn.wordpress.org/' . $post->post_name,
     277            sprintf(
     278                'Adding %1$s by %2$s.',
     279                html_entity_decode( $post->post_title ),
     280                $plugin_author->user_login
     281            )
     282        );
     283
     284        // Record the last failure attempt.
    273285        if ( $result['errors'] ) {
    274286            Tools::audit_log( 'Error creating SVN repository: ' . var_export( $result['errors'], true ), $post->ID );
     287
     288            // Retry in a minute.
     289            wp_schedule_single_event( time() + MINUTE_IN_SECONDS, 'plugin_directory_create_svn_repo', [ $post->ID, $plugin_author->ID ] );
     290
    275291            return false;
    276292        }
Note: See TracChangeset for help on using the changeset viewer.