Making WordPress.org


Ignore:
Timestamp:
07/09/2020 07:26:48 AM (4 years ago)
Author:
dd32
Message:

Plugin Directory: Ensure that the expected keys are set.

This avoids PHP warnings later in the Plugin_i18n_Import job.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/jobs/class-plugin-import.php

    r7370 r10043  
    3333    public static function cron_trigger( $plugin_data ) {
    3434        $plugin_slug  = $plugin_data['plugin'];
    35         $changed_tags = isset( $plugin_data['tags_touched'] ) ? $plugin_data['tags_touched'] : array( 'trunk' );
    3635
    37         $revision = isset( $plugin_data['revisions'] ) ? max( (array) $plugin_data['revisions'] ) : false;
     36        if ( ! isset( $plugin_data['tags_touched'] ) ) {
     37            $plugin_data['tags_touched'] = array( 'trunk' );
     38        }
     39
     40        if ( ! isset( $plugin_data['revisions'] ) ) {
     41            $plugin_data['revisions'] = [];
     42        }
     43
     44        $tags_touched = $plugin_data['tags_touched'];
     45        $revision     = max( (array) $plugin_data['revisions'] );
    3846
    3947        try {
    4048            $importer = new CLI\Import();
    41             $importer->import_from_svn( $plugin_slug, $changed_tags, $revision );
     49            $importer->import_from_svn( $plugin_slug, $tags_touched, $revision );
    4250        } catch ( Exception $e ) {
    4351            fwrite( STDERR, "[{$plugin_slug}] Plugin Import Failed: " . $e->getMessage() . "\n" );
Note: See TracChangeset for help on using the changeset viewer.