Skip to content

Commit

Permalink
Merge pull request #2981 from NamelessMC/release/2.0.1
Browse files Browse the repository at this point in the history
Fix issues with setSetting for core module
  • Loading branch information
samerton authored Aug 6, 2022
2 parents b2de508 + 4dffdeb commit c1e179c
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions core/classes/Core/Util.php
Original file line number Diff line number Diff line change
Expand Up @@ -346,12 +346,17 @@ public static function setSetting(string $setting, ?string $new_value, string $m
}
} else {
if ($module === 'core') {
DB::getInstance()->query(
'INSERT INTO `nl2_settings` (`name`, `value`)
VALUES (?, ?)
ON DUPLICATE KEY UPDATE `value` = ?',
[$setting, $new_value, $new_value]
);
if (DB::getInstance()->query('SELECT * FROM nl2_settings WHERE `name` = ? and `module` IS NULL', [$setting])->count()) {
DB::getInstance()->query(
'UPDATE `nl2_settings` SET `value` = ? WHERE `name` = ? AND `module` IS NULL',
[$new_value, $setting]
);
} else {
DB::getInstance()->query(
'INSERT INTO `nl2_settings` (`name`, `value`) VALUES (?, ?)',
[$setting, $new_value]
);
}
} else {
DB::getInstance()->query(
'INSERT INTO `nl2_settings` (`name`, `value`, `module`)
Expand Down

0 comments on commit c1e179c

Please sign in to comment.