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