Skip to content

Commit

Permalink
Extract HTML from ReplicationGui::getHtmlForMasterConfiguration
Browse files Browse the repository at this point in the history
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
  • Loading branch information
MauricioFauth committed Mar 31, 2019
1 parent 99a853e commit 6d0bdeb
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 39 deletions.
43 changes: 4 additions & 39 deletions libraries/classes/ReplicationGui.php
Expand Up @@ -103,46 +103,11 @@ public function getHtmlForMasterReplication()
*/
public function getHtmlForMasterConfiguration()
{
$html = '<fieldset>';
$html .= '<legend>' . __('Master configuration') . '</legend>';
$html .= __(
'This server is not configured as a master server in a '
. 'replication process. You can choose from either replicating '
. 'all databases and ignoring some of them (useful if you want to '
. 'replicate a majority of the databases) or you can choose to ignore '
. 'all databases by default and allow only certain databases to be '
. 'replicated. Please select the mode:'
) . '<br><br>';

$html .= '<select name="db_type" id="db_type">';
$html .= '<option value="all">' . __('Replicate all databases; Ignore:');
$html .= '</option>';
$html .= '<option value="ign">' . __('Ignore all databases; Replicate:');
$html .= '</option>';
$html .= '</select>';
$html .= '<br><br>';
$html .= __('Please select databases:') . '<br>';
$html .= $this->getHtmlForReplicationDbMultibox();
$html .= '<br><br>';
$html .= __(
'Now, add the following lines at the end of [mysqld] section'
. ' in your my.cnf and please restart the MySQL server afterwards.'
) . '<br>';
$html .= '<pre id="rep"></pre>';
$html .= __(
'Once you restarted MySQL server, please click on Go button. '
. 'Afterwards, you should see a message informing you, that this server'
. ' <b>is</b> configured as master.'
);
$html .= '</fieldset>';
$html .= '<fieldset class="tblFooters">';
$html .= ' <form method="post" action="server_replication.php" >';
$html .= Url::getHiddenInputs('', '');
$html .= ' <input id="goButton" class="btn btn-primary" type="submit" value="' . __('Go') . '">';
$html .= ' </form>';
$html .= '</fieldset>';
$databaseMultibox = $this->getHtmlForReplicationDbMultibox();

return $html;
return $this->template->render('server/replication/master_configuration', [
'database_multibox' => $databaseMultibox,
]);
}

/**
Expand Down
32 changes: 32 additions & 0 deletions templates/server/replication/master_configuration.twig
@@ -0,0 +1,32 @@
<fieldset>
<legend>{% trans 'Master configuration' %}</legend>
<p>
{% trans %}
This server is not configured as a master server in a replication process. You can choose from either replicating all databases and ignoring some of them (useful if you want to replicate a majority of the databases) or you can choose to ignore all databases by default and allow only certain databases to be replicated. Please select the mode:
{% endtrans %}
</p>
<select name="db_type" id="db_type">
<option value="all">{% trans 'Replicate all databases; Ignore:' %}</option>
<option value="ign">{% trans 'Ignore all databases; Replicate:' %}</option>
</select>
<p>{% trans 'Please select databases:' %}</p>
{{ database_multibox|raw }}
<p>
{% trans %}
Now, add the following lines at the end of [mysqld] section in your my.cnf and please restart the MySQL server afterwards.
{% endtrans %}
</p>
<pre id="rep"></pre>
<p>
{% trans %}
Once you restarted MySQL server, please click on Go button. Afterwards, you should see a message informing you, that this server <strong>is</strong> configured as master.
{% endtrans %}
</p>
</fieldset>

<fieldset class="tblFooters">
<form method="post" action="server_replication.php">
{{ get_hidden_inputs('', '') }}
<input id="goButton" class="btn btn-primary" type="submit" value="{% trans 'Go' %}">
</form>
</fieldset>

0 comments on commit 6d0bdeb

Please sign in to comment.