web/wp-content/plugins/duplicator/inc/class.zip.php
changeset 204 09a1c134465b
parent 195 c7c0fbc09788
equal deleted inserted replaced
203:f507feede89a 204:09a1c134465b
    84 						return;
    84 						return;
    85 					}
    85 					}
    86 				}
    86 				}
    87 			}
    87 			}
    88 			
    88 			
       
    89 			/* Legacy: Excludes empty diretories and files with no extention
    89 			while (false !== ($file = @readdir($dh))) { 
    90 			while (false !== ($file = @readdir($dh))) { 
    90 				if ($file != '.' && $file != '..') { 
    91 				if ($file != '.' && $file != '..') { 
    91 					$fullpath = "{$folderPath}/{$file}";
    92 					$fullpath = "{$folderPath}/{$file}";
       
    93 					
    92 					if(is_dir($fullpath)) {
    94 					if(is_dir($fullpath)) {
    93 						duplicator_fcgi_flush();
    95 						duplicator_fcgi_flush();
    94 						$this->resursiveZip($fullpath);
    96 						$this->resursiveZip($fullpath);
    95 					}
    97 					}
    96 					else if(is_file($fullpath) && is_readable($fullpath)) {
    98 					else if(is_file($fullpath) && is_readable($fullpath)) {
   101 							$this->zipArchive->addFile("{$folderPath}/{$file}", "{$localname}{$file}");
   103 							$this->zipArchive->addFile("{$folderPath}/{$file}", "{$localname}{$file}");
   102 						}
   104 						}
   103 					} 
   105 					} 
   104 					$this->limitItems++;
   106 					$this->limitItems++;
   105 				}
   107 				}
   106 			} 
   108 			} */
       
   109 			
       
   110 			
       
   111 			while (false !== ($file = @readdir($dh))) {
       
   112                  if ($file != '.' && $file != '..') {
       
   113                     $fullpath = "{$folderPath}/{$file}";
       
   114 					$localpath = str_replace($this->rootFolder, '', $folderPath);
       
   115 					$localname = empty($localpath) ? '' : ltrim("{$localpath}/", '/');
       
   116                      if(is_dir($fullpath)) {
       
   117                          duplicator_fcgi_flush();
       
   118  						 $this->zipArchive->addEmptyDir("{$localname}{$file}");
       
   119                          $this->resursiveZip($fullpath);
       
   120                      }
       
   121                      else if(is_file($fullpath) && is_readable($fullpath)) {
       
   122                          //Check filter extensions
       
   123                         $ext = @pathinfo($fullpath, PATHINFO_EXTENSION);
       
   124                         if($ext == '' || !in_array($ext, $this->skipNames)) {
       
   125 							$this->zipArchive->addFile("{$folderPath}/{$file}", "{$localname}{$file}");
       
   126                         }
       
   127                      }
       
   128 					 $this->limitItems++;
       
   129 				}
       
   130 			}
       
   131 			
       
   132 			
   107 			
   133 			
   108 			//Check if were over our count
   134 			//Check if were over our count
   109 			if($this->limitItems > $this->limit) {
   135 			if($this->limitItems > $this->limit) {
   110 				duplicator_log("log:class.zip=>new open handle {$this->zipArchive->numFiles}");
   136 				duplicator_log("log:class.zip=>new open handle {$this->zipArchive->numFiles}");
   111 				$this->zipArchive->close();
   137 				$this->zipArchive->close();