2016-11-19 15:13:32 +07:00
|
|
|
<?php
|
|
|
|
namespace Deployer;
|
|
|
|
|
|
|
|
desc('Cleaning up files and/or directories');
|
|
|
|
task('deploy:clear_paths', function () {
|
|
|
|
$paths = get('clear_paths');
|
2019-10-26 14:30:22 +03:00
|
|
|
$sudo = get('clear_use_sudo') ? 'sudo' : '';
|
2020-01-30 11:08:11 +02:00
|
|
|
$batch = 100;
|
2016-11-19 15:13:32 +07:00
|
|
|
|
2020-01-30 11:08:11 +02:00
|
|
|
$commands = [];
|
2016-11-19 15:13:32 +07:00
|
|
|
foreach ($paths as $path) {
|
2020-01-30 11:08:11 +02:00
|
|
|
$commands[] = "$sudo rm -rf {{release_path}}/$path";
|
|
|
|
}
|
|
|
|
$chunks = array_chunk($commands, $batch);
|
|
|
|
foreach ($chunks as $chunk) {
|
|
|
|
run(implode('; ', $chunk));
|
2016-11-19 15:13:32 +07:00
|
|
|
}
|
|
|
|
});
|