Commit 2ebe4e64d45fa9f4a1459ea24c27f48e28f8249d

Authored by kevin_fourie
1 parent b62f0bc8

Merged in from DEV trunk...

KTS-2799
"3.5.2 beta 2 upgrade error"
Fixed. Updated Ini class to allow updating of existing items.

Committed By: Kevin Fourie
Reviewed By: Jonathan Byrne

git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@7963 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing 1 changed file with 11 additions and 1 deletions
lib/upgrades/Ini.inc.php
... ... @@ -168,7 +168,9 @@ class Ini {
168 168  
169 169 function addItem($addSection, $addItem, $value, $itemComment = '', $sectionComment = '') {
170 170  
171   - if($this->itemExists($addSection, $addItem)) return false;
  171 + if($this->itemExists($addSection, $addItem)) {
  172 + $this->delItem($addSection, $addItem);
  173 + }
172 174  
173 175 if($this->exists != 'section') {
174 176 $this->cleanArray['_blankline_'.$this->lineNum++]='';
... ... @@ -180,7 +182,15 @@ class Ini {
180 182 $this->cleanArray[$addSection][$addItem] = stripcslashes($value);
181 183 return true;
182 184 }
  185 +
  186 + function delItem($delSection, $delItem) {
  187 +
  188 + if(!$this->itemExists($delSection, $delItem)) return false;
183 189  
  190 + unset($array_splice(this->cleanArray[$delSection][$delItem]);
  191 + return true;
  192 + }
  193 +
184 194 }
185 195 /*
186 196 // USAGE EXAMPLE
... ...