Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- foreach ($passwords as $p){
- if($i == 0){
- $command = 'zip -u -j -P '.$p.' '.$dir.'/'.$count.'.zip '.storage_path().'/app/'.$directory.'/'.$file1->getClientOriginalName();
- $commands->push($command);
- }else{
- $command = 'zip --quiet -j -P '.$p.' '.$dir.'/'.$count.'.zip '.storage_path().'/app/'.$directory.'/'.($count+1).'.zip';
- $commands->push($command);
- }
- $count--;
- $i++;
- }
- foreach ($commands as $p){
- echo $p.'<br/>';
- }
- foreach ($commands as $c){
- $process = new Process($c);
- $process->start();
- sleep(10);
- if($process->isTerminated()){
- sleep(1);
- }
- if ($errorOutput = $process->getErrorOutput()) {
- throw new RuntimeException('Process: ' . $errorOutput);
- }
- }
Add Comment
Please, Sign In to add comment