diff options
| author | Charles <sircharlesaze@gmail.com> | 2020-01-09 10:55:03 +0100 |
|---|---|---|
| committer | Charles <sircharlesaze@gmail.com> | 2020-01-09 13:09:38 +0100 |
| commit | 04d6d5ca99ebfd1cebb8ce06618fb3811fc1a8aa (patch) | |
| tree | 5c691241355c943a3c68ddb06b8cf8c60aa11319 /srcs/phpmyadmin/templates/server/replication | |
| parent | 7e0d85db834d6351ed85d01e5126ac31dc510b86 (diff) | |
| download | ft_server-04d6d5ca99ebfd1cebb8ce06618fb3811fc1a8aa.tar.gz ft_server-04d6d5ca99ebfd1cebb8ce06618fb3811fc1a8aa.tar.bz2 ft_server-04d6d5ca99ebfd1cebb8ce06618fb3811fc1a8aa.zip | |
phpmyadmin working
Diffstat (limited to 'srcs/phpmyadmin/templates/server/replication')
8 files changed, 391 insertions, 0 deletions
diff --git a/srcs/phpmyadmin/templates/server/replication/change_master.twig b/srcs/phpmyadmin/templates/server/replication/change_master.twig new file mode 100644 index 0000000..1ff75ba --- /dev/null +++ b/srcs/phpmyadmin/templates/server/replication/change_master.twig @@ -0,0 +1,35 @@ +<form method="post" action="server_replication.php"> + {{ get_hidden_inputs('', '') }} + <fieldset id="fieldset_add_user_login"> + <legend> + {% trans 'Slave configuration' %} - + {% trans 'Change or reconfigure master server' %} + </legend> + <p> + {% trans 'Make sure you have a unique server-id in your configuration file (my.cnf). If not, please add the following line into [mysqld] section:' %} + </p> + <pre>server-id={{ server_id }}</pre> + + <div class="item"> + <label for="text_username">{% trans 'User name:' %}</label> + <input id="text_username" name="username" type="text" maxlength="{{ username_length }}" title="{% trans 'User name' %}" required> + </div> + <div class="item"> + <label for="text_pma_pw">{% trans 'Password:' %}</label> + <input id="text_pma_pw" name="pma_pw" type="password" title="{% trans 'Password' %}" required> + </div> + <div class="item"> + <label for="text_hostname">{% trans 'Host:' %}</label> + <input id="text_hostname" name="hostname" type="text" maxlength="{{ hostname_length }}" value="" required> + </div> + <div class="item"> + <label for="text_port">{% trans 'Port:' %}</label> + <input id="text_port" name="text_port" type="number" maxlength="6" value="3306" required> + </div> + </fieldset> + <fieldset id="fieldset_user_privtable_footer" class="tblFooters"> + <input type="hidden" name="sr_take_action" value="true"> + <input type="hidden" name="{{ submit_name }}" value="1"> + <input class="btn btn-primary" type="submit" id="confslave_submit" value="{% trans 'Go' %}"> + </fieldset> +</form> diff --git a/srcs/phpmyadmin/templates/server/replication/database_multibox.twig b/srcs/phpmyadmin/templates/server/replication/database_multibox.twig new file mode 100644 index 0000000..816db08 --- /dev/null +++ b/srcs/phpmyadmin/templates/server/replication/database_multibox.twig @@ -0,0 +1,9 @@ +<select id="db_select" class="width96" name="db_select[]" size="6" multiple> + {% for database in databases %} + <option value="{{ database }}">{{ database }}</option> + {% endfor %} +</select> +<p> + <a href="#" id="db_select_href">{% trans 'Select all' %}</a> / + <a href="#" id="db_reset_href">{% trans 'Unselect all' %}</a> +</p> diff --git a/srcs/phpmyadmin/templates/server/replication/index.twig b/srcs/phpmyadmin/templates/server/replication/index.twig new file mode 100644 index 0000000..c40df0d --- /dev/null +++ b/srcs/phpmyadmin/templates/server/replication/index.twig @@ -0,0 +1,36 @@ +<h2> + {{ get_image('s_replication') }} + {% trans 'Replication' %} +</h2> + +{% if is_super_user %} + <div id="replication"> + {{ error_messages|raw }} + + {% if is_master %} + {{ master_replication_html|raw }} + {% elseif master_configure is null and clear_screen is null %} + <fieldset> + <legend>{% trans 'Master replication' %}</legend> + {% apply format('<a href="server_replication.php" data-post="' ~ get_common(url_params|merge({'mr_configure': true}), '') ~ '">', '</a>')|raw %} + {% trans %} + This server is not configured as master in a replication process. Would you like to %sconfigure%s it? + {% endtrans %} + {% endapply %} + </fieldset> + {% endif %} + + {% if master_configure is not null %} + {{ master_configuration_html|raw }} + {% else %} + {% if clear_screen is null %} + {{ slave_configuration_html|raw }} + {% endif %} + {% if slave_configure is not null %} + {{ change_master_html|raw }} + {% endif %} + {% endif %} + </div> +{% else %} + {{ 'No privileges'|trans|error }} +{% endif %} diff --git a/srcs/phpmyadmin/templates/server/replication/master_add_slave_user.twig b/srcs/phpmyadmin/templates/server/replication/master_add_slave_user.twig new file mode 100644 index 0000000..5c2eec3 --- /dev/null +++ b/srcs/phpmyadmin/templates/server/replication/master_add_slave_user.twig @@ -0,0 +1,84 @@ +<div id="master_addslaveuser_gui"> + <form action="server_privileges.php" method="post" autocomplete="off" onsubmit="return checkAddUser(this);"> + {{ get_hidden_inputs('', '') }} + + <fieldset id="fieldset_add_user_login"> + <legend>{% trans 'Add slave replication user' %}</legend> + + <input type="hidden" name="grant_count" value="25"> + <input type="hidden" name="createdb" id="createdb_0" value="0"> + {# Needed for the replication slaves. #} + <input type="hidden" name="Repl_slave_priv" id="checkbox_Repl_slave_priv" value="Y"> + <input type="hidden" name="sr_take_action" value="true"> + + <div class="item"> + <label for="select_pred_username"> + {% trans 'User name:' %} + </label> + <span class="options"> + <select name="pred_username" id="select_pred_username" title="{% trans 'User name' %}"> + <option value="any"{{ predefined_username == 'any' ? ' selected' }}>{% trans 'Any user' %}</option> + <option value="userdefined"{{ predefined_username == 'userdefined' ? ' selected' }}>{% trans 'Use text field:' %}</option> + </select> + </span> + <input type="text" name="username" id="pma_username" maxlength="{{ username_length }}" title="{% trans 'User name' %}" value="{{ username }}"> + </div> + + <div class="item"> + <label for="select_pred_hostname"> + {% trans 'Host:' %} + </label> + <span class="options"> + <select name="pred_hostname" id="select_pred_hostname" title="{% trans 'Host' %}" + {%- if this_host is not null %} data-thishost="{{ this_host }}"{% endif %}> + <option value="any"{{ predefined_hostname == 'any' ? ' selected' }}>{% trans 'Any host' %}</option> + <option value="localhost"{{ predefined_hostname == 'localhost' ? ' selected' }}>{% trans 'Local' %}</option> + {% if this_host is not null %} + <option value="thishost"{{ predefined_hostname == 'thishost' ? ' selected' }}>{% trans 'This host' %}</option> + {% endif %} + <option value="hosttable"{{ predefined_hostname == 'hosttable' ? ' selected' }}>{% trans 'Use host table' %}</option> + <option value="userdefined"{{ predefined_hostname == 'userdefined' ? ' selected' }}>{% trans 'Use text field:' %}</option> + </select> + </span> + <input type="text" name="hostname" id="pma_hostname" maxlength="{{ hostname_length }}" title="{% trans 'Host' %}" value="{{ hostname }}"> + {{ show_hint('When Host table is used, this field is ignored and values stored in Host table are used instead.'|trans) }} + </div> + + <div class="item"> + <label for="select_pred_password"> + {% trans 'Password:' %} + </label> + <span class="options"> + <select name="pred_password" id="select_pred_password" title="{% trans 'Password' %}"> + <option value="none"{{ has_username ? ' selected' }}>{% trans 'No password' %}</option> + <option value="userdefined"{{ not has_username ? ' selected' }}>{% trans 'Use text field:' %}</option> + </select> + </span> + <input type="password" id="text_pma_pw" name="pma_pw" title="{% trans 'Password' %}"> + </div> + + <div class="item"> + <label for="text_pma_pw2"> + {% trans 'Re-type:' %} + </label> + <span class="options"></span> + <input type="password" id="text_pma_pw2" name="pma_pw2" title="{% trans 'Re-type' %}"> + </div> + + <div class="item"> + <label for="button_generate_password"> + {% trans 'Generate password:' %} + </label> + <span class="options"> + <input type="button" class="btn btn-secondary button" id="button_generate_password" value="{% trans 'Generate' %}" onclick="Functions.suggestPassword(this.form)"> + </span> + <input type="text" name="generated_pw" id="generated_pw"> + </div> + </fieldset> + + <fieldset id="fieldset_user_privtable_footer" class="tblFooters"> + <input type="hidden" name="adduser_submit" value="1"> + <input class="btn btn-primary" type="submit" id="adduser_submit" value="{% trans 'Go' %}"> + </fieldset> + </form> +</div> diff --git a/srcs/phpmyadmin/templates/server/replication/master_configuration.twig b/srcs/phpmyadmin/templates/server/replication/master_configuration.twig new file mode 100644 index 0000000..5243bac --- /dev/null +++ b/srcs/phpmyadmin/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> diff --git a/srcs/phpmyadmin/templates/server/replication/master_replication.twig b/srcs/phpmyadmin/templates/server/replication/master_replication.twig new file mode 100644 index 0000000..8ba5d1b --- /dev/null +++ b/srcs/phpmyadmin/templates/server/replication/master_replication.twig @@ -0,0 +1,52 @@ +{% if not clear_screen %} + <fieldset> + <legend>{% trans 'Master replication' %}</legend> + {% trans 'This server is configured as master in a replication process.' %} + <ul> + <li> + <a href="#master_status_href" id="master_status_href"> + {% trans 'Show master status' %} + </a> + {{ master_status_table|raw }} + </li> + <li> + <p> + <a href="#master_slaves_href" id="master_slaves_href"> + {% trans 'Show connected slaves' %} + </a> + </p> + + <div id="replication_slaves_section" style="display: none;"> + <table class="data"> + <thead> + <tr> + <th>{% trans 'Server ID' %}</th> + <th>{% trans 'Host' %}</th> + </tr> + </thead> + <tbody> + {% for slave in slaves %} + <tr> + <td class="value">{{ slave['Server_id'] }}</td> + <td class="value">{{ slave['Host'] }}</td> + </tr> + {% endfor %} + </tbody> + </table> + <br> + {{ 'Only slaves started with the --report-host=host_name option are visible in this list.'|trans|notice }} + <br> + </div> + </li> + <li> + <a href="server_replication.php" data-post="{{ get_common(url_params, '') }}" id="master_addslaveuser_href"> + {% trans 'Add slave replication user' %} + </a> + </li> +{% endif %} +{% if master_add_user %} + {{ master_add_slave_user|raw }} +{% elseif not clear_screen %} + </ul> + </fieldset> +{% endif %} diff --git a/srcs/phpmyadmin/templates/server/replication/slave_configuration.twig b/srcs/phpmyadmin/templates/server/replication/slave_configuration.twig new file mode 100644 index 0000000..5b12ea7 --- /dev/null +++ b/srcs/phpmyadmin/templates/server/replication/slave_configuration.twig @@ -0,0 +1,109 @@ +<fieldset> + <legend>{% trans 'Slave replication' %}</legend> + {% if server_slave_multi_replication %} + {% trans 'Master connection:' %} + <form method="get" action="server_replication.php"> + {{ get_hidden_inputs(url_params) }} + <select name="master_connection"> + <option value="">{% trans 'Default' %}</option> + {% for server in server_slave_multi_replication %} + <option value="{{ server['Connection_name'] }}"{{ master_connection == server['Connection_name'] ? ' selected' }}> + {{ server['Connection_name'] }} + </option> + {% endfor %} + </select> + <input id="goButton" class="btn btn-primary" type="submit" value="{% trans 'Go' %}"> + </form> + <br> + <br> + {% endif %} + + {% if server_slave_status %} + <div id="slave_configuration_gui"> + {% if not slave_sql_running %} + {{ 'Slave SQL Thread not running!'|trans|error }} + {% endif %} + {% if not slave_io_running %} + {{ 'Slave IO Thread not running!'|trans|error }} + {% endif %} + + <p>{% trans 'Server is configured as slave in a replication process. Would you like to:' %}</p> + <ul> + <li> + <a href="#slave_status_href" id="slave_status_href">{% trans 'See slave status table' %}</a> + {{ slave_status_table|raw }} + </li> + <li> + <a href="#slave_control_href" id="slave_control_href">{% trans 'Control slave:' %}</a> + <div id="slave_control_gui" class="hide"> + <ul> + <li> + <a href="server_replication.php" data-post="{{ slave_control_full_link }}"> + {{ not slave_io_running or not slave_sql_running ? 'Full start' : 'Full stop' }} + </a> + </li> + <li> + <a class="ajax" id="reset_slave" href="server_replication.php" data-post="{{ slave_control_reset_link }}"> + {% trans 'Reset slave' %} + </a> + </li> + <li> + <a href="server_replication.php" data-post="{{ slave_control_sql_link }}"> + {% if not slave_sql_running %} + {% trans 'Start SQL Thread only' %} + {% else %} + {% trans 'Stop SQL Thread only' %} + {% endif %} + </a> + </li> + <li> + <a href="server_replication.php" data-post="{{ slave_control_io_link }}"> + {% if not slave_io_running %} + {% trans 'Start IO Thread only' %} + {% else %} + {% trans 'Stop IO Thread only' %} + {% endif %} + </a> + </li> + </ul> + </div> + </li> + <li> + <a href="#slave_errormanagement_href" id="slave_errormanagement_href"> + {% trans 'Error management:' %} + </a> + <div id="slave_errormanagement_gui" class="hide"> + {{ 'Skipping errors might lead into unsynchronized master and slave!'|trans|error }} + <ul> + <li> + <a href="server_replication.php" data-post="{{ slave_skip_error_link }}"> + {% trans 'Skip current error' %} + </a> + </li> + <li> + <form method="post" action="server_replication.php"> + {{ get_hidden_inputs('', '') }} + {{ 'Skip next %s errors.'|trans|format('<input type="text" name="sr_skip_errors_count" value="1" class="repl_gui_skip_err_cnt">')|raw }} + <input class="btn btn-primary" type="submit" name="sr_slave_skip_error" value="{% trans 'Go' %}"> + <input type="hidden" name="sr_take_action" value="1"> + </form> + </li> + </ul> + </div> + </li> + <li> + <a href="server_replication.php" data-post="{{ reconfigure_master_link }}"> + {% trans 'Change or reconfigure master server' %} + </a> + </li> + </ul> + </div> + {% elseif not has_slave_configure %} + {% apply format('<a href="server_replication.php" data-post="' ~ get_common(url_params|merge({ + 'sl_configure': true, + 'repl_clear_scr': true + })) ~ '">', '</a>')|raw %} + {% trans 'This server is not configured as slave in a replication process. Would you like to %sconfigure%s it?' %} + {% endapply %} + {% endif %} +</fieldset> diff --git a/srcs/phpmyadmin/templates/server/replication/status_table.twig b/srcs/phpmyadmin/templates/server/replication/status_table.twig new file mode 100644 index 0000000..79c45f6 --- /dev/null +++ b/srcs/phpmyadmin/templates/server/replication/status_table.twig @@ -0,0 +1,34 @@ +<div id="replication_{{ type }}_section"{{ is_hidden ? ' style="display: none;"' }}> + {% if has_title %} + <h4> + <a id="replication_{{ type }}"></a> + {% if type == 'master' %} + {% trans 'Master status' %} + {% else %} + {% trans 'Slave status' %} + {% endif %} + </h4> + {% endif %} + + <table id="server{{ type }}replicationsummary" class="data"> + <thead> + <tr> + <th>{% trans 'Variable' %}</th> + <th>{% trans 'Value' %}</th> + </tr> + </thead> + + <tbody> + {% for variable in variables %} + <tr> + <td class="name">{{ variable.name }}</td> + <td class="value"> + <span{% if variable.status == 'attention' %} class="attention"{% elseif variable.status == 'allfine' %} class="allfine"{% endif %}> + {{ variable.value }} + </span> + </td> + </tr> + {% endfor %} + </tbody> + </table> +</div> |
