Files
2026-04-15 15:23:57 +07:00

63 lines
1.5 KiB
PHP

<?php
class Replikasi extends MY_Controller
{
var $db;
function __construct()
{
parent::__construct();
}
function status()
{
try {
if (! $this->isLogin) {
$this->sys_error("Invalid Token");
exit;
}
$prm = $this->sys_input;
$sql_data = "show slave status";
$qry_data = $this->db->query($sql_data);
// $last_qry = $this->db->last_query();
// print_r($last_qry);
if ($sql_data) {
$rows = $qry_data->result_array();
} else {
$this->sys_error_db("slave status error", $this->db);
exit;
}
$result = array(
"records" => $rows
);
$this->sys_ok($result);
} catch (Exception $exc) {
$message = $exc->getMessage();
$this->sys_error($message);
}
}
function start_slave()
{
try {
if (! $this->isLogin) {
$this->sys_error("Invalid Token");
exit;
}
$sql_data = "start slave";
$qry_data = $this->db->query($sql_data);
if ($sql_data) {
$this->sys_ok($qry_data);
} else {
$this->sys_error_db("start slave error", $this->db);
exit;
}
} catch (Exception $exc) {
$message = $exc->getMessage();
$this->sys_error($message);
}
}
}
?>