File tree Expand file tree Collapse file tree 2 files changed +20
-4
lines changed
Expand file tree Collapse file tree 2 files changed +20
-4
lines changed Original file line number Diff line number Diff line change 3535
3636$ pwd = getcwd ();
3737$ update_folders = [];
38+ $ clone_list = [];
3839
3940foreach ( $ repositories as $ repository ) {
4041 if ( in_array ( $ repository ->name , $ skip_list , true ) ) {
4445 $ destination = isset ( $ clone_destination_map [ $ repository ->name ] ) ? $ clone_destination_map [ $ repository ->name ] : $ repository ->name ;
4546
4647 if ( ! is_dir ( $ destination ) ) {
47- printf ( "Fetching \033[32mwp-cli/ {$ repository ->name }\033[0m... \n" );
48- $ clone_url = getenv ( 'GITHUB_ACTION ' ) ? $ repository ->clone_url : $ repository ->ssh_url ;
49- system ( "git clone {$ clone_url } {$ destination }" );
48+ $ clone_url = getenv ( 'GITHUB_ACTION ' ) ? $ repository ->clone_url : $ repository ->ssh_url ;
49+ $ clone_list [] = "{$ destination } {$ clone_url }" ;
5050 }
5151
5252 $ update_folders [] = $ destination ;
5353}
5454
55- $ updates = implode ( '\n ' , $ update_folders );
55+ if ( ! empty ( $ clone_list ) ) {
56+ $ clones = implode ( "\n" , $ clone_list );
57+ system ( "echo ' $ clones' | xargs -n2 -P8 php .maintenance/clone-repository.php " );
58+ }
59+
60+ $ updates = implode ( "\n" , $ update_folders );
5661system ( "echo ' $ updates' | xargs -n1 -P8 -I% php .maintenance/refresh-repository.php % " );
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ if ( ! isset ( $ argv [1 ], $ argv [2 ] ) ) {
4+ exit ( "Usage: php clone-repository.php <destination> <clone_url> \n" );
5+ }
6+
7+ $ destination = $ argv [1 ];
8+ $ clone_url = $ argv [2 ];
9+
10+ printf ( "Fetching \033[32m%s \033[0m... \n" , $ destination );
11+ system ( 'git clone ' . escapeshellarg ( $ clone_url ) . ' ' . escapeshellarg ( $ destination ) );
You can’t perform that action at this time.
0 commit comments