Skip to content

Commit

Permalink
Merge branch 'QA_5_0' into master
Browse files Browse the repository at this point in the history
Signed-off-by: William Desportes <williamdes@wdes.fr>
  • Loading branch information
williamdes committed Oct 21, 2019
2 parents 4cc8907 + 3236ae2 commit 14d73c1
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 23 deletions.
2 changes: 2 additions & 0 deletions ChangeLog
Expand Up @@ -55,6 +55,8 @@ phpMyAdmin - ChangeLog
- issue #14898 Fixed bottom table in list in left panel blocked by horizontal scroll bar
- issue #15161 Fix text area overflows its parent element on "Query" page
- issue #15511 Fixed exporting users after a delete will delete all selected users on "Users" page
- issue #14598 Fixed checking referencial integrity on "Operations" page
- issue #14433 Fix "You do not have privileges to manipulate with the users!" on root superadmin

4.9.1 (2019-09-20)
- issue #15313 Added support for Twig 2
Expand Down
18 changes: 8 additions & 10 deletions doc/bookmarks.rst
Expand Up @@ -11,22 +11,21 @@ Bookmarks
Storing bookmarks
-----------------

Any query you have executed can be stored as a bookmark on the page
Any query that is executed can be marked as a bookmark on the page
where the results are displayed. You will find a button labeled
:guilabel:`Bookmark this query` just at the end of the page. As soon as you have
stored a bookmark, it is related to the database you run the query on.
You can now access a bookmark dropdown on each page, the query box
appears on for that database.
stored a bookmark, that query is linked to the database.
You can now access a bookmark dropdown on each page where the query box appears on for that database.

Variables inside bookmarks
--------------------------

You can also have, inside the query, placeholders for variables.
Inside a query, you can also add placeholders for variables.
This is done by inserting into the query SQL comments between ``/*`` and
``*/``. Inside the comments, the special strings ``[VARIABLE{variable-number}]`` is used.
``*/``. The special string ``[VARIABLE{variable-number}]`` is used inside the comments.
Be aware that the whole query minus the SQL comments must be
valid by itself, otherwise you won't be able to store it as a bookmark.
Note also that the text 'VARIABLE' is case-sensitive.
Also note that the text 'VARIABLE' is case-sensitive.

When you execute the bookmark, everything typed into the *Variables*
input boxes on the query box page will replace the strings ``/*[VARIABLE{variable-number}]*/`` in
Expand All @@ -48,14 +47,13 @@ which will be expanded to
in your query, where VARIABLE1 is the string you entered in the Variable 1 input box.

A more complex example. Say you have stored
this query:
A more complex example, say you have stored this query:

.. code-block:: mysql
SELECT Name, Address FROM addresses WHERE 1 /* AND Name LIKE '%[VARIABLE1]%' */
Say, you now enter "phpMyAdmin" as the variable for the stored query, the full
If you wish to enter "phpMyAdmin" as the variable for the stored query, the full
query will be:

.. code-block:: mysql
Expand Down
8 changes: 4 additions & 4 deletions js/designer/move.js
Expand Up @@ -621,8 +621,8 @@ DesignerMove.addOtherDbTables = function () {
'server': CommonParams.get('server')
}, function (data) {
$(data.message).find('table.table_results.data.ajax').find('td.data').each(function () {
var val = $(this)[0].innerHTML;
$selectDb.append('<option value="' + val + '">' + val + '</option>');
var val = $(this)[0].innerText;
$selectDb.append($('<option></option>').val(val).text(val));
});
});

Expand Down Expand Up @@ -657,8 +657,8 @@ DesignerMove.addOtherDbTables = function () {
$selectTable.append('<option value="">' + Messages.strNone + '</option>');
}
rows.each(function () {
var val = $(this)[0].innerHTML;
$selectTable.append('<option value="' + val + '">' + val + '</option>');
var val = $(this)[0].innerText;
$selectTable.append($('<option></option>').val(val).text(val));
});
});
}
Expand Down
6 changes: 5 additions & 1 deletion libraries/classes/DatabaseInterface.php
Expand Up @@ -2410,7 +2410,11 @@ public function getCurrentUserAndHost(): array
{
if (count($this->_current_user) === 0) {
$user = $this->getCurrentUser();
$this->_current_user = explode("@", $user);
if ($user === '@') {// Request did not succeed, please do not cache
return ['', ''];
} else {
$this->_current_user = explode("@", $user);
}
}
return $this->_current_user;
}
Expand Down
5 changes: 4 additions & 1 deletion libraries/classes/Operations.php
Expand Up @@ -1805,7 +1805,10 @@ public function getHtmlForReferentialIntegrityCheck(array $foreign, array $url_p
. ' IS NOT NULL';
$this_url_params = array_merge(
$url_params,
['sql_query' => $join_query]
[
'sql_query' => $join_query,
'sql_signature' => Core::signSqlQuery($join_query),
]
);

$html_output .= '<li>'
Expand Down
6 changes: 4 additions & 2 deletions templates/database/designer/database_tables.twig
@@ -1,6 +1,8 @@
{% for designerTable in tables %}
{% set i = loop.index0 %}
{% set t_n_url = designerTable.getDbTableString()|escape('url') %}
{% set db = designerTable.getDatabaseName() %}
{% set db_url = db|escape('url') %}
{% set t_n = designerTable.getDbTableString() %}
<input name="t_x[{{ t_n_url }}]" type="hidden" id="t_x_{{ t_n_url }}_" />
<input name="t_y[{{ t_n_url }}]" type="hidden" id="t_y_{{ t_n_url }}_" />
Expand All @@ -25,7 +27,7 @@
style="margin: 0;"
value="select_all_{{ t_n_url }}"
id="select_all_{{ t_n_url }}"
title="select all"
title="{% trans 'Select all' %}"
designer_url_table_name="{{ t_n_url }}"
designer_out_owner="{{ designerTable.getDatabaseName() }}">
</td>
Expand Down Expand Up @@ -63,7 +65,7 @@
{% for j in 0..tab_column[t_n]['COLUMN_ID']|length - 1 %}
{% set tmp_column = t_n ~ '.' ~ tab_column[t_n]['COLUMN_NAME'][j] %}
{% set click_field_param = [
t_n,
db_url,
tab_column[t_n]['COLUMN_NAME'][j]|url_encode
] %}
{% if not designerTable.supportsForeignkeys() %}
Expand Down
3 changes: 3 additions & 0 deletions test/classes/OperationsTest.php
Expand Up @@ -279,6 +279,9 @@ public function testGetHtmlForPartitionMaintenance()
*/
public function testGetHtmlForReferentialIntegrityCheck()
{
$GLOBALS['cfg']['blowfish_secret'] = '';
$_SESSION[' HMAC_secret '] = hash('sha1', 'test');

$actual = $this->operations->getHtmlForReferentialIntegrityCheck(
[
[
Expand Down
10 changes: 5 additions & 5 deletions test/selenium/Database/ProceduresTest.php
Expand Up @@ -84,7 +84,7 @@ protected function tearDown(): void
private function _procedureSQL()
{
$this->dbQuery(
"CREATE PROCEDURE `test_procedure`(IN `inp` VARCHAR(10), OUT `outp` INT)"
"CREATE PROCEDURE `test_procedure`(IN `inp` VARCHAR(20), OUT `outp` INT)"
. " NOT DETERMINISTIC READS SQL DATA SQL SECURITY DEFINER SELECT char_"
. "length(inp) + count(*) FROM test_table INTO outp"
);
Expand Down Expand Up @@ -113,7 +113,7 @@ public function testAddProcedure()
$this->byName("item_param_type[0]"),
'VARCHAR'
);
$this->byName("item_param_length[0]")->sendKeys("10");
$this->byName("item_param_length[0]")->sendKeys("20");

$this->byCssSelector("input[value='Add parameter']")->click();

Expand Down Expand Up @@ -145,7 +145,7 @@ public function testAddProcedure()
);

$this->assertEquals(1, $result->num_rows);
$this->_executeProcedure("test_procedure", 10);
$this->_executeProcedure("test_procedure", 14);
}

/**
Expand All @@ -169,7 +169,7 @@ public function testEditProcedure()
$this->byPartialLinkText("Edit")->click();
$this->waitForElement('className', "rte_form");
$this->byName("item_param_length[0]")->clear();
$this->byName("item_param_length[0]")->sendKeys("12");
$this->byName("item_param_length[0]")->sendKeys("30");

$this->byXPath("//button[contains(., 'Go')]")->click();

Expand All @@ -179,7 +179,7 @@ public function testEditProcedure()
. "'Routine `test_procedure` has been modified')]"
);

$this->_executeProcedure("test_procedure", 12);
$this->_executeProcedure("test_procedure", 14);
}

/**
Expand Down

0 comments on commit 14d73c1

Please sign in to comment.