@@ -1038,6 +1038,11 @@ public function view(string $Page = ''): void
10381038 /** For required extensions, classes, etc. */
10391039 $ ReqsLookupCache = [];
10401040
1041+ /** Rebuilding in order to strip out orphaned data. */
1042+ if (isset ($ _POST ['orphaned ' ])) {
1043+ $ NewConfig = [];
1044+ }
1045+
10411046 /** Iterate through configuration defaults. */
10421047 foreach ($ this ->Loader ->ConfigurationDefaults as $ CatKey => $ CatValue ) {
10431048 if (!is_array ($ CatValue )) {
@@ -1553,6 +1558,14 @@ public function view(string $Page = ''): void
15531558 $ this ->Loader ->L10N ->Data ,
15541559 $ this ->Loader ->parse ($ ThisDir , $ ConfigurationRow )
15551560 );
1561+
1562+ /** Rebuilding in order to strip out orphaned data. */
1563+ if (isset ($ NewConfig )) {
1564+ if (!isset ($ NewConfig [$ CatKey ])) {
1565+ $ NewConfig [$ CatKey ] = [];
1566+ }
1567+ $ NewConfig [$ CatKey ][$ DirKey ] = $ this ->Loader ->Configuration [$ CatKey ][$ DirKey ];
1568+ }
15561569 }
15571570 $ CatKeyFriendly = $ this ->Loader ->L10N ->getString ('config_ ' . $ CatKey . '_label ' ) ?: $ CatKey ;
15581571 $ FE ['Indexes ' ] .= sprintf (
@@ -1567,7 +1580,17 @@ public function view(string $Page = ''): void
15671580 unset($ ReqsLookupCache );
15681581
15691582 /** Update the currently active configuration file if any changes were made. */
1570- if ($ ConfigurationModified ) {
1583+ if ($ ConfigurationModified || isset ($ NewConfig )) {
1584+ if (isset ($ NewConfig )) {
1585+ foreach ($ this ->Loader ->Configuration as $ CatKey => $ CatValue ) {
1586+ if (substr ($ CatKey , 0 , 5 ) !== 'user. ' ) {
1587+ continue ;
1588+ }
1589+ $ NewConfig [$ CatKey ] = $ CatValue ;
1590+ }
1591+ $ this ->Loader ->Configuration = $ NewConfig ;
1592+ unset($ NewConfig );
1593+ }
15711594 if ($ this ->Loader ->updateConfiguration ()) {
15721595 $ FE ['state_msg ' ] = $ this ->Loader ->L10N ->getString ('response_configuration_updated ' );
15731596 } else {
0 commit comments