phpmyadmin/server_replication.php
Piyush Vijay a99acfef71 Modularize server related remaining files like replication, plugins, queries, processes.
Sever monitor is also modularised and is not working but jQplot is not imported as it is giving error with webpack.
Another issue with these files is that table sorter is also not woking
working properly as it is not available on npm as plugin.
Signed-off-by: Piyush Vijay <piyushvijay.1997@gmail.com>
2018-07-30 23:08:28 +05:30

97 lines
2.4 KiB
PHP

<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Server replications
*
* @package PhpMyAdmin
*/
declare(strict_types=1);
use PhpMyAdmin\Message;
use PhpMyAdmin\ReplicationGui;
use PhpMyAdmin\Response;
use PhpMyAdmin\Template;
/**
* include files
*/
require_once 'libraries/common.inc.php';
require_once 'libraries/server_common.inc.php';
require_once 'libraries/replication.inc.php';
/**
* Does the common work
*/
$response = Response::getInstance();
$header = $response->getHeader();
$scripts = $header->getScripts();
$scripts->addFile('server_privileges');
$scripts->addFile('replication');
$template = new Template();
/**
* Checks if the user is allowed to do what he tries to...
*/
if (! $GLOBALS['dbi']->isSuperuser()) {
$html = $template->render('server/sub_page_header', [
'type' => 'replication',
]);
$html .= Message::error(__('No Privileges'))->getDisplay();
$response->addHTML($html);
exit;
}
// change $GLOBALS['url_params'] with $_REQUEST['url_params']
// only if it is an array
if (isset($_REQUEST['url_params']) && is_array($_REQUEST['url_params'])) {
$GLOBALS['url_params'] = $_REQUEST['url_params'];
}
$replicationGui = new ReplicationGui();
/**
* Handling control requests
*/
$replicationGui->handleControlRequest();
/**
* start output
*/
$response->addHTML('<div id="replication">');
$response->addHTML($template->render('server/sub_page_header', [
'type' => 'replication',
]));
// Display error messages
$response->addHTML($replicationGui->getHtmlForErrorMessage());
if ($GLOBALS['replication_info']['master']['status']) {
$response->addHTML($replicationGui->getHtmlForMasterReplication());
} elseif (! isset($_REQUEST['mr_configure'])
&& ! isset($_REQUEST['repl_clear_scr'])
) {
$response->addHTML($replicationGui->getHtmlForNotServerReplication());
}
if (isset($_REQUEST['mr_configure'])) {
// Render the 'Master configuration' section
$response->addHTML($replicationGui->getHtmlForMasterConfiguration());
exit;
}
$response->addHTML('</div>');
if (! isset($_REQUEST['repl_clear_scr'])) {
// Render the 'Slave configuration' section
$response->addHTML(
$replicationGui->getHtmlForSlaveConfiguration(
$GLOBALS['replication_info']['slave']['status'],
$server_slave_replication
)
);
}
if (isset($_REQUEST['sl_configure'])) {
$response->addHTML($replicationGui->getHtmlForReplicationChangeMaster("slave_changemaster"));
}