[Mapbender-commits] r2758 - branches/spsneo_dev/mapbender/update

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Fri Aug 8 16:05:55 EDT 2008


Author: spsneo
Date: 2008-08-08 16:05:55 -0400 (Fri, 08 Aug 2008)
New Revision: 2758

Modified:
   branches/spsneo_dev/mapbender/update/update-utils.inc
Log:
Functions added to implement filesystem update script

Modified: branches/spsneo_dev/mapbender/update/update-utils.inc
===================================================================
--- branches/spsneo_dev/mapbender/update/update-utils.inc	2008-08-08 20:04:50 UTC (rev 2757)
+++ branches/spsneo_dev/mapbender/update/update-utils.inc	2008-08-08 20:05:55 UTC (rev 2758)
@@ -125,4 +125,39 @@
 	}
 }
 
+//Function to copy a directory recursively 
+function copydir($dir_path, $dest_path) {
+	
+	$file_arr = array();
+	
+	//remove slash if it is there at the end of the path
+	if(substr($dir_path, -1) == '/') {
+		$dir_path = substr($dir_path, 0 , -1);
+	}
+	
+	if(substr($dest_path, -1) == '/') {
+		$dest_path = substr($dest_path, 0 , -1);
+	}
+	
+	mkdir($dest_path);
+	chmod($dest_path, 0755);
+	
+	$directory = dir($dir_path);
+	while(false !== ($file = $directory->read())) {
+		$file_path = $dir_path.'/'.$file;
+		if(is_file($file_path)) {
+			$file_arr[$file] = $file_path;
+		} else if (is_dir($file_path) && !preg_match("/^\./", $file)) {
+			copydir($file_path, $dest_path."/".$file);
+		} else {
+			
+		}
+	}
+	
+	foreach($file_arr as $file => $file_path) {
+		copy($file_path, $dest_path."/".$file);
+	}
+	return TRUE;
+}
+
 ?>



More information about the Mapbender_commits mailing list