Translated using Weblate (French)
[phpmyadmin.git] / server_replication.php
blob4fa630ef030609feb07607e5343e46dff343a988
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * Server replications
6 * @package PhpMyAdmin
7 */
9 use PhpMyAdmin\ReplicationGui;
10 use PhpMyAdmin\Response;
11 use PhpMyAdmin\Server\Common;
12 use PhpMyAdmin\Template;
14 /**
15 * include files
17 require_once 'libraries/common.inc.php';
18 require_once 'libraries/server_common.inc.php';
19 require_once 'libraries/replication.inc.php';
21 /**
22 * Does the common work
24 $response = Response::getInstance();
25 $header = $response->getHeader();
26 $scripts = $header->getScripts();
27 $scripts->addFile('server_privileges.js');
28 $scripts->addFile('replication.js');
29 $scripts->addFile('vendor/zxcvbn.js');
31 /**
32 * Checks if the user is allowed to do what he tries to...
34 if (! $GLOBALS['dbi']->isSuperuser()) {
35 $html = Template::get('server/sub_page_header')->render([
36 'type' => 'replication',
37 ]);
38 $html .= PhpMyAdmin\Message::error(__('No Privileges'))->getDisplay();
39 $response->addHTML($html);
40 exit;
43 // change $GLOBALS['url_params'] with $_REQUEST['url_params']
44 // only if it is an array
45 if (isset($_REQUEST['url_params']) && is_array($_REQUEST['url_params'])) {
46 $GLOBALS['url_params'] = $_REQUEST['url_params'];
49 $replicationGui = new ReplicationGui();
51 /**
52 * Handling control requests
54 $replicationGui->handleControlRequest();
56 /**
57 * start output
59 $response->addHTML('<div id="replication">');
60 $response->addHTML(Template::get('server/sub_page_header')->render([
61 'type' => 'replication',
62 ]));
64 // Display error messages
65 $response->addHTML($replicationGui->getHtmlForErrorMessage());
67 if ($GLOBALS['replication_info']['master']['status']) {
68 $response->addHTML($replicationGui->getHtmlForMasterReplication());
69 } elseif (! isset($_REQUEST['mr_configure'])
70 && ! isset($_REQUEST['repl_clear_scr'])
71 ) {
72 $response->addHTML($replicationGui->getHtmlForNotServerReplication());
75 if (isset($_REQUEST['mr_configure'])) {
76 // Render the 'Master configuration' section
77 $response->addHTML($replicationGui->getHtmlForMasterConfiguration());
78 exit;
81 $response->addHTML('</div>');
83 if (! isset($_REQUEST['repl_clear_scr'])) {
84 // Render the 'Slave configuration' section
85 $response->addHTML(
86 $replicationGui->getHtmlForSlaveConfiguration(
87 $GLOBALS['replication_info']['slave']['status'],
88 $server_slave_replication
92 if (isset($_REQUEST['sl_configure'])) {
93 $response->addHTML($replicationGui->getHtmlForReplicationChangeMaster("slave_changemaster"));