瀏覽代碼

Make the install and upgrade of the scripts directory included directories, sub directories and files.

Mark Crane 12 年之前
父節點
當前提交
8ce04f929d
共有 2 個文件被更改,包括 3 次插入20 次删除
  1. 1 17
      includes/classes/install.php
  2. 2 3
      includes/classes/switch_directory.php

+ 1 - 17
includes/classes/install.php

@@ -115,23 +115,7 @@ include "root.php";
 			$src_dir = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/includes/install/scripts';
 			$dst_dir = $this->switch_scripts_dir;
 			if (is_readable($this->switch_scripts_dir)) {
-				if ($handle = opendir($src_dir)) {
-					$i = 0;
-					$files = array();
-					while (false !== ($file = readdir($handle))) {
-						if ($file != "." && $file != ".." && is_file($src_dir.'/'.$file)) {
-							if (!file_exists($dst_dir.'/'.$file) ) {
-								//copy the file if it does not exist in the destination directory
-								if (copy($src_dir.'/'.$file, $dst_dir.'/'.$file)) {
-									$this->result['copy']['scripts'][] = "copied from ".$src_dir."/".$file." to ".$dst_dir."/".$file."<br />\n";
-								}
-								else {
-									$this->result['copy']['scripts'][] = "copy failed from ".$src_dir."/".$file." to ".$dst_dir."/".$file."<br />\n";
-								}
-							}
-						}
-					}
-				}
+				$this->recursive_copy($src_dir, $dst_dir);
 				unset($src_dir, $dst_dir);
 			}
 		}

+ 2 - 3
includes/classes/switch_directory.php

@@ -351,8 +351,7 @@ include "root.php";
 			$domain_uuid = $this->domain_uuid;
 			$extension_uuid = $this->extension_uuid;
 			if (strlen($extension_uuid)>0) {
-				$sql = "";
-				$sql .= "delete from v_extensions ";
+				$sql = "delete from v_extensions ";
 				$sql .= "where domain_uuid = '$domain_uuid' ";
 				$sql .= "and extension_uuid = '$extension_uuid' ";
 				$prep_statement = $db->prepare(check_sql($sql));
@@ -368,7 +367,7 @@ include "root.php";
 			$values=array_values($data);
 			for($i=0;$i<$count;$i++){
 				$keys[$i]= str_replace("-", "_", $keys[$i]); 
-				$this->{$keys[$i]}=$values[$i];			
+				$this->{$keys[$i]}=$values[$i];
 			}
 		}