@@ -327,32 +327,57 @@ public static function updateConfigOption($optionName,$optionValue, $force = fal
327
327
328
328
// standardize the values for comparison
329
329
$ currentOption = self ::getOption ($ optionName );
330
- $ currentOptionValue = isset ($ currentOption ["plugins " ]) ? $ currentOption ["plugins " ] : $ currentOption ;
331
- $ newOptionValue = isset ($ optionValue ["plugins " ]) ? $ optionValue ["plugins " ] : $ optionValue ;
330
+ $ currentOptionValue = $ currentOption ;
331
+ $ newOptionValue = $ optionValue ;
332
+ $ optionNameOutput = $ optionName ;
333
+
334
+ // dive into plugins to do a proper comparison to
335
+ if ($ optionName == "plugins " ) {
336
+
337
+ // replace the data in anticipation of it being used
338
+ $ optionValue = array_replace_recursive ($ currentOption , $ newOptionValue );
339
+
340
+ // get the key of the plugin that is being added/updated
341
+ reset ($ newOptionValue );
342
+ $ newOptionKey = key ($ newOptionValue );
343
+
344
+ if (!array_key_exists ($ newOptionKey , $ currentOptionValue )) {
345
+
346
+ // if the key doesn't exist just write out the new config and move on
347
+ self ::writeUpdateConfigOption ($ optionName ,$ optionValue );
348
+ return ;
349
+
350
+ } else {
351
+
352
+ // see if the existing configs for the plugin exists. if so just return with no changes
353
+ if ($ newOptionValue [$ newOptionKey ] == $ currentOptionValue [$ newOptionKey ]) {
354
+ return ;
355
+ } else {
356
+ $ optionNameOutput = $ optionName .". " .$ newOptionKey ;
357
+ }
358
+
359
+ }
360
+
361
+ }
332
362
333
363
if ($ currentOptionValue != $ newOptionValue ) {
334
364
335
365
// prompt for input
336
366
if (is_array ($ currentOptionValue )) {
337
- $ prompt = "update the config option <desc> " .$ optionName ."</desc> with the value from the package install? " ;
367
+ $ prompt = "update the config option <desc> " .$ optionNameOutput ."</desc> with the value from the package install? " ;
338
368
} else {
339
- $ prompt = "update the config option <desc> " .$ optionName ." ( " .$ currentOptionValue .")</desc> with the value <desc> " .$ newOptionValue ."</desc>? " ;
369
+ $ prompt = "update the config option <desc> " .$ optionNameOutput ." ( " .$ currentOptionValue .")</desc> with the value <desc> " .$ newOptionValue ."</desc>? " ;
340
370
}$ options = "Y/n " ;
341
371
$ input = Console::promptInput ($ prompt ,$ options ,"Y " );
342
372
343
373
if ($ input == "y " ) {
344
374
345
- // handle plug-in values
346
- if (isset ($ optionValue ["plugins " ])) {
347
- $ optionValue = array_replace_recursive ($ currentOption , $ optionValue );
348
- }
349
-
350
375
// update the config option
351
376
self ::writeUpdateConfigOption ($ optionName ,$ optionValue );
352
- Console::writeInfo ("config option " .$ optionName ." updated... " , false , true );
377
+ Console::writeInfo ("config option " .$ optionNameOutput ." updated... " , false , true );
353
378
354
379
} else {
355
- Console::writeWarning ("config option <desc> " .$ optionName ."</desc> not updated... " , false , true );
380
+ Console::writeWarning ("config option <desc> " .$ optionNameOutput ."</desc> not updated... " , false , true );
356
381
}
357
382
358
383
}
0 commit comments