@@ -42,6 +42,7 @@ public function __construct(SettingMapper $settingMapper) {
42
42
public function checkForSettingsUpdates ($ app_data ) {
43
43
$ settings = $ this ->settingMapper ->findAll ();
44
44
if (count ($ settings ) > 0 ) {
45
+ $ this ->updateSettingsTexts ($ app_data , $ settings );
45
46
$ this ->checkForNewSettings ($ app_data , $ settings );
46
47
$ this ->checkForDeletedSettings ($ app_data , $ settings );
47
48
}
@@ -94,4 +95,29 @@ private function checkForDeletedSettings(array $app_data, array $settings): void
94
95
}
95
96
}
96
97
}
98
+
99
+ private function updateSettingsTexts (array $ app_data , array $ settings ) {
100
+ $ newSettingsKeys = array_map (function ($ setting ) {
101
+ return $ setting ['name ' ];
102
+ }, $ app_data ['settings ' ]);
103
+ foreach ($ settings as $ setting ) {
104
+ if (in_array ($ setting ->getName (), $ newSettingsKeys )) {
105
+ $ newSetting = null ;
106
+ foreach ($ app_data ['settings ' ] as $ s ) {
107
+ if ($ s ['name ' ] == $ setting ->getName ()) {
108
+ $ newSetting = $ s ;
109
+ }
110
+ }
111
+ if (isset ($ newSetting )) {
112
+ if ($ setting ->getDescription () !== $ newSetting ['description ' ]) {
113
+ $ setting ->setDescription ($ newSetting ['description ' ]);
114
+ }
115
+ if ($ setting ->getDisplayName () !== $ newSetting ['displayName ' ]) {
116
+ $ setting ->setDisplayName ($ newSetting ['displayName ' ]);
117
+ }
118
+ $ this ->settingMapper ->update ($ setting );
119
+ }
120
+ }
121
+ }
122
+ }
97
123
}
0 commit comments