Fix selectedServer['only_db']
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
This commit is contained in:
parent
547e4d87dc
commit
534e751f64
@ -7764,24 +7764,6 @@ parameters:
|
||||
count: 8
|
||||
path: src/Navigation/Nodes/Node.php
|
||||
|
||||
-
|
||||
message: '#^Construct empty\(\) is not allowed\. Use more strict comparison\.$#'
|
||||
identifier: empty.notAllowed
|
||||
count: 4
|
||||
path: src/Navigation/Nodes/Node.php
|
||||
|
||||
-
|
||||
message: '#^Method PhpMyAdmin\\Navigation\\Nodes\\Node\:\:getDatabasesToSearch\(\) should return array\<mixed\> but returns list\<string\>\|string\.$#'
|
||||
identifier: return.type
|
||||
count: 1
|
||||
path: src/Navigation/Nodes/Node.php
|
||||
|
||||
-
|
||||
message: '#^Parameter \#1 \$array of function sort expects TArray of array\<string\>, array\<string\>\|string given\.$#'
|
||||
identifier: argument.type
|
||||
count: 1
|
||||
path: src/Navigation/Nodes/Node.php
|
||||
|
||||
-
|
||||
message: '#^Parameter \#1 \$db of method PhpMyAdmin\\Navigation\\Nodes\\Node\:\:isHideDb\(\) expects string, string\|null given\.$#'
|
||||
identifier: argument.type
|
||||
@ -7794,12 +7776,6 @@ parameters:
|
||||
count: 4
|
||||
path: src/Navigation/Nodes/Node.php
|
||||
|
||||
-
|
||||
message: '#^Parameter \#1 \$str of method PhpMyAdmin\\Dbal\\DatabaseInterface\:\:quoteString\(\) expects string, mixed given\.$#'
|
||||
identifier: argument.type
|
||||
count: 5
|
||||
path: src/Navigation/Nodes/Node.php
|
||||
|
||||
-
|
||||
message: '#^Binary operation "\." between mixed and ''\)'' results in an error\.$#'
|
||||
identifier: binaryOp.invalid
|
||||
@ -16353,12 +16329,6 @@ parameters:
|
||||
count: 7
|
||||
path: tests/unit/Navigation/Nodes/NodeTest.php
|
||||
|
||||
-
|
||||
message: '#^Property PhpMyAdmin\\Config\:\:\$selectedServer \(array\{host\: string, port\: string, socket\: string, ssl\: bool, ssl_key\: string\|null, ssl_cert\: string\|null, ssl_ca\: string\|null, ssl_ca_path\: string\|null, \.\.\.\}\) does not accept array\{host\: string, port\: string, socket\: string, ssl\: bool, ssl_key\: string\|null, ssl_cert\: string\|null, ssl_ca\: string\|null, ssl_ca_path\: string\|null, \.\.\.\}\.$#'
|
||||
identifier: assign.propertyType
|
||||
count: 3
|
||||
path: tests/unit/Navigation/Nodes/NodeTest.php
|
||||
|
||||
-
|
||||
message: '''
|
||||
#^Call to deprecated method getInstance\(\) of class PhpMyAdmin\\Config\:
|
||||
|
||||
@ -5276,23 +5276,6 @@
|
||||
<code><![CDATA[DatabaseInterface::getInstance()]]></code>
|
||||
<code><![CDATA[DatabaseInterface::getInstance()]]></code>
|
||||
</DeprecatedMethod>
|
||||
<MixedArgument>
|
||||
<code><![CDATA[$db]]></code>
|
||||
<code><![CDATA[$db]]></code>
|
||||
<code><![CDATA[$db]]></code>
|
||||
<code><![CDATA[$db]]></code>
|
||||
<code><![CDATA[$db]]></code>
|
||||
</MixedArgument>
|
||||
<MixedAssignment>
|
||||
<code><![CDATA[$db]]></code>
|
||||
<code><![CDATA[$db]]></code>
|
||||
<code><![CDATA[$db]]></code>
|
||||
<code><![CDATA[$db]]></code>
|
||||
<code><![CDATA[$db]]></code>
|
||||
</MixedAssignment>
|
||||
<PossiblyInvalidArgument>
|
||||
<code><![CDATA[$databases]]></code>
|
||||
</PossiblyInvalidArgument>
|
||||
<PossiblyNullArgument>
|
||||
<code><![CDATA[$arr[0]]]></code>
|
||||
<code><![CDATA[$arr[0]]]></code>
|
||||
@ -5312,12 +5295,6 @@
|
||||
<PossiblyNullOperand>
|
||||
<code><![CDATA[$arr[0]]]></code>
|
||||
</PossiblyNullOperand>
|
||||
<RiskyTruthyFalsyComparison>
|
||||
<code><![CDATA[empty($this->config->selectedServer['hide_db'])]]></code>
|
||||
<code><![CDATA[empty($this->config->selectedServer['hide_db'])]]></code>
|
||||
<code><![CDATA[empty($this->config->selectedServer['only_db'])]]></code>
|
||||
<code><![CDATA[empty($this->config->selectedServer['only_db'])]]></code>
|
||||
</RiskyTruthyFalsyComparison>
|
||||
</file>
|
||||
<file src="src/Navigation/Nodes/NodeColumn.php">
|
||||
<MixedArgument>
|
||||
@ -10518,10 +10495,6 @@
|
||||
<code><![CDATA[Config::getInstance()]]></code>
|
||||
<code><![CDATA[Config::getInstance()]]></code>
|
||||
</DeprecatedMethod>
|
||||
<InvalidPropertyAssignmentValue>
|
||||
<code><![CDATA[$config->selectedServer]]></code>
|
||||
<code><![CDATA[$config->selectedServer]]></code>
|
||||
</InvalidPropertyAssignmentValue>
|
||||
</file>
|
||||
<file src="tests/unit/Navigation/Nodes/ObjectFetcherTest.php">
|
||||
<DeprecatedMethod>
|
||||
|
||||
@ -434,7 +434,7 @@ class Node
|
||||
*/
|
||||
private function isHideDb(string $db): bool
|
||||
{
|
||||
return ! empty($this->config->selectedServer['hide_db'])
|
||||
return $this->config->selectedServer['hide_db'] !== ''
|
||||
&& preg_match('/' . $this->config->selectedServer['hide_db'] . '/', $db) === 1;
|
||||
}
|
||||
|
||||
@ -446,15 +446,15 @@ class Node
|
||||
*
|
||||
* @param string $searchClause search clause
|
||||
*
|
||||
* @return mixed[] array of databases
|
||||
* @return string[] array of databases
|
||||
*/
|
||||
private function getDatabasesToSearch(UserPrivileges $userPrivileges, string $searchClause): array
|
||||
{
|
||||
$databases = [];
|
||||
if ($searchClause !== '') {
|
||||
$databases = ['%' . DatabaseInterface::getInstance()->escapeMysqlWildcards($searchClause) . '%'];
|
||||
} elseif (! empty($this->config->selectedServer['only_db'])) {
|
||||
$databases = $this->config->selectedServer['only_db'];
|
||||
} elseif ($this->config->selectedServer['only_db'] !== '') {
|
||||
$databases = (array) $this->config->selectedServer['only_db'];
|
||||
} elseif ($userPrivileges->databasesToTest !== false && $userPrivileges->databasesToTest !== []) {
|
||||
$databases = $userPrivileges->databasesToTest;
|
||||
}
|
||||
@ -480,12 +480,12 @@ class Node
|
||||
. ' LIKE ' . $dbi->quoteString('%' . $dbi->escapeMysqlWildcards($searchClause) . '%') . ' ';
|
||||
}
|
||||
|
||||
if (! empty($this->config->selectedServer['hide_db'])) {
|
||||
if ($this->config->selectedServer['hide_db'] !== '') {
|
||||
$whereClause .= 'AND ' . Util::backquote($columnName)
|
||||
. ' NOT REGEXP ' . $dbi->quoteString($this->config->selectedServer['hide_db']) . ' ';
|
||||
}
|
||||
|
||||
if (! empty($this->config->selectedServer['only_db'])) {
|
||||
if ($this->config->selectedServer['only_db'] !== '') {
|
||||
if (is_string($this->config->selectedServer['only_db'])) {
|
||||
$this->config->selectedServer['only_db'] = [$this->config->selectedServer['only_db']];
|
||||
}
|
||||
|
||||
@ -295,7 +295,7 @@ final class NodeTest extends AbstractTestCase
|
||||
"WHERE TRUE AND `SCHEMA_NAME` NOT REGEXP 'regexpHideDb' ",
|
||||
$method->invoke($node, 'SCHEMA_NAME'),
|
||||
);
|
||||
unset($config->selectedServer['hide_db']);
|
||||
$config->selectedServer['hide_db'] = '';
|
||||
|
||||
// When only_db directive is present and it's a single db
|
||||
$config->selectedServer['only_db'] = 'stringOnlyDb';
|
||||
@ -303,7 +303,7 @@ final class NodeTest extends AbstractTestCase
|
||||
"WHERE TRUE AND ( `SCHEMA_NAME` LIKE 'stringOnlyDb' ) ",
|
||||
$method->invoke($node, 'SCHEMA_NAME'),
|
||||
);
|
||||
unset($config->selectedServer['only_db']);
|
||||
$config->selectedServer['only_db'] = '';
|
||||
|
||||
// When only_db directive is present and it's an array of dbs
|
||||
$config->selectedServer['only_db'] = ['onlyDbOne', 'onlyDbTwo'];
|
||||
@ -311,7 +311,7 @@ final class NodeTest extends AbstractTestCase
|
||||
'WHERE TRUE AND ( `SCHEMA_NAME` LIKE \'onlyDbOne\' OR `SCHEMA_NAME` LIKE \'onlyDbTwo\' ) ',
|
||||
$method->invoke($node, 'SCHEMA_NAME'),
|
||||
);
|
||||
unset($config->selectedServer['only_db']);
|
||||
$config->selectedServer['only_db'] = '';
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Loading…
Reference in New Issue
Block a user