Source
$cmd_tdb .= 'psql --username='.$DB['USER'].$server.$port.' --dbname='.$DB['DATABASE'].' --command="SELECT timescaledb_post_restore();" ';
<?php
/*
** Copyright (C) 2001-2025 Zabbix SIA
**
** This program is free software: you can redistribute it and/or modify it under the terms of
** the GNU Affero General Public License as published by the Free Software Foundation, version 3.
**
** This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
** without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
** See the GNU Affero General Public License for more details.
**
** You should have received a copy of the GNU Affero General Public License along with this program.
** If not, see <https://www.gnu.org/licenses/>.
**/
require_once __DIR__.'/../../../include/gettextwrapper.inc.php';
require_once __DIR__.'/../../../include/defines.inc.php';
require_once __DIR__.'/../../../conf/zabbix.conf.php';
require_once __DIR__.'/../../../include/func.inc.php';
require_once __DIR__.'/../../../include/classes/api/CApiService.php';
require_once __DIR__.'/../../../include/db.inc.php';
require_once __DIR__.'/../../../include/classes/db/DB.php';
require_once __DIR__.'/../../../include/classes/db/DBException.php';
require_once __DIR__.'/../../../include/classes/user/CWebUser.php';
require_once __DIR__.'/../../../include/classes/debug/CProfiler.php';
require_once __DIR__.'/../../../include/classes/db/DbBackend.php';
require_once __DIR__.'/../../../include/classes/db/MysqlDbBackend.php';
require_once __DIR__.'/../../../include/classes/db/PostgresqlDbBackend.php';
require_once __DIR__.'/CTestArrayHelper.php';
/**
* Database helper.
*/
class CDBHelper {
/**
* Backup stack.
*
* @var array
*/
static $backups = [];
static $db_extension;
/**
* Perform select query and check the result.
*
* @param string $sql query to be executed
* @param integer $limit data limit
* @param integer $offset data offset
*
* @return mixed
*
* @throws Exception
*/
protected static function select($sql, $limit = null, $offset = 0) {
if (($result = DBselect($sql, $limit, $offset)) === false) {
throw new Exception('Failed to execute query: "'.$sql.'".');
}
return $result;
}