Guest User

Untitled

a guest
Dec 16th, 2017
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. $plugin_address="D:/processmaker-3.2.1-x/apps/processmaker/htdocs/cakephp/plugins";
  2. $rootPath = $plugin_address."/".$R;
  3. $zipFileName = $rootPath.'.zip';
  4. $zip = new ZipArchive();
  5. $zip->open($zipFileName, ZipArchive::CREATE | ZipArchive::OVERWRITE);
  6.  
  7. $files = new RecursiveIteratorIterator(
  8. new RecursiveDirectoryIterator($rootPath),
  9. RecursiveIteratorIterator::LEAVES_ONLY
  10. );
  11.  
  12. foreach ($files as $name => $file)
  13. {
  14.  
  15. if (!$file->isDir())
  16. {
  17.  
  18. $filePath = $file->getRealPath();
  19. $relativePath = substr($filePath, strlen($rootPath) + 1);
  20.  
  21. $filePath=str_replace("\","/",$filePath);
  22.  
  23. $zip->addFile($filePath, $relativePath);
  24. }
  25. }
  26.  
  27.  
  28. $zip->close();
  29.  
  30. $zipAdress="/var/www/cakephp/plugins/backup/EstelamBasic.zip";
  31. $plugin_address="/var/www/cakephp/plugins/EstelamBasic/";
  32. $zip = new ZipArchive;
  33. $res = $zip->open($zipAdress);
  34. if ($res === TRUE) {
  35. $zip->extractTo($plugin_address);
  36. $zip->close();
  37. }
Add Comment
Please, Sign In to add comment