Merge pull request #17894 from MauricioFauth/dblist-global-removal
Remove the `dblist` global variable
This commit is contained in:
commit
40e44c0001
@ -13,8 +13,6 @@ final class CopyFormController extends AbstractController
|
||||
{
|
||||
public function __invoke(ServerRequest $request): void
|
||||
{
|
||||
$GLOBALS['dblist'] = $GLOBALS['dblist'] ?? null;
|
||||
|
||||
$selected = $_POST['selected_tbl'] ?? [];
|
||||
|
||||
if (empty($selected)) {
|
||||
@ -29,7 +27,7 @@ final class CopyFormController extends AbstractController
|
||||
$urlParams['selected'][] = $selectedValue;
|
||||
}
|
||||
|
||||
$databasesList = $GLOBALS['dblist']->databases;
|
||||
$databasesList = $GLOBALS['dbi']->getDatabaseList();
|
||||
foreach ($databasesList as $key => $databaseName) {
|
||||
if ($databaseName == $GLOBALS['db']) {
|
||||
$databasesList->offsetUnset($key);
|
||||
|
||||
@ -10,7 +10,6 @@ final class DatabaseController extends AbstractController
|
||||
{
|
||||
public function __invoke(ServerRequest $request): void
|
||||
{
|
||||
$GLOBALS['dblist'] = $GLOBALS['dblist'] ?? null;
|
||||
$this->response->addJSON(['databases' => $GLOBALS['dblist']->databases]);
|
||||
$this->response->addJSON(['databases' => $GLOBALS['dbi']->getDatabaseList()]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -48,7 +48,6 @@ final class DestroyController extends AbstractController
|
||||
{
|
||||
$GLOBALS['selected'] = $GLOBALS['selected'] ?? null;
|
||||
$GLOBALS['errorUrl'] = $GLOBALS['errorUrl'] ?? null;
|
||||
$GLOBALS['dblist'] = $GLOBALS['dblist'] ?? null;
|
||||
$GLOBALS['reload'] = $GLOBALS['reload'] ?? null;
|
||||
|
||||
$selected_dbs = $_POST['selected_dbs'] ?? null;
|
||||
@ -90,7 +89,7 @@ final class DestroyController extends AbstractController
|
||||
$this->transformations->clear($database);
|
||||
}
|
||||
|
||||
$GLOBALS['dblist']->databases->build();
|
||||
$this->dbi->getDatabaseList()->build();
|
||||
|
||||
$message = Message::success(
|
||||
_ngettext(
|
||||
|
||||
@ -78,7 +78,6 @@ class DatabasesController extends AbstractController
|
||||
public function __invoke(ServerRequest $request): void
|
||||
{
|
||||
$GLOBALS['server'] = $GLOBALS['server'] ?? null;
|
||||
$GLOBALS['dblist'] = $GLOBALS['dblist'] ?? null;
|
||||
$GLOBALS['is_create_db_priv'] = $GLOBALS['is_create_db_priv'] ?? null;
|
||||
$GLOBALS['db_to_create'] = $GLOBALS['db_to_create'] ?? null;
|
||||
$GLOBALS['text_dir'] = $GLOBALS['text_dir'] ?? null;
|
||||
@ -121,7 +120,7 @@ class DatabasesController extends AbstractController
|
||||
$this->position,
|
||||
true
|
||||
);
|
||||
$this->databaseCount = count($GLOBALS['dblist']->databases);
|
||||
$this->databaseCount = count($this->dbi->getDatabaseList());
|
||||
}
|
||||
|
||||
$urlParams = [
|
||||
|
||||
@ -489,8 +489,9 @@ class OperationsController extends AbstractController
|
||||
$possibleRowFormats = $this->operations->getPossibleRowFormat();
|
||||
|
||||
$databaseList = [];
|
||||
if (count($GLOBALS['dblist']->databases) <= $GLOBALS['cfg']['MaxDbList']) {
|
||||
$databaseList = $GLOBALS['dblist']->databases->getList();
|
||||
$listDatabase = $this->dbi->getDatabaseList();
|
||||
if (count($listDatabase) <= $GLOBALS['cfg']['MaxDbList']) {
|
||||
$databaseList = $listDatabase->getList();
|
||||
}
|
||||
|
||||
$hasForeignKeys = ! empty($this->relation->getForeigners($GLOBALS['db'], $GLOBALS['table'], '', 'foreign'));
|
||||
|
||||
@ -179,7 +179,7 @@ final class RelationController extends AbstractController
|
||||
'db' => $GLOBALS['db'],
|
||||
'table' => $GLOBALS['table'],
|
||||
'url_params' => $GLOBALS['urlParams'],
|
||||
'databases' => $GLOBALS['dblist']->databases,
|
||||
'databases' => $this->dbi->getDatabaseList(),
|
||||
'foreign_db' => $foreignDb,
|
||||
'foreign_table' => $foreignTable,
|
||||
'unique_columns' => $uniqueColumns,
|
||||
@ -198,7 +198,7 @@ final class RelationController extends AbstractController
|
||||
'db' => $GLOBALS['db'],
|
||||
'table' => $GLOBALS['table'],
|
||||
'url_params' => $GLOBALS['urlParams'],
|
||||
'databases' => $GLOBALS['dblist']->databases,
|
||||
'databases' => $this->dbi->getDatabaseList(),
|
||||
'foreign_db' => false,
|
||||
'foreign_table' => false,
|
||||
'unique_columns' => [],
|
||||
@ -220,7 +220,7 @@ final class RelationController extends AbstractController
|
||||
'column_hash_array' => $column_hash_array,
|
||||
'save_row' => array_values($columns),
|
||||
'url_params' => $GLOBALS['urlParams'],
|
||||
'databases' => $GLOBALS['dblist']->databases,
|
||||
'databases' => $this->dbi->getDatabaseList(),
|
||||
'dbi' => $this->dbi,
|
||||
'default_sliders_state' => $GLOBALS['cfg']['InitialSlidersState'],
|
||||
'route' => $request->getRoute(),
|
||||
|
||||
@ -1,48 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Database;
|
||||
|
||||
use PhpMyAdmin\ListDatabase;
|
||||
|
||||
class DatabaseList
|
||||
{
|
||||
/**
|
||||
* Holds database list
|
||||
*
|
||||
* @var ListDatabase
|
||||
*/
|
||||
protected $databases = null;
|
||||
|
||||
/**
|
||||
* magic access to protected/inaccessible members/properties
|
||||
*
|
||||
* @see https://www.php.net/language.oop5.overloading
|
||||
*
|
||||
* @param string $param parameter name
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function __get($param)
|
||||
{
|
||||
switch ($param) {
|
||||
case 'databases':
|
||||
return $this->getDatabaseList();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Accessor to PMA::$databases
|
||||
*/
|
||||
public function getDatabaseList(): ListDatabase
|
||||
{
|
||||
if ($this->databases === null) {
|
||||
$this->databases = new ListDatabase();
|
||||
}
|
||||
|
||||
return $this->databases;
|
||||
}
|
||||
}
|
||||
@ -9,7 +9,6 @@ namespace PhpMyAdmin;
|
||||
|
||||
use PhpMyAdmin\Config\Settings\Server;
|
||||
use PhpMyAdmin\ConfigStorage\Relation;
|
||||
use PhpMyAdmin\Database\DatabaseList;
|
||||
use PhpMyAdmin\Dbal\DatabaseName;
|
||||
use PhpMyAdmin\Dbal\DbalInterface;
|
||||
use PhpMyAdmin\Dbal\DbiExtension;
|
||||
@ -141,6 +140,9 @@ class DatabaseInterface implements DbalInterface
|
||||
/** @var float */
|
||||
public $lastQueryExecutionTime = 0;
|
||||
|
||||
/** @var ListDatabase|null */
|
||||
private $databaseList = null;
|
||||
|
||||
/**
|
||||
* @param DbiExtension $ext Object to be used for database queries
|
||||
*/
|
||||
@ -701,14 +703,14 @@ class DatabaseInterface implements DbalInterface
|
||||
// f.e. to apply hide_db and only_db
|
||||
$drops = array_diff(
|
||||
array_keys($databases),
|
||||
(array) $GLOBALS['dblist']->databases
|
||||
(array) $this->getDatabaseList()
|
||||
);
|
||||
foreach ($drops as $drop) {
|
||||
unset($databases[$drop]);
|
||||
}
|
||||
} else {
|
||||
$databases = [];
|
||||
foreach ($GLOBALS['dblist']->databases as $databaseName) {
|
||||
foreach ($this->getDatabaseList() as $databaseName) {
|
||||
// Compatibility with INFORMATION_SCHEMA output
|
||||
$databases[$databaseName]['SCHEMA_NAME'] = $databaseName;
|
||||
|
||||
@ -843,7 +845,7 @@ class DatabaseInterface implements DbalInterface
|
||||
|
||||
$columns = [];
|
||||
if ($database === null) {
|
||||
foreach ($GLOBALS['dblist']->databases as $database) {
|
||||
foreach ($this->getDatabaseList() as $database) {
|
||||
$columns[$database] = $this->getColumnsFull($database, null, null, $link);
|
||||
}
|
||||
|
||||
@ -1145,10 +1147,7 @@ class DatabaseInterface implements DbalInterface
|
||||
/* Loads closest context to this version. */
|
||||
Context::loadClosest(($this->isMariaDb ? 'MariaDb' : 'MySql') . $this->versionInt);
|
||||
|
||||
/**
|
||||
* the DatabaseList class as a stub for the ListDatabase class
|
||||
*/
|
||||
$GLOBALS['dblist'] = new DatabaseList();
|
||||
$this->databaseList = null;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1190,14 +1189,11 @@ class DatabaseInterface implements DbalInterface
|
||||
public function postConnectControl(Relation $relation): void
|
||||
{
|
||||
// If Zero configuration mode enabled, check PMA tables in current db.
|
||||
if ($GLOBALS['cfg']['ZeroConf'] != true) {
|
||||
if (! $GLOBALS['cfg']['ZeroConf']) {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* the DatabaseList class as a stub for the ListDatabase class
|
||||
*/
|
||||
$GLOBALS['dblist'] = new DatabaseList();
|
||||
$this->databaseList = null;
|
||||
|
||||
$relation->initRelationParamsCache();
|
||||
}
|
||||
@ -2108,4 +2104,13 @@ class DatabaseInterface implements DbalInterface
|
||||
{
|
||||
return $this->extension->prepare($this->links[$link], $query);
|
||||
}
|
||||
|
||||
public function getDatabaseList(): ListDatabase
|
||||
{
|
||||
if ($this->databaseList === null) {
|
||||
$this->databaseList = new ListDatabase();
|
||||
}
|
||||
|
||||
return $this->databaseList;
|
||||
}
|
||||
}
|
||||
|
||||
@ -594,7 +594,7 @@ class Export
|
||||
}
|
||||
|
||||
// Walk over databases
|
||||
foreach ($GLOBALS['dblist']->databases as $currentDb) {
|
||||
foreach ($this->dbi->getDatabaseList() as $currentDb) {
|
||||
if (! isset($tmpSelect) || ! mb_strpos(' ' . $tmpSelect, '|' . $currentDb . '|')) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -67,7 +67,7 @@ final class Options
|
||||
}
|
||||
|
||||
$databases = [];
|
||||
foreach ($GLOBALS['dblist']->databases as $currentDb) {
|
||||
foreach ($GLOBALS['dbi']->getDatabaseList() as $currentDb) {
|
||||
if (Utilities::isSystemSchema($currentDb, true)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -122,7 +122,7 @@ class Operations
|
||||
|
||||
// rebuild the database list because Table::moveCopy
|
||||
// checks in this list if the target db exists
|
||||
$GLOBALS['dblist']->databases->build();
|
||||
$this->dbi->getDatabaseList()->build();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -212,7 +212,7 @@ class ReplicationGui
|
||||
public function getHtmlForReplicationDbMultibox(): string
|
||||
{
|
||||
$databases = [];
|
||||
foreach ($GLOBALS['dblist']->databases as $database) {
|
||||
foreach ($GLOBALS['dbi']->getDatabaseList() as $database) {
|
||||
if (Utilities::isSystemSchema($database)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -1914,7 +1914,7 @@ class Privileges
|
||||
$data['type'] = $type;
|
||||
|
||||
if ($type === 'database') {
|
||||
$predDbArray = $GLOBALS['dblist']->databases;
|
||||
$predDbArray = $this->dbi->getDatabaseList();
|
||||
$databasesToSkip = [
|
||||
'information_schema',
|
||||
'performance_schema',
|
||||
@ -1922,24 +1922,22 @@ class Privileges
|
||||
|
||||
$databases = [];
|
||||
$escapedDatabases = [];
|
||||
if (! empty($predDbArray)) {
|
||||
foreach ($predDbArray as $currentDb) {
|
||||
if (in_array($currentDb, $databasesToSkip)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$currentDbEscaped = Util::escapeMysqlWildcards($currentDb);
|
||||
// cannot use array_diff() once, outside of the loop,
|
||||
// because the list of databases has special characters
|
||||
// already escaped in $foundRows,
|
||||
// contrary to the output of SHOW DATABASES
|
||||
if (in_array($currentDbEscaped, $foundRows)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$databases[] = $currentDb;
|
||||
$escapedDatabases[] = $currentDbEscaped;
|
||||
foreach ($predDbArray as $currentDb) {
|
||||
if (in_array($currentDb, $databasesToSkip)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$currentDbEscaped = Util::escapeMysqlWildcards($currentDb);
|
||||
// cannot use array_diff() once, outside of the loop,
|
||||
// because the list of databases has special characters
|
||||
// already escaped in $foundRows,
|
||||
// contrary to the output of SHOW DATABASES
|
||||
if (in_array($currentDbEscaped, $foundRows)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$databases[] = $currentDb;
|
||||
$escapedDatabases[] = $currentDbEscaped;
|
||||
}
|
||||
|
||||
$data['databases'] = $databases;
|
||||
|
||||
@ -984,8 +984,9 @@ class Table implements Stringable
|
||||
$GLOBALS['asfile'] = 1;
|
||||
|
||||
// Ensuring the target database is valid.
|
||||
if (! $GLOBALS['dblist']->databases->exists($sourceDb, $targetDb)) {
|
||||
if (! $GLOBALS['dblist']->databases->exists($sourceDb)) {
|
||||
$databaseList = $GLOBALS['dbi']->getDatabaseList();
|
||||
if (! $databaseList->exists($sourceDb, $targetDb)) {
|
||||
if (! $databaseList->exists($sourceDb)) {
|
||||
$GLOBALS['message'] = Message::rawError(
|
||||
sprintf(
|
||||
__('Source database `%s` was not found!'),
|
||||
@ -994,7 +995,7 @@ class Table implements Stringable
|
||||
);
|
||||
}
|
||||
|
||||
if (! $GLOBALS['dblist']->databases->exists($targetDb)) {
|
||||
if (! $databaseList->exists($targetDb)) {
|
||||
$GLOBALS['message'] = Message::rawError(
|
||||
sprintf(
|
||||
__('Target database `%s` was not found!'),
|
||||
@ -1461,7 +1462,7 @@ class Table implements Stringable
|
||||
|
||||
if ($newDb !== null && $newDb !== $this->getDbName()) {
|
||||
// Ensure the target is valid
|
||||
if (! $GLOBALS['dblist']->databases->exists($newDb)) {
|
||||
if (! $this->dbi->getDatabaseList()->exists($newDb)) {
|
||||
$this->errors[] = __('Invalid database:') . ' ' . $newDb;
|
||||
|
||||
return false;
|
||||
|
||||
@ -11165,11 +11165,6 @@ parameters:
|
||||
count: 1
|
||||
path: test/classes/TableTest.php
|
||||
|
||||
-
|
||||
message: "#^Strict comparison using \\=\\=\\= between mixed and mixed will always evaluate to true\\.$#"
|
||||
count: 1
|
||||
path: test/classes/TableTest.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpMyAdmin\\\\Tests\\\\TemplateTest\\:\\:providerTestDynamicRender\\(\\) return type has no value type specified in iterable type array\\.$#"
|
||||
count: 1
|
||||
|
||||
@ -1480,30 +1480,13 @@
|
||||
</PossiblyInvalidIterator>
|
||||
</file>
|
||||
<file src="libraries/classes/Controllers/Database/Structure/CopyFormController.php">
|
||||
<MixedAssignment occurrences="5">
|
||||
<code>$databaseName</code>
|
||||
<code>$databasesList</code>
|
||||
<code>$key</code>
|
||||
<MixedAssignment occurrences="2">
|
||||
<code>$selectedValue</code>
|
||||
<code>$urlParams['selected'][]</code>
|
||||
</MixedAssignment>
|
||||
<MixedMethodCall occurrences="2">
|
||||
<code>getList</code>
|
||||
<code>offsetUnset</code>
|
||||
</MixedMethodCall>
|
||||
<PossiblyInvalidIterator occurrences="1">
|
||||
<code>$selected</code>
|
||||
</PossiblyInvalidIterator>
|
||||
<PossiblyNullIterator occurrences="1">
|
||||
<code>$databasesList</code>
|
||||
</PossiblyNullIterator>
|
||||
<PossiblyNullPropertyFetch occurrences="1">
|
||||
<code>$GLOBALS['dblist']->databases</code>
|
||||
</PossiblyNullPropertyFetch>
|
||||
<PossiblyNullReference occurrences="2">
|
||||
<code>getList</code>
|
||||
<code>offsetUnset</code>
|
||||
</PossiblyNullReference>
|
||||
</file>
|
||||
<file src="libraries/classes/Controllers/Database/Structure/CopyTableController.php">
|
||||
<PossiblyInvalidArgument occurrences="8">
|
||||
@ -1876,11 +1859,6 @@
|
||||
<code>$GLOBALS['total_num_tables']</code>
|
||||
</MixedAssignment>
|
||||
</file>
|
||||
<file src="libraries/classes/Controllers/DatabaseController.php">
|
||||
<PossiblyNullPropertyFetch occurrences="1">
|
||||
<code>$GLOBALS['dblist']->databases</code>
|
||||
</PossiblyNullPropertyFetch>
|
||||
</file>
|
||||
<file src="libraries/classes/Controllers/ErrorReportController.php">
|
||||
<MixedArrayAccess occurrences="1">
|
||||
<code>$decoded_response['success']</code>
|
||||
@ -2598,9 +2576,6 @@
|
||||
<code>$GLOBALS['reload']</code>
|
||||
<code>$GLOBALS['selected']</code>
|
||||
</MixedAssignment>
|
||||
<MixedMethodCall occurrences="1">
|
||||
<code>build</code>
|
||||
</MixedMethodCall>
|
||||
<PossiblyInvalidArgument occurrences="3">
|
||||
<code>$database</code>
|
||||
<code>$database</code>
|
||||
@ -2610,12 +2585,6 @@
|
||||
<code>$database</code>
|
||||
<code>$database</code>
|
||||
</PossiblyInvalidCast>
|
||||
<PossiblyNullPropertyFetch occurrences="1">
|
||||
<code>$GLOBALS['dblist']->databases</code>
|
||||
</PossiblyNullPropertyFetch>
|
||||
<PossiblyNullReference occurrences="1">
|
||||
<code>build</code>
|
||||
</PossiblyNullReference>
|
||||
<TypeDoesNotContainType occurrences="1">
|
||||
<code>$selected_dbs === []</code>
|
||||
</TypeDoesNotContainType>
|
||||
@ -2624,8 +2593,7 @@
|
||||
<InvalidArrayOffset occurrences="1">
|
||||
<code>$GLOBALS['cfg']['AllowUserDropDatabase']</code>
|
||||
</InvalidArrayOffset>
|
||||
<MixedArgument occurrences="9">
|
||||
<code>$GLOBALS['dblist']->databases</code>
|
||||
<MixedArgument occurrences="8">
|
||||
<code>$database['DEFAULT_COLLATION_NAME']</code>
|
||||
<code>$database['SCHEMA_NAME']</code>
|
||||
<code>$primaryInfo['Do_DB']</code>
|
||||
@ -2680,12 +2648,6 @@
|
||||
<code>$params['sort_by']</code>
|
||||
<code>$params['sort_order']</code>
|
||||
</PossiblyInvalidArgument>
|
||||
<PossiblyNullArgument occurrences="1">
|
||||
<code>$GLOBALS['dblist']->databases</code>
|
||||
</PossiblyNullArgument>
|
||||
<PossiblyNullPropertyFetch occurrences="1">
|
||||
<code>$GLOBALS['dblist']->databases</code>
|
||||
</PossiblyNullPropertyFetch>
|
||||
<PropertyNotSetInConstructor occurrences="4">
|
||||
<code>$hasStatistics</code>
|
||||
<code>$position</code>
|
||||
@ -3560,10 +3522,9 @@
|
||||
</PossiblyInvalidOperand>
|
||||
</file>
|
||||
<file src="libraries/classes/Controllers/Table/OperationsController.php">
|
||||
<MixedArgument occurrences="7">
|
||||
<MixedArgument occurrences="6">
|
||||
<code>$GLOBALS['create_options']['pack_keys']</code>
|
||||
<code>$GLOBALS['create_options']['page_checksum'] ?? ''</code>
|
||||
<code>$GLOBALS['dblist']->databases</code>
|
||||
<code>$GLOBALS['row_format']</code>
|
||||
<code>$GLOBALS['warning_messages']</code>
|
||||
<code>$_message</code>
|
||||
@ -3576,7 +3537,7 @@
|
||||
<MixedArrayAccess occurrences="1">
|
||||
<code>$GLOBALS['showtable']['Row_format']</code>
|
||||
</MixedArrayAccess>
|
||||
<MixedAssignment occurrences="28">
|
||||
<MixedAssignment occurrences="27">
|
||||
<code>$GLOBALS['auto_increment']</code>
|
||||
<code>$GLOBALS['columns']</code>
|
||||
<code>$GLOBALS['comment']</code>
|
||||
@ -3604,11 +3565,7 @@
|
||||
<code>$GLOBALS['tbl_collation']</code>
|
||||
<code>$GLOBALS['tbl_is_view']</code>
|
||||
<code>$GLOBALS['warning_messages']</code>
|
||||
<code>$databaseList</code>
|
||||
</MixedAssignment>
|
||||
<MixedMethodCall occurrences="1">
|
||||
<code>getList</code>
|
||||
</MixedMethodCall>
|
||||
</file>
|
||||
<file src="libraries/classes/Controllers/Table/Partition/AnalyzeController.php">
|
||||
<MixedArgument occurrences="1">
|
||||
@ -4838,14 +4795,6 @@
|
||||
<code>(int) $GLOBALS['cfg']['MaxRows']</code>
|
||||
</RedundantCast>
|
||||
</file>
|
||||
<file src="libraries/classes/Database/DatabaseList.php">
|
||||
<DocblockTypeContradiction occurrences="1">
|
||||
<code>$this->databases === null</code>
|
||||
</DocblockTypeContradiction>
|
||||
<PossiblyNullPropertyAssignmentValue occurrences="1">
|
||||
<code>null</code>
|
||||
</PossiblyNullPropertyAssignmentValue>
|
||||
</file>
|
||||
<file src="libraries/classes/Database/Designer.php">
|
||||
<DeprecatedMethod occurrences="2">
|
||||
<code>escapeString</code>
|
||||
@ -5867,11 +5816,9 @@
|
||||
<InvalidReturnType occurrences="1">
|
||||
<code>int|bool</code>
|
||||
</InvalidReturnType>
|
||||
<MixedArgument occurrences="42">
|
||||
<MixedArgument occurrences="40">
|
||||
<code>$a</code>
|
||||
<code>$b</code>
|
||||
<code>$database</code>
|
||||
<code>$databaseName</code>
|
||||
<code>$grant</code>
|
||||
<code>$grant</code>
|
||||
<code>$host</code>
|
||||
@ -5923,8 +5870,7 @@
|
||||
<code>$tableData['Engine']</code>
|
||||
<code>$tableData['Index_length']</code>
|
||||
</MixedArrayAccess>
|
||||
<MixedArrayOffset occurrences="11">
|
||||
<code>$databases[$databaseName]</code>
|
||||
<MixedArrayOffset occurrences="10">
|
||||
<code>$resultRows[$row[$key]]</code>
|
||||
<code>$resultTarget[$row[$keyIndex]]</code>
|
||||
<code>$resultTarget[$row[$keyIndex]]</code>
|
||||
@ -5936,12 +5882,9 @@
|
||||
<code>$this->links[$link]</code>
|
||||
<code>$this->links[$link]</code>
|
||||
</MixedArrayOffset>
|
||||
<MixedAssignment occurrences="19">
|
||||
<MixedAssignment occurrences="16">
|
||||
<code>$aLength</code>
|
||||
<code>$bLength</code>
|
||||
<code>$database</code>
|
||||
<code>$databaseName</code>
|
||||
<code>$databases[$databaseName]['SCHEMA_NAME']</code>
|
||||
<code>$grant</code>
|
||||
<code>$grant</code>
|
||||
<code>$keyIndex</code>
|
||||
@ -6593,9 +6536,8 @@
|
||||
<InvalidReturnType occurrences="1">
|
||||
<code>int</code>
|
||||
</InvalidReturnType>
|
||||
<MixedArgument occurrences="15">
|
||||
<MixedArgument occurrences="14">
|
||||
<code>$GLOBALS['xkana'] ?? ''</code>
|
||||
<code>$currentDb</code>
|
||||
<code>$dbAlias</code>
|
||||
<code>$dbAlias</code>
|
||||
<code>$dbAlias</code>
|
||||
@ -6627,7 +6569,7 @@
|
||||
<code>$aliases[$dbName]['tables'][$tableName]</code>
|
||||
<code>$aliases[$dbName]['tables'][$tableName]</code>
|
||||
</MixedArrayOffset>
|
||||
<MixedAssignment occurrences="25">
|
||||
<MixedAssignment occurrences="24">
|
||||
<code>$GLOBALS['active_page']</code>
|
||||
<code>$GLOBALS['save_filename']</code>
|
||||
<code>$GLOBALS['time_start']</code>
|
||||
@ -6636,7 +6578,6 @@
|
||||
<code>$aliases[$dbName]['tables'][$tableName]['columns'][$col]</code>
|
||||
<code>$col</code>
|
||||
<code>$colAs</code>
|
||||
<code>$currentDb</code>
|
||||
<code>$dbAlias</code>
|
||||
<code>$dbAlias</code>
|
||||
<code>$table</code>
|
||||
@ -6654,8 +6595,7 @@
|
||||
<code>$view</code>
|
||||
<code>$views[]</code>
|
||||
</MixedAssignment>
|
||||
<MixedOperand occurrences="6">
|
||||
<code>$currentDb</code>
|
||||
<MixedOperand occurrences="5">
|
||||
<code>$table</code>
|
||||
<code>$table</code>
|
||||
<code>$this->dumpBufferObjects[$objectName]</code>
|
||||
@ -6676,9 +6616,6 @@
|
||||
<code>$GLOBALS['cfg']['Export']</code>
|
||||
<code>$GLOBALS['cfg']['Export']</code>
|
||||
</InvalidArrayOffset>
|
||||
<MixedArgument occurrences="1">
|
||||
<code>$currentDb</code>
|
||||
</MixedArgument>
|
||||
<MixedArrayAccess occurrences="5">
|
||||
<code>$GLOBALS['cfg']['Export']['compression']</code>
|
||||
<code>$GLOBALS['cfg']['Export']['file_template_database']</code>
|
||||
@ -6686,9 +6623,8 @@
|
||||
<code>$GLOBALS['cfg']['Export']['file_template_table']</code>
|
||||
<code>$_SESSION['tmpval']['aliases']</code>
|
||||
</MixedArrayAccess>
|
||||
<MixedAssignment occurrences="3">
|
||||
<MixedAssignment occurrences="2">
|
||||
<code>$aliases</code>
|
||||
<code>$currentDb</code>
|
||||
<code>$selectedCompression</code>
|
||||
</MixedAssignment>
|
||||
<PossiblyInvalidArgument occurrences="1">
|
||||
@ -9054,9 +8990,6 @@
|
||||
<code>$trigger</code>
|
||||
<code>$view</code>
|
||||
</MixedAssignment>
|
||||
<MixedMethodCall occurrences="1">
|
||||
<code>build</code>
|
||||
</MixedMethodCall>
|
||||
<MixedOperand occurrences="34">
|
||||
<code>$old_priv[$i]</code>
|
||||
<code>$old_priv[0]</code>
|
||||
@ -12224,8 +12157,7 @@
|
||||
</PossiblyNullArgument>
|
||||
</file>
|
||||
<file src="libraries/classes/ReplicationGui.php">
|
||||
<MixedArgument occurrences="6">
|
||||
<code>$database</code>
|
||||
<MixedArgument occurrences="5">
|
||||
<code>$errorMessage</code>
|
||||
<code>$serverReplicationVariable</code>
|
||||
<code>$successMessage</code>
|
||||
@ -12266,8 +12198,7 @@
|
||||
<code>$_SESSION['replication']['sr_action_status']</code>
|
||||
<code>$_SESSION['replication']['sr_action_status']</code>
|
||||
</MixedArrayAssignment>
|
||||
<MixedAssignment occurrences="6">
|
||||
<code>$database</code>
|
||||
<MixedAssignment occurrences="5">
|
||||
<code>$errorMessage</code>
|
||||
<code>$linkToPrimary</code>
|
||||
<code>$serverReplicationVariable</code>
|
||||
@ -12507,12 +12438,11 @@
|
||||
<InvalidReturnType occurrences="1">
|
||||
<code>array</code>
|
||||
</InvalidReturnType>
|
||||
<MixedArgument occurrences="40">
|
||||
<MixedArgument occurrences="39">
|
||||
<code>$GLOBALS['dbname']</code>
|
||||
<code>$alterRealSqlQuery</code>
|
||||
<code>$alterSqlQuery</code>
|
||||
<code>$createUserReal</code>
|
||||
<code>$currentDb</code>
|
||||
<code>$exportUser</code>
|
||||
<code>$exportUser</code>
|
||||
<code>$exportUser</code>
|
||||
@ -12632,7 +12562,7 @@
|
||||
<code>$specificPrivileges[$grant[0]]</code>
|
||||
<code>$specificPrivileges[$grant[0]]</code>
|
||||
</MixedArrayOffset>
|
||||
<MixedAssignment occurrences="57">
|
||||
<MixedAssignment occurrences="54">
|
||||
<code>$GLOBALS[$key]</code>
|
||||
<code>$GLOBALS['new_username']</code>
|
||||
<code>$GLOBALS['pred_hostname']</code>
|
||||
@ -12641,9 +12571,7 @@
|
||||
<code>$authenticationPlugin</code>
|
||||
<code>$authenticationPlugin</code>
|
||||
<code>$authenticationPlugin</code>
|
||||
<code>$currentDb</code>
|
||||
<code>$currentGrant</code>
|
||||
<code>$databases[]</code>
|
||||
<code>$exportUser</code>
|
||||
<code>$extraData['db_wildcard_privs']</code>
|
||||
<code>$foundRows[]</code>
|
||||
@ -12660,7 +12588,6 @@
|
||||
<code>$paramRoutineName</code>
|
||||
<code>$paramTableName</code>
|
||||
<code>$password</code>
|
||||
<code>$predDbArray</code>
|
||||
<code>$privilege</code>
|
||||
<code>$privilege['routine']</code>
|
||||
<code>$privilege['table']</code>
|
||||
@ -13405,6 +13332,13 @@
|
||||
<code>escapeString</code>
|
||||
<code>escapeString</code>
|
||||
</DeprecatedMethod>
|
||||
<InvalidArgument occurrences="5">
|
||||
<code>$newDb</code>
|
||||
<code>$sourceDb</code>
|
||||
<code>$sourceDb</code>
|
||||
<code>$targetDb</code>
|
||||
<code>$targetDb</code>
|
||||
</InvalidArgument>
|
||||
<InvalidReturnStatement occurrences="1">
|
||||
<code>$tableAutoIncrement ?? ''</code>
|
||||
</InvalidReturnStatement>
|
||||
@ -13588,12 +13522,6 @@
|
||||
<code>string</code>
|
||||
<code>string</code>
|
||||
</MixedInferredReturnType>
|
||||
<MixedMethodCall occurrences="4">
|
||||
<code>exists</code>
|
||||
<code>exists</code>
|
||||
<code>exists</code>
|
||||
<code>exists</code>
|
||||
</MixedMethodCall>
|
||||
<MixedOperand occurrences="2">
|
||||
<code>$backquoted ? Util::backquote($column) : $column</code>
|
||||
<code>$index[0]</code>
|
||||
|
||||
@ -240,7 +240,6 @@
|
||||
db_priv: bool,
|
||||
dbi: PhpMyAdmin\DatabaseInterface,
|
||||
dbs_to_test: string[]|false,
|
||||
dblist: PhpMyAdmin\Database\DatabaseList,
|
||||
display_query: string,
|
||||
errno: int,
|
||||
error: bool,
|
||||
|
||||
@ -53,10 +53,14 @@ class ExportControllerTest extends AbstractTestCase
|
||||
$GLOBALS['PMA_PHP_SELF'] = 'index.php';
|
||||
$GLOBALS['sql_indexes'] = null;
|
||||
$GLOBALS['sql_auto_increments'] = null;
|
||||
$GLOBALS['dblist'] = (object) ['databases' => ['test_db']];
|
||||
$GLOBALS['config']->selectServer();
|
||||
$GLOBALS['cfg'] = $GLOBALS['config']->settings;
|
||||
|
||||
$this->dummyDbi->addResult(
|
||||
'SELECT `SCHEMA_NAME` FROM `INFORMATION_SCHEMA`.`SCHEMATA`',
|
||||
[['test_db']],
|
||||
['SCHEMA_NAME']
|
||||
);
|
||||
$this->dummyDbi->addResult('SET SQL_MODE=""', [[]]);
|
||||
$this->dummyDbi->addResult('SET time_zone = "+00:00"', [[]]);
|
||||
$this->dummyDbi->addResult('SELECT @@session.time_zone', [['SYSTEM']]);
|
||||
|
||||
@ -14,7 +14,6 @@ use PhpMyAdmin\Tests\AbstractTestCase;
|
||||
use PhpMyAdmin\Tests\Stubs\DbiDummy;
|
||||
use PhpMyAdmin\Tests\Stubs\ResponseRenderer;
|
||||
use PhpMyAdmin\Transformations;
|
||||
use stdClass;
|
||||
|
||||
use function __;
|
||||
|
||||
@ -48,12 +47,7 @@ class DatabasesControllerTest extends AbstractTestCase
|
||||
|
||||
public function testIndexAction(): void
|
||||
{
|
||||
$GLOBALS['dblist'] = new stdClass();
|
||||
$GLOBALS['dblist']->databases = [
|
||||
'sakila',
|
||||
'employees',
|
||||
];
|
||||
|
||||
$GLOBALS['cfg']['Server']['only_db'] = '';
|
||||
$template = new Template();
|
||||
$transformations = new Transformations();
|
||||
$relationCleanup = new RelationCleanup(
|
||||
@ -71,6 +65,11 @@ class DatabasesControllerTest extends AbstractTestCase
|
||||
$GLOBALS['dbi']
|
||||
);
|
||||
|
||||
$this->dummyDbi->addResult(
|
||||
'SELECT `SCHEMA_NAME` FROM `INFORMATION_SCHEMA`.`SCHEMATA`',
|
||||
[['sakila'], ['employees']],
|
||||
['SCHEMA_NAME']
|
||||
);
|
||||
$this->dummyDbi->addSelectDb('mysql');
|
||||
$controller($this->createStub(ServerRequest::class));
|
||||
$this->dummyDbi->assertAllSelectsConsumed();
|
||||
|
||||
@ -39,7 +39,6 @@ class OperationsControllerTest extends AbstractTestCase
|
||||
$GLOBALS['text_dir'] = 'ltr';
|
||||
$GLOBALS['lang'] = 'en';
|
||||
$GLOBALS['PMA_PHP_SELF'] = 'index.php';
|
||||
$GLOBALS['dblist'] = (object) ['databases' => ['test_db']];
|
||||
$GLOBALS['db'] = 'test_db';
|
||||
$GLOBALS['table'] = 'test_table';
|
||||
|
||||
@ -53,6 +52,11 @@ class OperationsControllerTest extends AbstractTestCase
|
||||
$GLOBALS['containerBuilder']->setParameter('db', 'test_db');
|
||||
$GLOBALS['containerBuilder']->setParameter('table', 'test_table');
|
||||
|
||||
$this->dummyDbi->addResult(
|
||||
'SELECT `SCHEMA_NAME` FROM `INFORMATION_SCHEMA`.`SCHEMATA`',
|
||||
[['test_db']],
|
||||
['SCHEMA_NAME']
|
||||
);
|
||||
$this->dummyDbi->addSelectDb('test_db');
|
||||
$this->dummyDbi->addSelectDb('test_db');
|
||||
// phpcs:disable Generic.Files.LineLength.TooLong
|
||||
|
||||
@ -13,7 +13,6 @@ use PhpMyAdmin\Template;
|
||||
use PhpMyAdmin\Tests\AbstractTestCase;
|
||||
use PhpMyAdmin\Tests\Stubs\DummyResult;
|
||||
use PhpMyAdmin\Tests\Stubs\ResponseRenderer as ResponseStub;
|
||||
use stdClass;
|
||||
|
||||
/**
|
||||
* @covers \PhpMyAdmin\Controllers\Table\RelationController
|
||||
@ -45,18 +44,6 @@ class RelationControllerTest extends AbstractTestCase
|
||||
$_POST['foreignDb'] = 'db';
|
||||
$_POST['foreignTable'] = 'table';
|
||||
|
||||
$GLOBALS['dblist'] = new stdClass();
|
||||
$GLOBALS['dblist']->databases = new class
|
||||
{
|
||||
/**
|
||||
* @param mixed $name name
|
||||
*/
|
||||
public function exists($name): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
$dbi = $this->getMockBuilder(DatabaseInterface::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
@ -6,15 +6,14 @@ namespace PhpMyAdmin\Tests;
|
||||
|
||||
use mysqli_stmt;
|
||||
use PhpMyAdmin\ConfigStorage\Relation;
|
||||
use PhpMyAdmin\Database\DatabaseList;
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\Dbal\DbiExtension;
|
||||
use PhpMyAdmin\Dbal\ResultInterface;
|
||||
use PhpMyAdmin\LanguageManager;
|
||||
use PhpMyAdmin\Query\Utilities;
|
||||
use PhpMyAdmin\SqlParser\Context;
|
||||
use PhpMyAdmin\SystemDatabase;
|
||||
use PhpMyAdmin\Utils\SessionCache;
|
||||
use stdClass;
|
||||
|
||||
/**
|
||||
* @covers \PhpMyAdmin\DatabaseInterface
|
||||
@ -168,22 +167,22 @@ class DatabaseInterfaceTest extends AbstractTestCase
|
||||
$this->assertInstanceOf(SystemDatabase::class, $sd);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests for DBI::postConnectControl() method.
|
||||
*/
|
||||
public function testPostConnectControl(): void
|
||||
public function testPostConnectControlWithZeroConf(): void
|
||||
{
|
||||
$dummyDbi = $this->createDbiDummy();
|
||||
$dbi = $this->createDatabaseInterface($dummyDbi);
|
||||
$GLOBALS['cfg']['ZeroConf'] = true;
|
||||
$dbi = $this->createDatabaseInterface();
|
||||
$relationMock = $this->createMock(Relation::class);
|
||||
$relationMock->expects($this->once())->method('initRelationParamsCache');
|
||||
$dbi->postConnectControl($relationMock);
|
||||
}
|
||||
|
||||
$dummyDbi->addResult(
|
||||
'SHOW TABLES FROM `phpmyadmin`;',
|
||||
[]
|
||||
);
|
||||
$GLOBALS['db'] = '';
|
||||
$GLOBALS['cfg']['Server']['only_db'] = [];
|
||||
$dbi->postConnectControl(new Relation($dbi));
|
||||
$this->assertInstanceOf(DatabaseList::class, $GLOBALS['dblist']);
|
||||
public function testPostConnectControlWithoutZeroConf(): void
|
||||
{
|
||||
$GLOBALS['cfg']['ZeroConf'] = false;
|
||||
$dbi = $this->createDatabaseInterface();
|
||||
$relationMock = $this->createMock(Relation::class);
|
||||
$relationMock->expects($this->never())->method('initRelationParamsCache');
|
||||
$dbi->postConnectControl($relationMock);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -194,6 +193,7 @@ class DatabaseInterfaceTest extends AbstractTestCase
|
||||
{
|
||||
$GLOBALS['lang'] = 'en';
|
||||
$GLOBALS['cfg']['Server']['SessionTimeZone'] = '';
|
||||
LanguageManager::getInstance()->availableLanguages();
|
||||
|
||||
$mock = $this->getMockBuilder(DatabaseInterface::class)
|
||||
->disableOriginalConstructor()
|
||||
@ -221,6 +221,7 @@ class DatabaseInterfaceTest extends AbstractTestCase
|
||||
'@@version' => '10.20.7-MariaDB-1:10.9.3+maria~ubu2204',
|
||||
'@@version_comment' => 'mariadb.org binary distribution',
|
||||
];
|
||||
LanguageManager::getInstance()->availableLanguages();
|
||||
|
||||
$mock = $this->getMockBuilder(DatabaseInterface::class)
|
||||
->disableOriginalConstructor()
|
||||
@ -256,6 +257,7 @@ class DatabaseInterfaceTest extends AbstractTestCase
|
||||
): void {
|
||||
$GLOBALS['lang'] = 'en';
|
||||
$GLOBALS['cfg']['Server']['SessionTimeZone'] = '';
|
||||
LanguageManager::getInstance()->availableLanguages();
|
||||
|
||||
$mock = $this->getMockBuilder(DatabaseInterface::class)
|
||||
->disableOriginalConstructor()
|
||||
@ -625,18 +627,17 @@ class DatabaseInterfaceTest extends AbstractTestCase
|
||||
{
|
||||
$dummyDbi = $this->createDbiDummy();
|
||||
$dbi = $this->createDatabaseInterface($dummyDbi);
|
||||
$GLOBALS['dbi'] = $dbi;
|
||||
|
||||
$GLOBALS['db'] = '';
|
||||
$GLOBALS['table'] = '';
|
||||
$GLOBALS['server'] = 1;
|
||||
$GLOBALS['cfg']['Server']['DisableIS'] = true;
|
||||
$GLOBALS['cfg']['Server']['only_db'] = '';
|
||||
$GLOBALS['cfg']['NaturalOrder'] = true;
|
||||
$GLOBALS['dblist'] = new stdClass();
|
||||
$GLOBALS['dblist']->databases = [
|
||||
'db1',
|
||||
'db2',
|
||||
];
|
||||
$dummyDbi->removeDefaultResults();
|
||||
$dummyDbi->addResult('SELECT CURRENT_USER();', []);
|
||||
$dummyDbi->addResult('SHOW DATABASES', [['db1'], ['db2']], ['Database']);
|
||||
$dummyDbi->addResult(
|
||||
'SELECT @@collation_database',
|
||||
[
|
||||
|
||||
@ -10,7 +10,6 @@ use PhpMyAdmin\Export;
|
||||
use PhpMyAdmin\Plugins\Export\ExportPhparray;
|
||||
use PhpMyAdmin\Plugins\Export\ExportSql;
|
||||
use PhpMyAdmin\Transformations;
|
||||
use stdClass;
|
||||
|
||||
use function htmlspecialchars;
|
||||
|
||||
@ -189,18 +188,22 @@ SQL;
|
||||
public function testExportServer(): void
|
||||
{
|
||||
$GLOBALS['plugin_param'] = ['export_type' => 'server', 'single_table' => false];
|
||||
$GLOBALS['dblist'] = new stdClass();
|
||||
$GLOBALS['dblist']->databases = ['test_db'];
|
||||
$GLOBALS['output_kanji_conversion'] = false;
|
||||
$GLOBALS['buffer_needed'] = false;
|
||||
$GLOBALS['asfile'] = false;
|
||||
$GLOBALS['cfg']['Server']['DisableIS'] = false;
|
||||
$GLOBALS['cfg']['Server']['only_db'] = '';
|
||||
$GLOBALS['sql_structure_or_data'] = 'structure_and_data';
|
||||
$GLOBALS['sql_insert_syntax'] = 'both';
|
||||
$GLOBALS['sql_max_query_size'] = '50000';
|
||||
|
||||
// phpcs:disable Generic.Files.LineLength.TooLong
|
||||
$dbiDummy = $this->createDbiDummy();
|
||||
$dbiDummy->addResult(
|
||||
'SELECT `SCHEMA_NAME` FROM `INFORMATION_SCHEMA`.`SCHEMATA`',
|
||||
[['test_db']],
|
||||
['SCHEMA_NAME']
|
||||
);
|
||||
$dbiDummy->addResult(
|
||||
'SHOW TABLES FROM `test_db`;',
|
||||
[['test_table']],
|
||||
|
||||
@ -21,7 +21,6 @@ use PhpMyAdmin\Tests\Stubs\DummyResult;
|
||||
use PhpMyAdmin\Url;
|
||||
use PhpMyAdmin\Util;
|
||||
use ReflectionMethod;
|
||||
use stdClass;
|
||||
|
||||
use function __;
|
||||
use function _pgettext;
|
||||
@ -1684,7 +1683,9 @@ class PrivilegesTest extends AbstractTestCase
|
||||
);
|
||||
// phpcs:enable
|
||||
|
||||
$serverPrivileges = $this->getPrivileges($this->createDatabaseInterface($dummyDbi));
|
||||
$dbi = $this->createDatabaseInterface($dummyDbi);
|
||||
$GLOBALS['dbi'] = $dbi;
|
||||
$serverPrivileges = $this->getPrivileges($dbi);
|
||||
|
||||
// Test case 1
|
||||
$actual = $serverPrivileges->getHtmlForAllTableSpecificRights('pma', 'host', 'table', 'pmadb');
|
||||
@ -1697,12 +1698,13 @@ class PrivilegesTest extends AbstractTestCase
|
||||
$this->assertStringContainsString('Table-specific privileges', $actual);
|
||||
|
||||
// Test case 2
|
||||
$GLOBALS['dblist'] = new stdClass();
|
||||
$GLOBALS['dblist']->databases = [
|
||||
'x',
|
||||
'y',
|
||||
'z',
|
||||
];
|
||||
$GLOBALS['cfg']['Server']['DisableIS'] = false;
|
||||
$GLOBALS['cfg']['Server']['only_db'] = '';
|
||||
$dummyDbi->addResult(
|
||||
'SELECT `SCHEMA_NAME` FROM `INFORMATION_SCHEMA`.`SCHEMATA`',
|
||||
[['x'], ['y'], ['z']],
|
||||
['SCHEMA_NAME']
|
||||
);
|
||||
$actual = $serverPrivileges->getHtmlForAllTableSpecificRights('pma2', 'host2', 'database', '');
|
||||
$this->assertStringContainsString(
|
||||
'<div class="card-header js-submenu-label" data-submenu-label="Database">',
|
||||
|
||||
@ -7,11 +7,11 @@ namespace PhpMyAdmin\Tests;
|
||||
use PhpMyAdmin\ConfigStorage\RelationParameters;
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\Index;
|
||||
use PhpMyAdmin\ListDatabase;
|
||||
use PhpMyAdmin\Query\Cache;
|
||||
use PhpMyAdmin\Table;
|
||||
use PhpMyAdmin\Tests\Stubs\DbiDummy;
|
||||
use PhpMyAdmin\Tests\Stubs\DummyResult;
|
||||
use stdClass;
|
||||
|
||||
/**
|
||||
* @covers \PhpMyAdmin\Table
|
||||
@ -37,17 +37,6 @@ class TableTest extends AbstractTestCase
|
||||
$GLOBALS['sql_if_not_exists'] = true;
|
||||
$GLOBALS['sql_drop_table'] = true;
|
||||
$GLOBALS['cfg']['Server']['table_uiprefs'] = 'pma__table_uiprefs';
|
||||
$GLOBALS['dblist'] = new stdClass();
|
||||
$GLOBALS['dblist']->databases = new class
|
||||
{
|
||||
/**
|
||||
* @param mixed $name name
|
||||
*/
|
||||
public function exists($name): bool
|
||||
{
|
||||
return $name === $name;// unused $name hack
|
||||
}
|
||||
};
|
||||
|
||||
$sql_isView_true = 'SELECT TABLE_NAME'
|
||||
. ' FROM information_schema.VIEWS'
|
||||
@ -269,6 +258,10 @@ class TableTest extends AbstractTestCase
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$databaseList = $this->createStub(ListDatabase::class);
|
||||
$databaseList->method('exists')->willReturn(true);
|
||||
$dbi->expects($this->any())->method('getDatabaseList')->willReturn($databaseList);
|
||||
|
||||
$dbi->expects($this->any())->method('fetchResult')
|
||||
->will($this->returnValueMap($fetchResult));
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user