Guest User

Untitled

a guest
Feb 25th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. foreach ($passwords as $p){
  2. if($i == 0){
  3. $command = 'zip -u -j -P '.$p.' '.$dir.'/'.$count.'.zip '.storage_path().'/app/'.$directory.'/'.$file1->getClientOriginalName();
  4. $commands->push($command);
  5. }else{
  6. $command = 'zip --quiet -j -P '.$p.' '.$dir.'/'.$count.'.zip '.storage_path().'/app/'.$directory.'/'.($count+1).'.zip';
  7. $commands->push($command);
  8. }
  9. $count--;
  10. $i++;
  11. }
  12. foreach ($commands as $p){
  13. echo $p.'<br/>';
  14. }
  15. foreach ($commands as $c){
  16. $process = new Process($c);
  17. $process->start();
  18. sleep(10);
  19. if($process->isTerminated()){
  20. sleep(1);
  21. }
  22. if ($errorOutput = $process->getErrorOutput()) {
  23. throw new RuntimeException('Process: ' . $errorOutput);
  24. }
  25. }
Add Comment
Please, Sign In to add comment