From e65d2b0805bef8f43765f19759a65049a0d6e518 Mon Sep 17 00:00:00 2001 From: Matt Pass Date: Fri, 18 Apr 2014 08:35:21 +0100 Subject: [PATCH] Copying over settings now completed Gets old and new settings info, counts through each line of new settings and if we have a match on the old settings, copy that over if it's not versionNo or codeMirrorDir. Saves settings once the $content is established --- lib/updater.php | 34 +++++++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/lib/updater.php b/lib/updater.php index 1c719db..95d54bf 100644 --- a/lib/updater.php +++ b/lib/updater.php @@ -114,14 +114,34 @@ function openZipNew($icvInfo) { function copyOverSettings($icvInfo) { global $updateDone; - // Get settings from old version - include(PATH."lib/config___settings.php"); - echo "Getting...".PATH."lib/config___settings.php
"; - var_dump($ICEcoderSettings); - foreach ($ICEcoderSettings as $key => $value) { - echo "Key: $key; Value: $value
\n"; - // Now need to copy the settings over to new config file... + echo 'Getting old and new settings...
'; + // Get old and new settings and start a new $contents + $oldSettingsContent = file_get_contents(PATH."lib/config___settings.php",false,$context); + $oldSettingsArray = explode("\n",$oldSettingsContent); + $newSettingsContent = file_get_contents("config___settings.php",false,$context); + $newSettingsArray = explode("\n",$newSettingsContent); + $contents = ""; + + echo 'Transposing old settings to new settings...
'; + // Now need to copy the old settings over to new settings... + for ($i=0; $i -1) { + $contentLine = $oldSettingsArray[$j].PHP_EOL; + } + } + $contents .= $contentLine; } + echo 'Saving old settings to new ICEcoder settings file...
'; + $fh = fopen('config___settings.php', 'w') or die("Sorry, cannot update the new ICEcoder settings file"); + fwrite($fh, $contents); + fclose($fh); + echo 'All update tasks completed...
'; $updateDone = true; }