From e7271794da0c84ceebc36d370dd18fb1a762a90c Mon Sep 17 00:00:00 2001 From: Mark Crane Date: Mon, 26 Aug 2013 18:50:43 +0000 Subject: [PATCH] Only overwrite lua scripts and add database_handle.lua as an exception. --- resources/classes/install.php | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/resources/classes/install.php b/resources/classes/install.php index 2b20e2fcac..997cf4a845 100644 --- a/resources/classes/install.php +++ b/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.");
\n"; - copy($src.'/'.$file, $dst.'/'.$file); + //show debug info + //echo "copy(".$src."/".$file.", ".$dst."/".$file.");
\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); + } + } } } }