Files
Sentri/pub/api/classes/API_system_sources.php
2026-06-15 16:04:21 +02:00

39 lines
1.5 KiB
PHP

<?php
namespace api\classes;
use api\classes\API;
use JetBrains\PhpStorm\NoReturn;
require_once 'API.php';
class API_system_sources extends API
{
#[NoReturn]
public function inserveUpdate()
{
$query = "INSERT INTO system_sources (
source_uuid,
source_name,
source_url,
source_auth_username,
source_auth_password,
source_auth_token,
source_custom_data,
source_create_timestamp,
source_modified_timestamp)
VALUES (UUID(), 'inserve', ?, '', '', ?, ?, ?, NULL)
ON DUPLICATE KEY UPDATE
source_url = VALUES(source_url),
source_auth_token = VALUES(source_auth_token),
source_custom_data = VALUES(source_custom_data),
source_modified_timestamp = VALUES(source_create_timestamp)";
$stmt = $this->prepareStatement($query);
$source_modified_timestamp = time();
$stmt->bind_param('sssi', $this->data['source_url'], $this->data['source_auth_token'], $this->data['source_custom_data'], $source_modified_timestamp);
$this->executeStatement($stmt);
$stmt->close();
$this->apiOutput(200, ['success' => 'Information modified'], 'Information updated successfully.');
}
}