web/wp-content/plugins/duplicator/inc/class.zip.php
changeset 204 09a1c134465b
parent 195 c7c0fbc09788
--- a/web/wp-content/plugins/duplicator/inc/class.zip.php	Wed Dec 19 12:35:13 2012 -0800
+++ b/web/wp-content/plugins/duplicator/inc/class.zip.php	Wed Dec 19 17:46:52 2012 -0800
@@ -86,9 +86,11 @@
 				}
 			}
 			
+			/* Legacy: Excludes empty diretories and files with no extention
 			while (false !== ($file = @readdir($dh))) { 
 				if ($file != '.' && $file != '..') { 
 					$fullpath = "{$folderPath}/{$file}";
+					
 					if(is_dir($fullpath)) {
 						duplicator_fcgi_flush();
 						$this->resursiveZip($fullpath);
@@ -103,7 +105,31 @@
 					} 
 					$this->limitItems++;
 				}
-			} 
+			} */
+			
+			
+			while (false !== ($file = @readdir($dh))) {
+                 if ($file != '.' && $file != '..') {
+                    $fullpath = "{$folderPath}/{$file}";
+					$localpath = str_replace($this->rootFolder, '', $folderPath);
+					$localname = empty($localpath) ? '' : ltrim("{$localpath}/", '/');
+                     if(is_dir($fullpath)) {
+                         duplicator_fcgi_flush();
+ 						 $this->zipArchive->addEmptyDir("{$localname}{$file}");
+                         $this->resursiveZip($fullpath);
+                     }
+                     else if(is_file($fullpath) && is_readable($fullpath)) {
+                         //Check filter extensions
+                        $ext = @pathinfo($fullpath, PATHINFO_EXTENSION);
+                        if($ext == '' || !in_array($ext, $this->skipNames)) {
+							$this->zipArchive->addFile("{$folderPath}/{$file}", "{$localname}{$file}");
+                        }
+                     }
+					 $this->limitItems++;
+				}
+			}
+			
+			
 			
 			//Check if were over our count
 			if($this->limitItems > $this->limit) {