Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions .maintenance/clone-all-repositories.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@

$pwd = getcwd();
$update_folders = [];
$clone_list = [];

foreach ( $repositories as $repository ) {
if ( in_array( $repository->name, $skip_list, true ) ) {
Expand All @@ -44,13 +45,17 @@
$destination = isset( $clone_destination_map[ $repository->name ] ) ? $clone_destination_map[ $repository->name ] : $repository->name;

if ( ! is_dir( $destination ) ) {
printf( "Fetching \033[32mwp-cli/{$repository->name}\033[0m...\n" );
$clone_url = getenv( 'GITHUB_ACTION' ) ? $repository->clone_url : $repository->ssh_url;
system( "git clone {$clone_url} {$destination}" );
$clone_url = getenv( 'GITHUB_ACTION' ) ? $repository->clone_url : $repository->ssh_url;
$clone_list[] = "{$destination} {$clone_url}";
}

$update_folders[] = $destination;
}

$updates = implode( '\n', $update_folders );
if ( ! empty( $clone_list ) ) {
$clones = implode( "\n", $clone_list );
system( "echo '$clones' | xargs -n2 -P8 php .maintenance/clone-repository.php" );
}
Comment thread
swissspidy marked this conversation as resolved.
Outdated

$updates = implode( "\n", $update_folders );
system( "echo '$updates' | xargs -n1 -P8 -I% php .maintenance/refresh-repository.php %" );
11 changes: 11 additions & 0 deletions .maintenance/clone-repository.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

if ( ! isset( $argv[1], $argv[2] ) ) {
exit( "Usage: php clone-repository.php <destination> <clone_url>\n" );
}

$destination = $argv[1];
$clone_url = $argv[2];

printf( "Fetching \033[32m%s\033[0m...\n", $destination );
system( 'git clone ' . escapeshellarg( $clone_url ) . ' ' . escapeshellarg( $destination ) );