Making WordPress.org


Ignore:
Timestamp:
12/19/2017 04:22:37 PM (7 years ago)
Author:
obenland
Message:

PLugins: Clean up formatting with phpcbf

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/bin/rebuild-zip.php

    r6235 r6287  
    11<?php
    22namespace WordPressdotorg\Plugin_Directory;
     3
    34use WordPressdotorg\Plugin_Directory\Plugin_Directory;
    45use WordPressdotorg\Plugin_Directory\Tools\SVN;
     
    1718if ( empty( $opts ) && $argc == 2 ) {
    1819    $opts['plugin'] = $argv[1];
    19     $argv[1] = '--plugin ' . $argv[1];
     20    $argv[1]        = '--plugin ' . $argv[1];
    2021}
    2122if ( empty( $opts ) && $argc == 3 ) {
    2223    $opts['plugin'] = $argv[1];
    23     $argv[1] = '--plugin ' . $argv[1];
     24    $argv[1]        = '--plugin ' . $argv[1];
    2425
    2526    $opts['versions'] = $argv[2];
    26     $argv[2] = '--versions ' . $argv[2];
     27    $argv[2]          = '--versions ' . $argv[2];
    2728}
    2829if ( empty( $opts['url'] ) ) {
     
    4142        fwrite( STDERR, "Usage: php {$argv[0]} --plugin hello-dolly --abspath /home/example/public_html --url https://wordpress.org/plugins/\n" );
    4243        fwrite( STDERR, "--url and --abspath will be guessed if possible.\n" );
    43         exit(1);
     44        exit( 1 );
    4445    }
    4546}
     
    4950$_SERVER['REQUEST_URI'] = parse_url( $opts['url'], PHP_URL_PATH );
    5051
    51 include rtrim( $opts['abspath'], '/' ) . '/wp-load.php';
     52require rtrim( $opts['abspath'], '/' ) . '/wp-load.php';
    5253
    5354if ( ! class_exists( '\WordPressdotorg\Plugin_Directory\Plugin_Directory' ) ) {
     
    5556    if ( defined( 'WPORG_PLUGIN_DIRECTORY_BLOGID' ) ) {
    5657        fwrite( STDERR, "Run the following command instead:\n" );
    57         fwrite( STDERR, "\tphp " . implode( ' ', $argv ) . " --url " . get_site_url( WPORG_PLUGIN_DIRECTORY_BLOGID, '/' ) . "\n" );
     58        fwrite( STDERR, "\tphp " . implode( ' ', $argv ) . ' --url ' . get_site_url( WPORG_PLUGIN_DIRECTORY_BLOGID, '/' ) . "\n" );
    5859    }
    59     exit(1);
     60    exit( 1 );
    6061}
    6162
    6263$plugin_slug = $opts['plugin'];
    6364$versions    = array_filter( array_unique( array_map( 'trim', (array) explode( ',', $opts['versions'] ) ) ), 'strlen' );
    64 $start_time  = microtime(1);
     65$start_time  = microtime( 1 );
    6566
    6667if ( empty( $versions ) ) {
     
    7273    }
    7374
    74     $versions = array_map(
    75         function( $dir ) { return trim( $dir, '/' ); },
    76         $svn_tags
    77     );
     75    $versions = array_map( function( $dir ) {
     76        return trim( $dir, '/' );
     77    }, $svn_tags );
    7878    $versions[] = 'trunk';
    7979}
     
    8181if ( ! $versions ) {
    8282    fwrite( STDERR, "{$plugin_slug}: Error! No versions specified.\n" );
    83     exit(1);
     83    exit( 1 );
    8484}
    8585
     
    9090    $plugin_post = Plugin_Directory::get_plugin_post( $plugin_slug );
    9191    if ( ! $plugin_post ) {
    92         throw new Exception( "Could not locate plugin post" );
     92        throw new Exception( 'Could not locate plugin post' );
    9393    }
    9494    $stable_tag = get_post_meta( $plugin_post->ID, 'stable_tag', true ) ?? 'trunk';
     
    9999            $plugin_slug,
    100100            $versions_to_build,
    101             "{$plugin_slug}: Rebuild triggered by " . php_uname('n' ),
     101            "{$plugin_slug}: Rebuild triggered by " . php_uname( 'n' ),
    102102            $stable_tag
    103103        );
    104104    }
    105105
    106     echo "OK. Took " . round( microtime(1) - $start_time, 2 ) . "s\n";
    107 } catch( Exception $e ) {
     106    echo 'OK. Took ' . round( microtime( 1 ) - $start_time, 2 ) . "s\n";
     107} catch ( Exception $e ) {
    108108    fwrite( STDERR, "{$plugin_slug}: Zip Rebuild failed: " . $e->getMessage() . "\n" );
    109     echo "Failed. Took " . round( microtime(1) - $start_time, 2 ) . "s\n";
    110     exit(1);
     109    echo 'Failed. Took ' . round( microtime( 1 ) - $start_time, 2 ) . "s\n";
     110    exit( 1 );
    111111}
Note: See TracChangeset for help on using the changeset viewer.