Making WordPress.org


Ignore:
Timestamp:
05/16/2024 01:30:50 AM (2 years ago)
Author:
dd32
Message:

Plugin Directory: SVN: Watch for Tag deletions, such that we can properly handle cases when a tag is deleted.

See #3263, #5900.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/cli/class-svn-watcher.php

    r8337 r13709  
    105105                                $plugins[ $plugin_slug ] = array(
    106106                                        'tags_touched'   => array(), // trunk is a tag too!
     107                                        'tags_deleted'   => array(),
    107108                                        'readme_touched' => false, // minor optimization, only parse readme i18n on readme-related commits
    108109                                        'code_touched'   => false,
    … …  
    116117                        $plugin['revisions'][] = $log['revision'];
    117118                        foreach ( $log['paths'] as $path ) {
    118                                 $path_parts = explode( '/', trim( $path, '/' ) );
     119                                $path_parts  = explode( '/', trim( $path, '/' ) );
     120                                $is_deletion = ( isset( $log['actions'][ $path ] ) && 'D' === $log['actions'][ $path ] );
    119121
    120122                                if ( ! isset( $path_parts[1] ) ) {
    121123                                        continue;
    122124                                }
    123 
     125               
    124126                                if ( 'trunk' == $path_parts[1] ) {
    125127                                        $plugin['tags_touched'][] = 'trunk';
    126 
     128               
    127129                                } elseif ( 'tags' == $path_parts[1] && isset( $path_parts[2] ) ) {
    128                                         $plugin['tags_touched'][] = $path_parts[2];
     130                                        if ( $is_deletion && ! isset( $path_parts[3] ) /* not a file deletion */ ) {
     131                                                $plugin['tags_deleted'][] = $path_parts[2];
     132                                        } else {
     133                                                $plugin['tags_touched'][] = $path_parts[2];
     134                                        }
    129135
    130136                                } elseif ( 'assets' == $path_parts[1] ) {
    131137                                        $plugin['assets_touched'] = true;
    132 
     138               
    133139                                }
    134140
    … …  
    141147                                }
    142148                        }
     149
    143150                        $plugin['tags_touched'] = array_unique( $plugin['tags_touched'] );
    144151                }
Note: See TracChangeset for help on using the changeset viewer.