mirror of
https://github.com/deployphp/deployer.git
synced 2025-02-24 17:22:41 +01:00
19 lines
460 B
PHP
19 lines
460 B
PHP
<?php
|
|
namespace Deployer;
|
|
|
|
desc('Cleaning up files and/or directories');
|
|
task('deploy:clear_paths', function () {
|
|
$paths = get('clear_paths');
|
|
$sudo = get('clear_use_sudo') ? 'sudo' : '';
|
|
$batch = 100;
|
|
|
|
$commands = [];
|
|
foreach ($paths as $path) {
|
|
$commands[] = "$sudo rm -rf {{release_path}}/$path";
|
|
}
|
|
$chunks = array_chunk($commands, $batch);
|
|
foreach ($chunks as $chunk) {
|
|
run(implode('; ', $chunk));
|
|
}
|
|
});
|