Explorar o código

Only overwrite lua scripts and add database_handle.lua as an exception.

Mark Crane %!s(int64=12) %!d(string=hai) anos
pai
achega
0392ed2bfe
Modificáronse 1 ficheiros con 28 adicións e 2 borrados
  1. 28 2
      resources/classes/install.php

+ 28 - 2
resources/classes/install.php

@@ -53,8 +53,34 @@ include "root.php";
 						$this->recursive_copy($src.'/'.$file, $dst.'/'.$file);
 					}
 					else {
-						//echo "copy(".$src."/".$file.", ".$dst."/".$file.");<br />\n";
-						copy($src.'/'.$file, $dst.'/'.$file);
+						//show debug info
+							//echo "copy(".$src."/".$file.", ".$dst."/".$file.");<br />\n";
+						//check the file type by ext
+							if (substr($file, -3) == "lua") {
+								//set the exception default
+									$exception = false;
+								//set the exceptions
+									if ($file == "database_handle.lua") {
+										$exception = true;
+									}
+								//check for exceptions
+									if ($exception) {
+										//write over files
+										copy($src.'/'.$file, $dst.'/'.$file);
+									}
+									else {
+										//copy files that don't exist into the destination directory
+										if (!file_exists($dst.'/'.$file)) {
+											copy($src.'/'.$file, $dst.'/'.$file);
+										}
+									}
+							}
+							else {
+								//copy files that don't exist into the destination directory
+								if (!file_exists($dst.'/'.$file)) {
+									copy($src.'/'.$file, $dst.'/'.$file);
+								}
+							}
 					}
 				}
 			}