modified version update
This commit is contained in:
parent
c6ece08a0b
commit
06df37ed3c
|
@ -2,7 +2,7 @@
|
|||
"name": "24unix/bindapi",
|
||||
"description": "manage Bind9 DNS server via REST API",
|
||||
"version": "1.0.9",
|
||||
"build_number": "364",
|
||||
"build_number": "365",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Micha Espey",
|
||||
|
|
|
@ -40,13 +40,19 @@ readonly class SettingsRepository
|
|||
|
||||
public function set(string $name, string $value): int
|
||||
{
|
||||
|
||||
$currentSetting = $this->findByName($name);
|
||||
if ($currentSetting !== false) {
|
||||
$sql = "
|
||||
UPDATE " . DatabaseConnection::TABLE_SETTINGS . "
|
||||
SET value = :value
|
||||
WHERE name = :name
|
||||
";
|
||||
} else {
|
||||
$sql = "
|
||||
INSERT INTO " . DatabaseConnection::TABLE_SETTINGS . " (name, value)
|
||||
VALUES (:name, :value)
|
||||
ON DUPLICATE KEY UPDATE
|
||||
value = :value
|
||||
";
|
||||
}
|
||||
|
||||
try {
|
||||
$statement = $this->databaseConnection->getConnection()->prepare(query: $sql);
|
||||
|
|
Loading…
Reference in New Issue