From 2ebe4e64d45fa9f4a1459ea24c27f48e28f8249d Mon Sep 17 00:00:00 2001 From: kevin_fourie Date: Sat, 26 Jan 2008 12:29:56 +0000 Subject: [PATCH] Merged in from DEV trunk... --- lib/upgrades/Ini.inc.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/upgrades/Ini.inc.php b/lib/upgrades/Ini.inc.php index 08d7f6f..56de771 100644 --- a/lib/upgrades/Ini.inc.php +++ b/lib/upgrades/Ini.inc.php @@ -168,7 +168,9 @@ class Ini { function addItem($addSection, $addItem, $value, $itemComment = '', $sectionComment = '') { - if($this->itemExists($addSection, $addItem)) return false; + if($this->itemExists($addSection, $addItem)) { + $this->delItem($addSection, $addItem); + } if($this->exists != 'section') { $this->cleanArray['_blankline_'.$this->lineNum++]=''; @@ -180,7 +182,15 @@ class Ini { $this->cleanArray[$addSection][$addItem] = stripcslashes($value); return true; } + + function delItem($delSection, $delItem) { + + if(!$this->itemExists($delSection, $delItem)) return false; + unset($array_splice(this->cleanArray[$delSection][$delItem]); + return true; + } + } /* // USAGE EXAMPLE -- libgit2 0.21.4