Pull-request: #16588 Fixes: #16463 Signed-off-by: William Desportes <williamdes@wdes.fr>
This commit is contained in:
commit
1bff22ed32
@ -2407,6 +2407,8 @@ class DatabaseInterface implements DbalInterface
|
||||
|
||||
/**
|
||||
* Server version as number
|
||||
*
|
||||
* @example 80011
|
||||
*/
|
||||
public function getVersion(): int
|
||||
{
|
||||
|
||||
@ -4,6 +4,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Query;
|
||||
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\Util;
|
||||
use function is_string;
|
||||
use function strlen;
|
||||
@ -185,4 +186,20 @@ class Compatibility
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static function supportsReferencesPrivilege(DatabaseInterface $dbi): bool
|
||||
{
|
||||
// See: https://mariadb.com/kb/en/grant/#table-privileges
|
||||
// Unused
|
||||
if ($dbi->isMariaDB()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// https://dev.mysql.com/doc/refman/5.6/en/privileges-provided.html#priv_references
|
||||
// This privilege is unused before MySQL 5.6.22.
|
||||
// As of 5.6.22, creation of a foreign key constraint
|
||||
// requires at least one of the SELECT, INSERT, UPDATE, DELETE,
|
||||
// or REFERENCES privileges for the parent table.
|
||||
return $dbi->getVersion() >= 50622;
|
||||
}
|
||||
}
|
||||
|
||||
@ -12,6 +12,7 @@ use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\Html\Generator;
|
||||
use PhpMyAdmin\Html\MySQLDocumentation;
|
||||
use PhpMyAdmin\Message;
|
||||
use PhpMyAdmin\Query\Compatibility;
|
||||
use PhpMyAdmin\Relation;
|
||||
use PhpMyAdmin\RelationCleanup;
|
||||
use PhpMyAdmin\Response;
|
||||
@ -736,6 +737,8 @@ class Privileges
|
||||
'row' => $row,
|
||||
'columns' => $columns ?? [],
|
||||
'has_submit' => $submit,
|
||||
'supports_references_privilege' => Compatibility::supportsReferencesPrivilege($this->dbi),
|
||||
'is_mariadb' => $this->dbi->isMariaDB(),
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@ -642,7 +642,8 @@
|
||||
{%- trans 'Has no effect in this MySQL version.' %}"{{ row['References_priv'] == 'Y' ? ' checked' }}>
|
||||
<label for="checkbox_References_priv">
|
||||
<code>
|
||||
<dfn title="{% trans 'Has no effect in this MySQL version.' %}">
|
||||
{# l10n: The "REFERENCES" privilege when granting privileges #}
|
||||
<dfn title="{{ supports_references_privilege ? 'Allows creating foreign key relations.'|trans : (is_mariadb ? 'Not used on MariaDB.'|trans: 'Not used for this MySQL version.'|trans) }}">
|
||||
REFERENCES
|
||||
</dfn>
|
||||
</code>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user