WordPress.org

Making WordPress.org


Ignore:
Timestamp:
03/28/17 00:09:03 (9 months ago)
Author:
dd32
Message:

Plugin Directory: ZIPs: Update the ZIP rebuilding script to batch rebuild in chunks of 5.

File:
1 edited

Legend:

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

    r5147 r5175  
    88} 
    99 
    10 //ob_start(); 
     10ob_start(); 
    1111 
    1212$opts = getopt( '', array( 'url:', 'abspath:', 'plugin:', 'versions:', 'async' ) ); 
     
    6666    $svn_tags = SVN::ls( "http://plugins.svn.wordpress.org/{$plugin_slug}/tags/" ); 
    6767    if ( false === $svn_tags ) { 
    68         fwrite( STDERR, "Error! Failed to retrieve SVN tag listing." ); 
    69         exit(1); 
     68        fwrite( STDERR, "{$plugin_slug}: Warning: Failed to retrieve SVN tag listing, proceeding with trunk rebuilding only.\n" ); 
     69        $svn_tags = array(); 
    7070    } 
    7171 
     
    7878 
    7979if ( ! $versions ) { 
    80     fwrite( STDERR, "Error! No versions specified (or we couldn't find any)" ); 
     80    fwrite( STDERR, "{$plugin_slug}: Error! No versions specified.\n" ); 
    8181    exit(1); 
    8282} 
     
    8585try { 
    8686    $zip_builder = new ZIP\Builder(); 
    87     $zip_builder->build( 
    88         $plugin_slug, 
    89         $versions, 
    90         "{$plugin_slug}: Rebuild triggered by " . php_uname('n' ) 
    91     ); 
     87 
     88    // (re)Build & Commit 5 Zips at a time to avoid limitations. 
     89    foreach ( array_chunk( $versions, 5 ) as $versions_to_build ) { 
     90        $zip_builder->build( 
     91            $plugin_slug, 
     92            $versions_to_build, 
     93            "{$plugin_slug}: Rebuild triggered by " . php_uname('n' ) 
     94        ); 
     95    } 
    9296 
    9397    echo "OK. Took " . round( microtime(1) - $start_time, 2 )  . "s\n"; 
    9498} catch( \Exception $e ) { 
    9599    fwrite( STDERR, "{$plugin_slug}: Zip Rebuild failed: " . $e->getMessage() . "\n" ); 
     100    echo "Failed. Took " . round( microtime(1) - $start_time, 2 )  . "s\n"; 
    96101    exit(1); 
    97102} 
Note: See TracChangeset for help on using the changeset viewer.