Extract string constants from RelationParameters class
These strings are very similar to some Config\Settings\Server properties, so is better to avoid confusion. Signed-off-by: Maurício Meneghini Fauth <mauricio@mfauth.net>
This commit is contained in:
parent
b42e2cd735
commit
44bcf98a43
@ -10110,12 +10110,6 @@ parameters:
|
||||
count: 15
|
||||
path: src/Plugins/Export/ExportSql.php
|
||||
|
||||
-
|
||||
message: '#^Call to function in_array\(\) requires parameter \#3 to be set\.$#'
|
||||
identifier: function.strict
|
||||
count: 1
|
||||
path: src/Plugins/Export/ExportSql.php
|
||||
|
||||
-
|
||||
message: '#^Cannot access offset ''alias'' on mixed\.$#'
|
||||
identifier: offsetAccess.nonOffsetAccessible
|
||||
@ -16122,12 +16116,6 @@ parameters:
|
||||
count: 15
|
||||
path: tests/unit/ConfigStorage/RelationTest.php
|
||||
|
||||
-
|
||||
message: '#^Call to static method PHPUnit\\Framework\\Assert\:\:assertArrayHasKey\(\) with arguments ''relation'', array\{version\: string, user\: string\|null, db\: string\|null, bookmark\: string\|null, central_columns\: string\|null, column_info\: string\|null, designer_settings\: string\|null, export_templates\: string\|null, \.\.\.\} and ''The cache is…'' will always evaluate to true\.$#'
|
||||
identifier: staticMethod.alreadyNarrowedType
|
||||
count: 3
|
||||
path: tests/unit/ConfigStorage/RelationTest.php
|
||||
|
||||
-
|
||||
message: '#^Call to static method PHPUnit\\Framework\\Assert\:\:assertSame\(\) with '''' and '''' will always evaluate to true\.$#'
|
||||
identifier: staticMethod.alreadyNarrowedType
|
||||
|
||||
@ -81,51 +81,51 @@ class Relation
|
||||
*/
|
||||
private function checkTableAccess(array $relationParams): array
|
||||
{
|
||||
if (isset($relationParams['relation'], $relationParams['table_info'])) {
|
||||
if ($this->canAccessStorageTable((string) $relationParams['table_info'])) {
|
||||
$relationParams['displaywork'] = true;
|
||||
if (isset($relationParams[RelationParameters::RELATION], $relationParams[RelationParameters::TABLE_INFO])) {
|
||||
if ($this->canAccessStorageTable((string) $relationParams[RelationParameters::TABLE_INFO])) {
|
||||
$relationParams[RelationParameters::DISPLAY_WORK] = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($relationParams['table_coords'], $relationParams['pdf_pages'])) {
|
||||
if ($this->canAccessStorageTable((string) $relationParams['table_coords'])) {
|
||||
if ($this->canAccessStorageTable((string) $relationParams['pdf_pages'])) {
|
||||
$relationParams['pdfwork'] = true;
|
||||
if (isset($relationParams[RelationParameters::TABLE_COORDS], $relationParams[RelationParameters::PDF_PAGES])) {
|
||||
if ($this->canAccessStorageTable((string) $relationParams[RelationParameters::TABLE_COORDS])) {
|
||||
if ($this->canAccessStorageTable((string) $relationParams[RelationParameters::PDF_PAGES])) {
|
||||
$relationParams[RelationParameters::PDF_WORK] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($relationParams['column_info'])) {
|
||||
if ($this->canAccessStorageTable((string) $relationParams['column_info'])) {
|
||||
$relationParams['commwork'] = true;
|
||||
if (isset($relationParams[RelationParameters::COLUMN_INFO])) {
|
||||
if ($this->canAccessStorageTable((string) $relationParams[RelationParameters::COLUMN_INFO])) {
|
||||
$relationParams[RelationParameters::COMM_WORK] = true;
|
||||
// phpMyAdmin 4.3+
|
||||
// Check for input transformations upgrade.
|
||||
$relationParams['mimework'] = $this->tryUpgradeTransformations();
|
||||
$relationParams[RelationParameters::MIME_WORK] = $this->tryUpgradeTransformations();
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($relationParams['users'], $relationParams['usergroups'])) {
|
||||
if ($this->canAccessStorageTable((string) $relationParams['users'])) {
|
||||
if ($this->canAccessStorageTable((string) $relationParams['usergroups'])) {
|
||||
$relationParams['menuswork'] = true;
|
||||
if (isset($relationParams[RelationParameters::USERS], $relationParams[RelationParameters::USER_GROUPS])) {
|
||||
if ($this->canAccessStorageTable((string) $relationParams[RelationParameters::USERS])) {
|
||||
if ($this->canAccessStorageTable((string) $relationParams[RelationParameters::USER_GROUPS])) {
|
||||
$relationParams[RelationParameters::MENUS_WORK] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$settings = [
|
||||
'export_templates' => 'exporttemplateswork',
|
||||
'designer_settings' => 'designersettingswork',
|
||||
'central_columns' => 'centralcolumnswork',
|
||||
'savedsearches' => 'savedsearcheswork',
|
||||
'navigationhiding' => 'navwork',
|
||||
'bookmark' => 'bookmarkwork',
|
||||
'userconfig' => 'userconfigwork',
|
||||
'tracking' => 'trackingwork',
|
||||
'table_uiprefs' => 'uiprefswork',
|
||||
'favorite' => 'favoritework',
|
||||
'recent' => 'recentwork',
|
||||
'history' => 'historywork',
|
||||
'relation' => 'relwork',
|
||||
RelationParameters::EXPORT_TEMPLATES => RelationParameters::EXPORT_TEMPLATES_WORK,
|
||||
RelationParameters::DESIGNER_SETTINGS => RelationParameters::DESIGNER_SETTINGS_WORK,
|
||||
RelationParameters::CENTRAL_COLUMNS => RelationParameters::CENTRAL_COLUMNS_WORK,
|
||||
RelationParameters::SAVED_SEARCHES => RelationParameters::SAVED_SEARCHES_WORK,
|
||||
RelationParameters::NAVIGATION_HIDING => RelationParameters::NAV_WORK,
|
||||
RelationParameters::BOOKMARK => RelationParameters::BOOKMARK_WORK,
|
||||
RelationParameters::USER_CONFIG => RelationParameters::USER_CONFIG_WORK,
|
||||
RelationParameters::TRACKING => RelationParameters::TRACKING_WORK,
|
||||
RelationParameters::TABLE_UI_PREFS => RelationParameters::UI_PREFS_WORK,
|
||||
RelationParameters::FAVORITE => RelationParameters::FAVORITE_WORK,
|
||||
RelationParameters::RECENT => RelationParameters::RECENT_WORK,
|
||||
RelationParameters::HISTORY => RelationParameters::HISTORY_WORK,
|
||||
RelationParameters::RELATION => RelationParameters::REL_WORK,
|
||||
];
|
||||
|
||||
foreach ($settings as $setingName => $worksKey) {
|
||||
@ -161,43 +161,43 @@ class Relation
|
||||
|
||||
foreach ($tables as $table) {
|
||||
if ($table === $this->config->selectedServer['bookmarktable']) {
|
||||
$relationParams['bookmark'] = $table;
|
||||
$relationParams[RelationParameters::BOOKMARK] = $table;
|
||||
} elseif ($table === $this->config->selectedServer['relation']) {
|
||||
$relationParams['relation'] = $table;
|
||||
$relationParams[RelationParameters::RELATION] = $table;
|
||||
} elseif ($table === $this->config->selectedServer['table_info']) {
|
||||
$relationParams['table_info'] = $table;
|
||||
$relationParams[RelationParameters::TABLE_INFO] = $table;
|
||||
} elseif ($table === $this->config->selectedServer['table_coords']) {
|
||||
$relationParams['table_coords'] = $table;
|
||||
$relationParams[RelationParameters::TABLE_COORDS] = $table;
|
||||
} elseif ($table === $this->config->selectedServer['column_info']) {
|
||||
$relationParams['column_info'] = $table;
|
||||
$relationParams[RelationParameters::COLUMN_INFO] = $table;
|
||||
} elseif ($table === $this->config->selectedServer['pdf_pages']) {
|
||||
$relationParams['pdf_pages'] = $table;
|
||||
$relationParams[RelationParameters::PDF_PAGES] = $table;
|
||||
} elseif ($table === $this->config->selectedServer['history']) {
|
||||
$relationParams['history'] = $table;
|
||||
$relationParams[RelationParameters::HISTORY] = $table;
|
||||
} elseif ($table === $this->config->selectedServer['recent']) {
|
||||
$relationParams['recent'] = $table;
|
||||
$relationParams[RelationParameters::RECENT] = $table;
|
||||
} elseif ($table === $this->config->selectedServer['favorite']) {
|
||||
$relationParams['favorite'] = $table;
|
||||
$relationParams[RelationParameters::FAVORITE] = $table;
|
||||
} elseif ($table === $this->config->selectedServer['table_uiprefs']) {
|
||||
$relationParams['table_uiprefs'] = $table;
|
||||
$relationParams[RelationParameters::TABLE_UI_PREFS] = $table;
|
||||
} elseif ($table === $this->config->selectedServer['tracking']) {
|
||||
$relationParams['tracking'] = $table;
|
||||
$relationParams[RelationParameters::TRACKING] = $table;
|
||||
} elseif ($table === $this->config->selectedServer['userconfig']) {
|
||||
$relationParams['userconfig'] = $table;
|
||||
$relationParams[RelationParameters::USER_CONFIG] = $table;
|
||||
} elseif ($table === $this->config->selectedServer['users']) {
|
||||
$relationParams['users'] = $table;
|
||||
$relationParams[RelationParameters::USERS] = $table;
|
||||
} elseif ($table === $this->config->selectedServer['usergroups']) {
|
||||
$relationParams['usergroups'] = $table;
|
||||
$relationParams[RelationParameters::USER_GROUPS] = $table;
|
||||
} elseif ($table === $this->config->selectedServer['navigationhiding']) {
|
||||
$relationParams['navigationhiding'] = $table;
|
||||
$relationParams[RelationParameters::NAVIGATION_HIDING] = $table;
|
||||
} elseif ($table === $this->config->selectedServer['savedsearches']) {
|
||||
$relationParams['savedsearches'] = $table;
|
||||
$relationParams[RelationParameters::SAVED_SEARCHES] = $table;
|
||||
} elseif ($table === $this->config->selectedServer['central_columns']) {
|
||||
$relationParams['central_columns'] = $table;
|
||||
$relationParams[RelationParameters::CENTRAL_COLUMNS] = $table;
|
||||
} elseif ($table === $this->config->selectedServer['designer_settings']) {
|
||||
$relationParams['designer_settings'] = $table;
|
||||
$relationParams[RelationParameters::DESIGNER_SETTINGS] = $table;
|
||||
} elseif ($table === $this->config->selectedServer['export_templates']) {
|
||||
$relationParams['export_templates'] = $table;
|
||||
$relationParams[RelationParameters::EXPORT_TEMPLATES] = $table;
|
||||
}
|
||||
}
|
||||
|
||||
@ -214,32 +214,32 @@ class Relation
|
||||
private function checkRelationsParam(): array
|
||||
{
|
||||
$workToTable = [
|
||||
'relwork' => 'relation',
|
||||
'displaywork' => ['relation', 'table_info'],
|
||||
'bookmarkwork' => 'bookmarktable',
|
||||
'pdfwork' => ['table_coords', 'pdf_pages'],
|
||||
'commwork' => 'column_info',
|
||||
'mimework' => 'column_info',
|
||||
'historywork' => 'history',
|
||||
'recentwork' => 'recent',
|
||||
'favoritework' => 'favorite',
|
||||
'uiprefswork' => 'table_uiprefs',
|
||||
'trackingwork' => 'tracking',
|
||||
'userconfigwork' => 'userconfig',
|
||||
'menuswork' => ['users', 'usergroups'],
|
||||
'navwork' => 'navigationhiding',
|
||||
'savedsearcheswork' => 'savedsearches',
|
||||
'centralcolumnswork' => 'central_columns',
|
||||
'designersettingswork' => 'designer_settings',
|
||||
'exporttemplateswork' => 'export_templates',
|
||||
RelationParameters::REL_WORK => 'relation',
|
||||
RelationParameters::DISPLAY_WORK => ['relation', 'table_info'],
|
||||
RelationParameters::BOOKMARK_WORK => 'bookmarktable',
|
||||
RelationParameters::PDF_WORK => ['table_coords', 'pdf_pages'],
|
||||
RelationParameters::COMM_WORK => 'column_info',
|
||||
RelationParameters::MIME_WORK => 'column_info',
|
||||
RelationParameters::HISTORY_WORK => 'history',
|
||||
RelationParameters::RECENT_WORK => 'recent',
|
||||
RelationParameters::FAVORITE_WORK => 'favorite',
|
||||
RelationParameters::UI_PREFS_WORK => 'table_uiprefs',
|
||||
RelationParameters::TRACKING_WORK => 'tracking',
|
||||
RelationParameters::USER_CONFIG_WORK => 'userconfig',
|
||||
RelationParameters::MENUS_WORK => ['users', 'usergroups'],
|
||||
RelationParameters::NAV_WORK => 'navigationhiding',
|
||||
RelationParameters::SAVED_SEARCHES_WORK => 'savedsearches',
|
||||
RelationParameters::CENTRAL_COLUMNS_WORK => 'central_columns',
|
||||
RelationParameters::DESIGNER_SETTINGS_WORK => 'designer_settings',
|
||||
RelationParameters::EXPORT_TEMPLATES_WORK => 'export_templates',
|
||||
];
|
||||
|
||||
$relationParams = array_fill_keys(array_keys($workToTable), false);
|
||||
|
||||
$relationParams['version'] = Version::VERSION;
|
||||
$relationParams['allworks'] = false;
|
||||
$relationParams['user'] = null;
|
||||
$relationParams['db'] = null;
|
||||
$relationParams[RelationParameters::VERSION] = Version::VERSION;
|
||||
$relationParams[RelationParameters::ALL_WORKS] = false;
|
||||
$relationParams[RelationParameters::USER] = null;
|
||||
$relationParams[RelationParameters::DATABASE] = null;
|
||||
|
||||
if (
|
||||
Current::$server === 0
|
||||
@ -251,8 +251,8 @@ class Relation
|
||||
return $relationParams;
|
||||
}
|
||||
|
||||
$relationParams['user'] = $this->config->selectedServer['user'];
|
||||
$relationParams['db'] = $this->config->selectedServer['pmadb'];
|
||||
$relationParams[RelationParameters::USER] = $this->config->selectedServer['user'];
|
||||
$relationParams[RelationParameters::DATABASE] = $this->config->selectedServer['pmadb'];
|
||||
|
||||
$relationParamsFilled = $this->fillRelationParamsWithTableNames($relationParams);
|
||||
|
||||
@ -289,7 +289,7 @@ class Relation
|
||||
}
|
||||
}
|
||||
|
||||
$relationParams['allworks'] = $allWorks;
|
||||
$relationParams[RelationParameters::ALL_WORKS] = $allWorks;
|
||||
|
||||
return $relationParams;
|
||||
}
|
||||
|
||||
@ -32,6 +32,50 @@ use function is_string;
|
||||
/** @psalm-immutable */
|
||||
final readonly class RelationParameters
|
||||
{
|
||||
public const VERSION = 'version';
|
||||
public const USER = 'user';
|
||||
public const DATABASE = 'db';
|
||||
|
||||
public const BOOKMARK = 'bookmark';
|
||||
public const CENTRAL_COLUMNS = 'central_columns';
|
||||
public const COLUMN_INFO = 'column_info';
|
||||
public const DESIGNER_SETTINGS = 'designer_settings';
|
||||
public const EXPORT_TEMPLATES = 'export_templates';
|
||||
public const FAVORITE = 'favorite';
|
||||
public const HISTORY = 'history';
|
||||
public const NAVIGATION_HIDING = 'navigationhiding';
|
||||
public const PDF_PAGES = 'pdf_pages';
|
||||
public const RECENT = 'recent';
|
||||
public const RELATION = 'relation';
|
||||
public const SAVED_SEARCHES = 'savedsearches';
|
||||
public const TABLE_COORDS = 'table_coords';
|
||||
public const TABLE_INFO = 'table_info';
|
||||
public const TABLE_UI_PREFS = 'table_uiprefs';
|
||||
public const TRACKING = 'tracking';
|
||||
public const USERS = 'users';
|
||||
public const USER_CONFIG = 'userconfig';
|
||||
public const USER_GROUPS = 'usergroups';
|
||||
|
||||
public const ALL_WORKS = 'allworks';
|
||||
public const BOOKMARK_WORK = 'bookmarkwork';
|
||||
public const CENTRAL_COLUMNS_WORK = 'centralcolumnswork';
|
||||
public const COMM_WORK = 'commwork';
|
||||
public const DESIGNER_SETTINGS_WORK = 'designersettingswork';
|
||||
public const DISPLAY_WORK = 'displaywork';
|
||||
public const EXPORT_TEMPLATES_WORK = 'exporttemplateswork';
|
||||
public const FAVORITE_WORK = 'favoritework';
|
||||
public const HISTORY_WORK = 'historywork';
|
||||
public const MENUS_WORK = 'menuswork';
|
||||
public const MIME_WORK = 'mimework';
|
||||
public const NAV_WORK = 'navwork';
|
||||
public const PDF_WORK = 'pdfwork';
|
||||
public const RECENT_WORK = 'recentwork';
|
||||
public const REL_WORK = 'relwork';
|
||||
public const SAVED_SEARCHES_WORK = 'savedsearcheswork';
|
||||
public const TRACKING_WORK = 'trackingwork';
|
||||
public const UI_PREFS_WORK = 'uiprefswork';
|
||||
public const USER_CONFIG_WORK = 'userconfigwork';
|
||||
|
||||
/** @param non-empty-string|null $user */
|
||||
public function __construct(
|
||||
public string|null $user,
|
||||
@ -61,150 +105,171 @@ final readonly class RelationParameters
|
||||
public static function fromArray(array $params): self
|
||||
{
|
||||
$user = null;
|
||||
if (isset($params['user']) && is_string($params['user']) && $params['user'] !== '') {
|
||||
$user = $params['user'];
|
||||
if (isset($params[self::USER]) && is_string($params[self::USER]) && $params[self::USER] !== '') {
|
||||
$user = $params[self::USER];
|
||||
}
|
||||
|
||||
try {
|
||||
$db = DatabaseName::from($params['db'] ?? null);
|
||||
$db = DatabaseName::from($params[self::DATABASE] ?? null);
|
||||
} catch (InvalidDatabaseName) {
|
||||
return new self($user, null);
|
||||
}
|
||||
|
||||
$bookmarkFeature = null;
|
||||
if (isset($params['bookmarkwork'], $params['bookmark']) && $params['bookmarkwork']) {
|
||||
$bookmark = TableName::tryFrom($params['bookmark']);
|
||||
if (isset($params[self::BOOKMARK_WORK], $params[self::BOOKMARK]) && $params[self::BOOKMARK_WORK]) {
|
||||
$bookmark = TableName::tryFrom($params[self::BOOKMARK]);
|
||||
if ($bookmark !== null) {
|
||||
$bookmarkFeature = new BookmarkFeature($db, $bookmark);
|
||||
}
|
||||
}
|
||||
|
||||
$columnInfo = TableName::tryFrom($params['column_info'] ?? null);
|
||||
$columnInfo = TableName::tryFrom($params[self::COLUMN_INFO] ?? null);
|
||||
$browserTransformationFeature = null;
|
||||
if (isset($params['mimework']) && $params['mimework'] && $columnInfo !== null) {
|
||||
if (isset($params[self::MIME_WORK]) && $params[self::MIME_WORK] && $columnInfo !== null) {
|
||||
$browserTransformationFeature = new BrowserTransformationFeature($db, $columnInfo);
|
||||
}
|
||||
|
||||
$columnCommentsFeature = null;
|
||||
if (isset($params['commwork']) && $params['commwork'] && $columnInfo !== null) {
|
||||
if (isset($params[self::COMM_WORK]) && $params[self::COMM_WORK] && $columnInfo !== null) {
|
||||
$columnCommentsFeature = new ColumnCommentsFeature($db, $columnInfo);
|
||||
}
|
||||
|
||||
$centralColumnsFeature = null;
|
||||
if (isset($params['centralcolumnswork'], $params['central_columns']) && $params['centralcolumnswork']) {
|
||||
$centralColumns = TableName::tryFrom($params['central_columns']);
|
||||
if (
|
||||
isset($params[self::CENTRAL_COLUMNS_WORK], $params[self::CENTRAL_COLUMNS])
|
||||
&& $params[self::CENTRAL_COLUMNS_WORK]
|
||||
) {
|
||||
$centralColumns = TableName::tryFrom($params[self::CENTRAL_COLUMNS]);
|
||||
if ($centralColumns !== null) {
|
||||
$centralColumnsFeature = new CentralColumnsFeature($db, $centralColumns);
|
||||
}
|
||||
}
|
||||
|
||||
$configurableMenusFeature = null;
|
||||
if (isset($params['menuswork'], $params['usergroups'], $params['users']) && $params['menuswork']) {
|
||||
$userGroups = TableName::tryFrom($params['usergroups']);
|
||||
$users = TableName::tryFrom($params['users']);
|
||||
if (
|
||||
isset($params[self::MENUS_WORK], $params[self::USER_GROUPS], $params[self::USERS])
|
||||
&& $params[self::MENUS_WORK]
|
||||
) {
|
||||
$userGroups = TableName::tryFrom($params[self::USER_GROUPS]);
|
||||
$users = TableName::tryFrom($params[self::USERS]);
|
||||
if ($userGroups !== null && $users !== null) {
|
||||
$configurableMenusFeature = new ConfigurableMenusFeature($db, $userGroups, $users);
|
||||
}
|
||||
}
|
||||
|
||||
$databaseDesignerSettingsFeature = null;
|
||||
if (isset($params['designersettingswork'], $params['designer_settings']) && $params['designersettingswork']) {
|
||||
$designerSettings = TableName::tryFrom($params['designer_settings']);
|
||||
if (
|
||||
isset($params[self::DESIGNER_SETTINGS_WORK], $params[self::DESIGNER_SETTINGS])
|
||||
&& $params[self::DESIGNER_SETTINGS_WORK]
|
||||
) {
|
||||
$designerSettings = TableName::tryFrom($params[self::DESIGNER_SETTINGS]);
|
||||
if ($designerSettings !== null) {
|
||||
$databaseDesignerSettingsFeature = new DatabaseDesignerSettingsFeature($db, $designerSettings);
|
||||
}
|
||||
}
|
||||
|
||||
$relation = TableName::tryFrom($params['relation'] ?? null);
|
||||
$relation = TableName::tryFrom($params[self::RELATION] ?? null);
|
||||
$displayFeature = null;
|
||||
if (isset($params['displaywork'], $params['table_info']) && $params['displaywork'] && $relation !== null) {
|
||||
$tableInfo = TableName::tryFrom($params['table_info']);
|
||||
if (
|
||||
isset($params[self::DISPLAY_WORK], $params[self::TABLE_INFO])
|
||||
&& $params[self::DISPLAY_WORK] && $relation !== null
|
||||
) {
|
||||
$tableInfo = TableName::tryFrom($params[self::TABLE_INFO]);
|
||||
if ($tableInfo !== null) {
|
||||
$displayFeature = new DisplayFeature($db, $relation, $tableInfo);
|
||||
}
|
||||
}
|
||||
|
||||
$exportTemplatesFeature = null;
|
||||
if (isset($params['exporttemplateswork'], $params['export_templates']) && $params['exporttemplateswork']) {
|
||||
$exportTemplates = TableName::tryFrom($params['export_templates']);
|
||||
if (
|
||||
isset($params[self::EXPORT_TEMPLATES_WORK], $params[self::EXPORT_TEMPLATES])
|
||||
&& $params[self::EXPORT_TEMPLATES_WORK]
|
||||
) {
|
||||
$exportTemplates = TableName::tryFrom($params[self::EXPORT_TEMPLATES]);
|
||||
if ($exportTemplates !== null) {
|
||||
$exportTemplatesFeature = new ExportTemplatesFeature($db, $exportTemplates);
|
||||
}
|
||||
}
|
||||
|
||||
$favoriteTablesFeature = null;
|
||||
if (isset($params['favoritework'], $params['favorite']) && $params['favoritework']) {
|
||||
$favorite = TableName::tryFrom($params['favorite']);
|
||||
if (isset($params[self::FAVORITE_WORK], $params[self::FAVORITE]) && $params[self::FAVORITE_WORK]) {
|
||||
$favorite = TableName::tryFrom($params[self::FAVORITE]);
|
||||
if ($favorite !== null) {
|
||||
$favoriteTablesFeature = new FavoriteTablesFeature($db, $favorite);
|
||||
}
|
||||
}
|
||||
|
||||
$navigationItemsHidingFeature = null;
|
||||
if (isset($params['navwork'], $params['navigationhiding']) && $params['navwork']) {
|
||||
$navigationHiding = TableName::tryFrom($params['navigationhiding']);
|
||||
if (isset($params[self::NAV_WORK], $params[self::NAVIGATION_HIDING]) && $params[self::NAV_WORK]) {
|
||||
$navigationHiding = TableName::tryFrom($params[self::NAVIGATION_HIDING]);
|
||||
if ($navigationHiding !== null) {
|
||||
$navigationItemsHidingFeature = new NavigationItemsHidingFeature($db, $navigationHiding);
|
||||
}
|
||||
}
|
||||
|
||||
$pdfFeature = null;
|
||||
if (isset($params['pdfwork'], $params['pdf_pages'], $params['table_coords']) && $params['pdfwork']) {
|
||||
$pdfPages = TableName::tryFrom($params['pdf_pages']);
|
||||
$tableCoords = TableName::tryFrom($params['table_coords']);
|
||||
if (
|
||||
isset($params[self::PDF_WORK], $params[self::PDF_PAGES], $params[self::TABLE_COORDS])
|
||||
&& $params[self::PDF_WORK]
|
||||
) {
|
||||
$pdfPages = TableName::tryFrom($params[self::PDF_PAGES]);
|
||||
$tableCoords = TableName::tryFrom($params[self::TABLE_COORDS]);
|
||||
if ($pdfPages !== null && $tableCoords !== null) {
|
||||
$pdfFeature = new PdfFeature($db, $pdfPages, $tableCoords);
|
||||
}
|
||||
}
|
||||
|
||||
$recentlyUsedTablesFeature = null;
|
||||
if (isset($params['recentwork'], $params['recent']) && $params['recentwork']) {
|
||||
$recent = TableName::tryFrom($params['recent']);
|
||||
if (isset($params[self::RECENT_WORK], $params[self::RECENT]) && $params[self::RECENT_WORK]) {
|
||||
$recent = TableName::tryFrom($params[self::RECENT]);
|
||||
if ($recent !== null) {
|
||||
$recentlyUsedTablesFeature = new RecentlyUsedTablesFeature($db, $recent);
|
||||
}
|
||||
}
|
||||
|
||||
$relationFeature = null;
|
||||
if (isset($params['relwork']) && $params['relwork'] && $relation !== null) {
|
||||
if (isset($params[self::REL_WORK]) && $params[self::REL_WORK] && $relation !== null) {
|
||||
$relationFeature = new RelationFeature($db, $relation);
|
||||
}
|
||||
|
||||
$savedQueryByExampleSearchesFeature = null;
|
||||
if (isset($params['savedsearcheswork'], $params['savedsearches']) && $params['savedsearcheswork']) {
|
||||
$savedSearches = TableName::tryFrom($params['savedsearches']);
|
||||
if (
|
||||
isset($params[self::SAVED_SEARCHES_WORK], $params[self::SAVED_SEARCHES])
|
||||
&& $params[self::SAVED_SEARCHES_WORK]
|
||||
) {
|
||||
$savedSearches = TableName::tryFrom($params[self::SAVED_SEARCHES]);
|
||||
if ($savedSearches !== null) {
|
||||
$savedQueryByExampleSearchesFeature = new SavedQueryByExampleSearchesFeature($db, $savedSearches);
|
||||
}
|
||||
}
|
||||
|
||||
$sqlHistoryFeature = null;
|
||||
if (isset($params['historywork'], $params['history']) && $params['historywork']) {
|
||||
$history = TableName::tryFrom($params['history']);
|
||||
if (isset($params[self::HISTORY_WORK], $params[self::HISTORY]) && $params[self::HISTORY_WORK]) {
|
||||
$history = TableName::tryFrom($params[self::HISTORY]);
|
||||
if ($history !== null) {
|
||||
$sqlHistoryFeature = new SqlHistoryFeature($db, $history);
|
||||
}
|
||||
}
|
||||
|
||||
$trackingFeature = null;
|
||||
if (isset($params['trackingwork'], $params['tracking']) && $params['trackingwork']) {
|
||||
$tracking = TableName::tryFrom($params['tracking']);
|
||||
if (isset($params[self::TRACKING_WORK], $params[self::TRACKING]) && $params[self::TRACKING_WORK]) {
|
||||
$tracking = TableName::tryFrom($params[self::TRACKING]);
|
||||
if ($tracking !== null) {
|
||||
$trackingFeature = new TrackingFeature($db, $tracking);
|
||||
}
|
||||
}
|
||||
|
||||
$uiPreferencesFeature = null;
|
||||
if (isset($params['uiprefswork'], $params['table_uiprefs']) && $params['uiprefswork']) {
|
||||
$tableUiPrefs = TableName::tryFrom($params['table_uiprefs']);
|
||||
if (isset($params[self::UI_PREFS_WORK], $params[self::TABLE_UI_PREFS]) && $params[self::UI_PREFS_WORK]) {
|
||||
$tableUiPrefs = TableName::tryFrom($params[self::TABLE_UI_PREFS]);
|
||||
if ($tableUiPrefs !== null) {
|
||||
$uiPreferencesFeature = new UiPreferencesFeature($db, $tableUiPrefs);
|
||||
}
|
||||
}
|
||||
|
||||
$userPreferencesFeature = null;
|
||||
if (isset($params['userconfigwork'], $params['userconfig']) && $params['userconfigwork']) {
|
||||
$userConfig = TableName::tryFrom($params['userconfig']);
|
||||
if (isset($params[self::USER_CONFIG_WORK], $params[self::USER_CONFIG]) && $params[self::USER_CONFIG_WORK]) {
|
||||
$userConfig = TableName::tryFrom($params[self::USER_CONFIG]);
|
||||
if ($userConfig !== null) {
|
||||
$userPreferencesFeature = new UserPreferencesFeature($db, $userConfig);
|
||||
}
|
||||
@ -235,30 +300,29 @@ final readonly class RelationParameters
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, bool|string|null>
|
||||
* @psalm-return array{
|
||||
* @return array{
|
||||
* version: string,
|
||||
* user: (string|null),
|
||||
* db: (string|null),
|
||||
* bookmark: (string|null),
|
||||
* central_columns: (string|null),
|
||||
* column_info: (string|null),
|
||||
* designer_settings: (string|null),
|
||||
* export_templates: (string|null),
|
||||
* favorite: (string|null),
|
||||
* history: (string|null),
|
||||
* navigationhiding: (string|null),
|
||||
* pdf_pages: (string|null),
|
||||
* recent: (string|null),
|
||||
* relation: (string|null),
|
||||
* savedsearches: (string|null),
|
||||
* table_coords: (string|null),
|
||||
* table_info: (string|null),
|
||||
* table_uiprefs: (string|null),
|
||||
* tracking: (string|null),
|
||||
* userconfig: (string|null),
|
||||
* usergroups: (string|null),
|
||||
* users: (string|null),
|
||||
* user: (non-empty-string|null),
|
||||
* db: (non-empty-string|null),
|
||||
* bookmark: (non-empty-string|null),
|
||||
* central_columns: (non-empty-string|null),
|
||||
* column_info: (non-empty-string|null),
|
||||
* designer_settings: (non-empty-string|null),
|
||||
* export_templates: (non-empty-string|null),
|
||||
* favorite: (non-empty-string|null),
|
||||
* history: (non-empty-string|null),
|
||||
* navigationhiding: (non-empty-string|null),
|
||||
* pdf_pages: (non-empty-string|null),
|
||||
* recent: (non-empty-string|null),
|
||||
* relation: (non-empty-string|null),
|
||||
* savedsearches: (non-empty-string|null),
|
||||
* table_coords: (non-empty-string|null),
|
||||
* table_info: (non-empty-string|null),
|
||||
* table_uiprefs: (non-empty-string|null),
|
||||
* tracking: (non-empty-string|null),
|
||||
* userconfig: (non-empty-string|null),
|
||||
* usergroups: (non-empty-string|null),
|
||||
* users: (non-empty-string|null),
|
||||
* bookmarkwork: bool,
|
||||
* mimework: bool,
|
||||
* centralcolumnswork: bool,
|
||||
@ -297,47 +361,47 @@ final readonly class RelationParameters
|
||||
}
|
||||
|
||||
return [
|
||||
'version' => Version::VERSION,
|
||||
'user' => $this->user,
|
||||
'db' => $this->db?->getName(),
|
||||
'bookmark' => $this->bookmarkFeature?->bookmark->getName(),
|
||||
'central_columns' => $this->centralColumnsFeature?->centralColumns->getName(),
|
||||
'column_info' => $columnInfo,
|
||||
'designer_settings' => $this->databaseDesignerSettingsFeature?->designerSettings->getName(),
|
||||
'export_templates' => $this->exportTemplatesFeature?->exportTemplates->getName(),
|
||||
'favorite' => $this->favoriteTablesFeature?->favorite->getName(),
|
||||
'history' => $this->sqlHistoryFeature?->history->getName(),
|
||||
'navigationhiding' => $this->navigationItemsHidingFeature?->navigationHiding->getName(),
|
||||
'pdf_pages' => $this->pdfFeature?->pdfPages->getName(),
|
||||
'recent' => $this->recentlyUsedTablesFeature?->recent->getName(),
|
||||
'relation' => $relation,
|
||||
'savedsearches' => $this->savedQueryByExampleSearchesFeature?->savedSearches->getName(),
|
||||
'table_coords' => $this->pdfFeature?->tableCoords->getName(),
|
||||
'table_info' => $this->displayFeature?->tableInfo->getName(),
|
||||
'table_uiprefs' => $this->uiPreferencesFeature?->tableUiPrefs->getName(),
|
||||
'tracking' => $this->trackingFeature?->tracking->getName(),
|
||||
'userconfig' => $this->userPreferencesFeature?->userConfig->getName(),
|
||||
'usergroups' => $this->configurableMenusFeature?->userGroups->getName(),
|
||||
'users' => $this->configurableMenusFeature?->users->getName(),
|
||||
'bookmarkwork' => $this->bookmarkFeature !== null,
|
||||
'mimework' => $this->browserTransformationFeature !== null,
|
||||
'centralcolumnswork' => $this->centralColumnsFeature !== null,
|
||||
'commwork' => $this->columnCommentsFeature !== null,
|
||||
'menuswork' => $this->configurableMenusFeature !== null,
|
||||
'designersettingswork' => $this->databaseDesignerSettingsFeature !== null,
|
||||
'displaywork' => $this->displayFeature !== null,
|
||||
'exporttemplateswork' => $this->exportTemplatesFeature !== null,
|
||||
'favoritework' => $this->favoriteTablesFeature !== null,
|
||||
'navwork' => $this->navigationItemsHidingFeature !== null,
|
||||
'pdfwork' => $this->pdfFeature !== null,
|
||||
'recentwork' => $this->recentlyUsedTablesFeature !== null,
|
||||
'relwork' => $this->relationFeature !== null,
|
||||
'savedsearcheswork' => $this->savedQueryByExampleSearchesFeature !== null,
|
||||
'historywork' => $this->sqlHistoryFeature !== null,
|
||||
'trackingwork' => $this->trackingFeature !== null,
|
||||
'uiprefswork' => $this->uiPreferencesFeature !== null,
|
||||
'userconfigwork' => $this->userPreferencesFeature !== null,
|
||||
'allworks' => $this->hasAllFeatures(),
|
||||
self::VERSION => Version::VERSION,
|
||||
self::USER => $this->user,
|
||||
self::DATABASE => $this->db?->getName(),
|
||||
self::BOOKMARK => $this->bookmarkFeature?->bookmark->getName(),
|
||||
self::CENTRAL_COLUMNS => $this->centralColumnsFeature?->centralColumns->getName(),
|
||||
self::COLUMN_INFO => $columnInfo,
|
||||
self::DESIGNER_SETTINGS => $this->databaseDesignerSettingsFeature?->designerSettings->getName(),
|
||||
self::EXPORT_TEMPLATES => $this->exportTemplatesFeature?->exportTemplates->getName(),
|
||||
self::FAVORITE => $this->favoriteTablesFeature?->favorite->getName(),
|
||||
self::HISTORY => $this->sqlHistoryFeature?->history->getName(),
|
||||
self::NAVIGATION_HIDING => $this->navigationItemsHidingFeature?->navigationHiding->getName(),
|
||||
self::PDF_PAGES => $this->pdfFeature?->pdfPages->getName(),
|
||||
self::RECENT => $this->recentlyUsedTablesFeature?->recent->getName(),
|
||||
self::RELATION => $relation,
|
||||
self::SAVED_SEARCHES => $this->savedQueryByExampleSearchesFeature?->savedSearches->getName(),
|
||||
self::TABLE_COORDS => $this->pdfFeature?->tableCoords->getName(),
|
||||
self::TABLE_INFO => $this->displayFeature?->tableInfo->getName(),
|
||||
self::TABLE_UI_PREFS => $this->uiPreferencesFeature?->tableUiPrefs->getName(),
|
||||
self::TRACKING => $this->trackingFeature?->tracking->getName(),
|
||||
self::USER_CONFIG => $this->userPreferencesFeature?->userConfig->getName(),
|
||||
self::USER_GROUPS => $this->configurableMenusFeature?->userGroups->getName(),
|
||||
self::USERS => $this->configurableMenusFeature?->users->getName(),
|
||||
self::BOOKMARK_WORK => $this->bookmarkFeature !== null,
|
||||
self::MIME_WORK => $this->browserTransformationFeature !== null,
|
||||
self::CENTRAL_COLUMNS_WORK => $this->centralColumnsFeature !== null,
|
||||
self::COMM_WORK => $this->columnCommentsFeature !== null,
|
||||
self::MENUS_WORK => $this->configurableMenusFeature !== null,
|
||||
self::DESIGNER_SETTINGS_WORK => $this->databaseDesignerSettingsFeature !== null,
|
||||
self::DISPLAY_WORK => $this->displayFeature !== null,
|
||||
self::EXPORT_TEMPLATES_WORK => $this->exportTemplatesFeature !== null,
|
||||
self::FAVORITE_WORK => $this->favoriteTablesFeature !== null,
|
||||
self::NAV_WORK => $this->navigationItemsHidingFeature !== null,
|
||||
self::PDF_WORK => $this->pdfFeature !== null,
|
||||
self::RECENT_WORK => $this->recentlyUsedTablesFeature !== null,
|
||||
self::REL_WORK => $this->relationFeature !== null,
|
||||
self::SAVED_SEARCHES_WORK => $this->savedQueryByExampleSearchesFeature !== null,
|
||||
self::HISTORY_WORK => $this->sqlHistoryFeature !== null,
|
||||
self::TRACKING_WORK => $this->trackingFeature !== null,
|
||||
self::UI_PREFS_WORK => $this->uiPreferencesFeature !== null,
|
||||
self::USER_CONFIG_WORK => $this->userPreferencesFeature !== null,
|
||||
self::ALL_WORKS => $this->hasAllFeatures(),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@ -8,6 +8,7 @@ declare(strict_types=1);
|
||||
namespace PhpMyAdmin\Export;
|
||||
|
||||
use PhpMyAdmin\Config;
|
||||
use PhpMyAdmin\ConfigStorage\RelationParameters;
|
||||
use PhpMyAdmin\Core;
|
||||
use PhpMyAdmin\Current;
|
||||
use PhpMyAdmin\Dbal\DatabaseInterface;
|
||||
@ -1000,16 +1001,16 @@ class Export
|
||||
public function getMetadataTypes(): array
|
||||
{
|
||||
return [
|
||||
'column_info',
|
||||
'table_uiprefs',
|
||||
'tracking',
|
||||
'bookmark',
|
||||
'relation',
|
||||
'table_coords',
|
||||
'pdf_pages',
|
||||
'savedsearches',
|
||||
'central_columns',
|
||||
'export_templates',
|
||||
RelationParameters::COLUMN_INFO,
|
||||
RelationParameters::TABLE_UI_PREFS,
|
||||
RelationParameters::TRACKING,
|
||||
RelationParameters::BOOKMARK,
|
||||
RelationParameters::RELATION,
|
||||
RelationParameters::TABLE_COORDS,
|
||||
RelationParameters::PDF_PAGES,
|
||||
RelationParameters::SAVED_SEARCHES,
|
||||
RelationParameters::CENTRAL_COLUMNS,
|
||||
RelationParameters::EXPORT_TEMPLATES,
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@ -5,6 +5,7 @@ declare(strict_types=1);
|
||||
namespace PhpMyAdmin;
|
||||
|
||||
use PhpMyAdmin\ConfigStorage\Relation;
|
||||
use PhpMyAdmin\ConfigStorage\RelationParameters;
|
||||
use PhpMyAdmin\Database\Events;
|
||||
use PhpMyAdmin\Database\Routines;
|
||||
use PhpMyAdmin\Database\RoutineType;
|
||||
@ -466,7 +467,13 @@ class Operations
|
||||
$getFields = ['user', 'label', 'query'];
|
||||
$whereFields = ['dbase' => $db];
|
||||
$newFields = ['dbase' => $newDatabaseName->getName()];
|
||||
$this->tableMover->duplicateInfo('bookmarkwork', 'bookmark', $getFields, $whereFields, $newFields);
|
||||
$this->tableMover->duplicateInfo(
|
||||
RelationParameters::BOOKMARK_WORK,
|
||||
RelationParameters::BOOKMARK,
|
||||
$getFields,
|
||||
$whereFields,
|
||||
$newFields,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -10,6 +10,7 @@ namespace PhpMyAdmin\Plugins\Export;
|
||||
use DateTimeImmutable;
|
||||
use PhpMyAdmin\Charsets;
|
||||
use PhpMyAdmin\Config;
|
||||
use PhpMyAdmin\ConfigStorage\RelationParameters;
|
||||
use PhpMyAdmin\Current;
|
||||
use PhpMyAdmin\Database\Events;
|
||||
use PhpMyAdmin\Database\Routines;
|
||||
@ -1093,14 +1094,18 @@ class ExportSql extends ExportPlugin
|
||||
$relationParams = $relationParameters->toArray();
|
||||
|
||||
if (isset($table)) {
|
||||
$types = ['column_info' => 'db_name', 'table_uiprefs' => 'db_name', 'tracking' => 'db_name'];
|
||||
$types = [
|
||||
RelationParameters::COLUMN_INFO => 'db_name',
|
||||
RelationParameters::TABLE_UI_PREFS => 'db_name',
|
||||
RelationParameters::TRACKING => 'db_name',
|
||||
];
|
||||
} else {
|
||||
$types = [
|
||||
'bookmark' => 'dbase',
|
||||
'relation' => 'master_db',
|
||||
'pdf_pages' => 'db_name',
|
||||
'savedsearches' => 'db_name',
|
||||
'central_columns' => 'db_name',
|
||||
RelationParameters::BOOKMARK => 'dbase',
|
||||
RelationParameters::RELATION => 'master_db',
|
||||
RelationParameters::PDF_PAGES => 'db_name',
|
||||
RelationParameters::SAVED_SEARCHES => 'db_name',
|
||||
RelationParameters::CENTRAL_COLUMNS => 'db_name',
|
||||
];
|
||||
}
|
||||
|
||||
@ -1131,13 +1136,13 @@ class ExportSql extends ExportPlugin
|
||||
}
|
||||
|
||||
foreach ($types as $type => $dbNameColumn) {
|
||||
if (! in_array($type, $metadataTypes) || ! isset($relationParams[$type])) {
|
||||
if (! in_array($type, $metadataTypes, true) || ! isset($relationParams[$type])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$dbi = DatabaseInterface::getInstance();
|
||||
// special case, designer pages and their coordinates
|
||||
if ($type === 'pdf_pages') {
|
||||
if ($type === RelationParameters::PDF_PAGES) {
|
||||
if ($relationParameters->pdfFeature === null) {
|
||||
continue;
|
||||
}
|
||||
@ -1203,12 +1208,13 @@ class ExportSql extends ExportPlugin
|
||||
|
||||
// remove auto_incrementing id field for some tables
|
||||
$sqlQuery = match ($type) {
|
||||
'bookmark' => 'SELECT `dbase`, `user`, `label`, `query` FROM ',
|
||||
'column_info' => 'SELECT `db_name`, `table_name`, `column_name`,'
|
||||
RelationParameters::BOOKMARK => 'SELECT `dbase`, `user`, `label`, `query` FROM ',
|
||||
RelationParameters::COLUMN_INFO => 'SELECT `db_name`, `table_name`, `column_name`,'
|
||||
. ' `comment`, `mimetype`, `transformation`,'
|
||||
. ' `transformation_options`, `input_transformation`,'
|
||||
. ' `input_transformation_options` FROM',
|
||||
'savedsearches' => 'SELECT `username`, `db_name`, `search_name`, `search_data` FROM',
|
||||
. ' `input_transformation_options` FROM ',
|
||||
RelationParameters::SAVED_SEARCHES => 'SELECT `username`, `db_name`, `search_name`, `search_data`'
|
||||
. ' FROM ',
|
||||
default => 'SELECT * FROM ',
|
||||
};
|
||||
|
||||
|
||||
@ -5,6 +5,7 @@ declare(strict_types=1);
|
||||
namespace PhpMyAdmin\Table;
|
||||
|
||||
use PhpMyAdmin\ConfigStorage\Relation;
|
||||
use PhpMyAdmin\ConfigStorage\RelationParameters;
|
||||
use PhpMyAdmin\Current;
|
||||
use PhpMyAdmin\Dbal\ConnectionType;
|
||||
use PhpMyAdmin\Dbal\DatabaseInterface;
|
||||
@ -159,18 +160,36 @@ class TableMover
|
||||
$getFields = ['display_field'];
|
||||
$whereFields = ['db_name' => $sourceDb, 'table_name' => $sourceTable];
|
||||
$newFields = ['db_name' => $targetDb, 'table_name' => $targetTable];
|
||||
$this->duplicateInfo('displaywork', 'table_info', $getFields, $whereFields, $newFields);
|
||||
$this->duplicateInfo(
|
||||
RelationParameters::DISPLAY_WORK,
|
||||
RelationParameters::TABLE_INFO,
|
||||
$getFields,
|
||||
$whereFields,
|
||||
$newFields,
|
||||
);
|
||||
|
||||
/** @todo revise this code when we support cross-db relations */
|
||||
$getFields = ['master_field', 'foreign_table', 'foreign_field'];
|
||||
$whereFields = ['master_db' => $sourceDb, 'master_table' => $sourceTable];
|
||||
$newFields = ['master_db' => $targetDb, 'foreign_db' => $targetDb, 'master_table' => $targetTable];
|
||||
$this->duplicateInfo('relwork', 'relation', $getFields, $whereFields, $newFields);
|
||||
$this->duplicateInfo(
|
||||
RelationParameters::REL_WORK,
|
||||
RelationParameters::RELATION,
|
||||
$getFields,
|
||||
$whereFields,
|
||||
$newFields,
|
||||
);
|
||||
|
||||
$getFields = ['foreign_field', 'master_table', 'master_field'];
|
||||
$whereFields = ['foreign_db' => $sourceDb, 'foreign_table' => $sourceTable];
|
||||
$newFields = ['master_db' => $targetDb, 'foreign_db' => $targetDb, 'foreign_table' => $targetTable];
|
||||
$this->duplicateInfo('relwork', 'relation', $getFields, $whereFields, $newFields);
|
||||
$this->duplicateInfo(
|
||||
RelationParameters::REL_WORK,
|
||||
RelationParameters::RELATION,
|
||||
$getFields,
|
||||
$whereFields,
|
||||
$newFields,
|
||||
);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -40,9 +40,9 @@ class BookmarkTest extends AbstractTestCase
|
||||
$config->settings['ServerDefault'] = 1;
|
||||
|
||||
$relationParameters = RelationParameters::fromArray([
|
||||
'bookmarkwork' => true,
|
||||
'db' => 'phpmyadmin',
|
||||
'bookmark' => 'pma_bookmark',
|
||||
RelationParameters::BOOKMARK_WORK => true,
|
||||
RelationParameters::DATABASE => 'phpmyadmin',
|
||||
RelationParameters::BOOKMARK => 'pma_bookmark',
|
||||
]);
|
||||
(new ReflectionProperty(Relation::class, 'cache'))->setValue(null, $relationParameters);
|
||||
}
|
||||
|
||||
@ -27,14 +27,14 @@ class RelationCleanupTest extends AbstractTestCase
|
||||
{
|
||||
$relation = self::createStub(Relation::class);
|
||||
$relation->method('getRelationParameters')->willReturn(RelationParameters::fromArray([
|
||||
'user' => 'user',
|
||||
'db' => 'pmadb',
|
||||
'commwork' => true,
|
||||
'displaywork' => true,
|
||||
'relwork' => true,
|
||||
'relation' => 'relation',
|
||||
'table_info' => 'table_info',
|
||||
'column_info' => 'column_info',
|
||||
RelationParameters::USER => 'user',
|
||||
RelationParameters::DATABASE => 'pmadb',
|
||||
RelationParameters::COMM_WORK => true,
|
||||
RelationParameters::DISPLAY_WORK => true,
|
||||
RelationParameters::REL_WORK => true,
|
||||
RelationParameters::RELATION => 'relation',
|
||||
RelationParameters::TABLE_INFO => 'table_info',
|
||||
RelationParameters::COLUMN_INFO => 'column_info',
|
||||
]));
|
||||
|
||||
$dbi = self::createMock(DatabaseInterface::class);
|
||||
@ -79,21 +79,21 @@ class RelationCleanupTest extends AbstractTestCase
|
||||
{
|
||||
$relation = self::createStub(Relation::class);
|
||||
$relation->method('getRelationParameters')->willReturn(RelationParameters::fromArray([
|
||||
'user' => 'user',
|
||||
'db' => 'pmadb',
|
||||
'commwork' => true,
|
||||
'displaywork' => true,
|
||||
'pdfwork' => true,
|
||||
'relwork' => true,
|
||||
'uiprefswork' => true,
|
||||
'navwork' => true,
|
||||
'relation' => 'relation',
|
||||
'table_info' => 'table_info',
|
||||
'table_coords' => 'table_coords',
|
||||
'column_info' => 'column_info',
|
||||
'pdf_pages' => 'pdf_pages',
|
||||
'table_uiprefs' => 'table_uiprefs',
|
||||
'navigationhiding' => 'navigationhiding',
|
||||
RelationParameters::USER => 'user',
|
||||
RelationParameters::DATABASE => 'pmadb',
|
||||
RelationParameters::COMM_WORK => true,
|
||||
RelationParameters::DISPLAY_WORK => true,
|
||||
RelationParameters::PDF_WORK => true,
|
||||
RelationParameters::REL_WORK => true,
|
||||
RelationParameters::UI_PREFS_WORK => true,
|
||||
RelationParameters::NAV_WORK => true,
|
||||
RelationParameters::RELATION => 'relation',
|
||||
RelationParameters::TABLE_INFO => 'table_info',
|
||||
RelationParameters::TABLE_COORDS => 'table_coords',
|
||||
RelationParameters::COLUMN_INFO => 'column_info',
|
||||
RelationParameters::PDF_PAGES => 'pdf_pages',
|
||||
RelationParameters::TABLE_UI_PREFS => 'table_uiprefs',
|
||||
RelationParameters::NAVIGATION_HIDING => 'navigationhiding',
|
||||
]));
|
||||
|
||||
$dbi = self::createMock(DatabaseInterface::class);
|
||||
@ -129,27 +129,27 @@ class RelationCleanupTest extends AbstractTestCase
|
||||
{
|
||||
$relation = self::createStub(Relation::class);
|
||||
$relation->method('getRelationParameters')->willReturn(RelationParameters::fromArray([
|
||||
'user' => 'user',
|
||||
'db' => 'pmadb',
|
||||
'commwork' => true,
|
||||
'bookmarkwork' => true,
|
||||
'displaywork' => true,
|
||||
'pdfwork' => true,
|
||||
'relwork' => true,
|
||||
'uiprefswork' => true,
|
||||
'navwork' => true,
|
||||
'savedsearcheswork' => true,
|
||||
'centralcolumnswork' => true,
|
||||
'bookmark' => 'bookmark',
|
||||
'relation' => 'relation',
|
||||
'table_info' => 'table_info',
|
||||
'table_coords' => 'table_coords',
|
||||
'column_info' => 'column_info',
|
||||
'pdf_pages' => 'pdf_pages',
|
||||
'table_uiprefs' => 'table_uiprefs',
|
||||
'navigationhiding' => 'navigationhiding',
|
||||
'savedsearches' => 'savedsearches',
|
||||
'central_columns' => 'central_columns',
|
||||
RelationParameters::USER => 'user',
|
||||
RelationParameters::DATABASE => 'pmadb',
|
||||
RelationParameters::COMM_WORK => true,
|
||||
RelationParameters::BOOKMARK_WORK => true,
|
||||
RelationParameters::DISPLAY_WORK => true,
|
||||
RelationParameters::PDF_WORK => true,
|
||||
RelationParameters::REL_WORK => true,
|
||||
RelationParameters::UI_PREFS_WORK => true,
|
||||
RelationParameters::NAV_WORK => true,
|
||||
RelationParameters::SAVED_SEARCHES_WORK => true,
|
||||
RelationParameters::CENTRAL_COLUMNS_WORK => true,
|
||||
RelationParameters::BOOKMARK => 'bookmark',
|
||||
RelationParameters::RELATION => 'relation',
|
||||
RelationParameters::TABLE_INFO => 'table_info',
|
||||
RelationParameters::TABLE_COORDS => 'table_coords',
|
||||
RelationParameters::COLUMN_INFO => 'column_info',
|
||||
RelationParameters::PDF_PAGES => 'pdf_pages',
|
||||
RelationParameters::TABLE_UI_PREFS => 'table_uiprefs',
|
||||
RelationParameters::NAVIGATION_HIDING => 'navigationhiding',
|
||||
RelationParameters::SAVED_SEARCHES => 'savedsearches',
|
||||
RelationParameters::CENTRAL_COLUMNS => 'central_columns',
|
||||
]));
|
||||
|
||||
$dbi = self::createMock(DatabaseInterface::class);
|
||||
@ -185,29 +185,29 @@ class RelationCleanupTest extends AbstractTestCase
|
||||
{
|
||||
$relation = self::createStub(Relation::class);
|
||||
$relation->method('getRelationParameters')->willReturn(RelationParameters::fromArray([
|
||||
'user' => 'user',
|
||||
'db' => 'pmadb',
|
||||
'bookmarkwork' => true,
|
||||
'historywork' => true,
|
||||
'recentwork' => true,
|
||||
'favoritework' => true,
|
||||
'uiprefswork' => true,
|
||||
'userconfigwork' => true,
|
||||
'menuswork' => true,
|
||||
'navwork' => true,
|
||||
'savedsearcheswork' => true,
|
||||
'designersettingswork' => true,
|
||||
'bookmark' => 'bookmark',
|
||||
'history' => 'history',
|
||||
'recent' => 'recent',
|
||||
'favorite' => 'favorite',
|
||||
'table_uiprefs' => 'table_uiprefs',
|
||||
'userconfig' => 'userconfig',
|
||||
'users' => 'users',
|
||||
'usergroups' => 'usergroups',
|
||||
'navigationhiding' => 'navigationhiding',
|
||||
'savedsearches' => 'savedsearches',
|
||||
'designer_settings' => 'designer_settings',
|
||||
RelationParameters::USER => 'user',
|
||||
RelationParameters::DATABASE => 'pmadb',
|
||||
RelationParameters::BOOKMARK_WORK => true,
|
||||
RelationParameters::HISTORY_WORK => true,
|
||||
RelationParameters::RECENT_WORK => true,
|
||||
RelationParameters::FAVORITE_WORK => true,
|
||||
RelationParameters::UI_PREFS_WORK => true,
|
||||
RelationParameters::USER_CONFIG_WORK => true,
|
||||
RelationParameters::MENUS_WORK => true,
|
||||
RelationParameters::NAV_WORK => true,
|
||||
RelationParameters::SAVED_SEARCHES_WORK => true,
|
||||
RelationParameters::DESIGNER_SETTINGS_WORK => true,
|
||||
RelationParameters::BOOKMARK => 'bookmark',
|
||||
RelationParameters::HISTORY => 'history',
|
||||
RelationParameters::RECENT => 'recent',
|
||||
RelationParameters::FAVORITE => 'favorite',
|
||||
RelationParameters::TABLE_UI_PREFS => 'table_uiprefs',
|
||||
RelationParameters::USER_CONFIG => 'userconfig',
|
||||
RelationParameters::USERS => 'users',
|
||||
RelationParameters::USER_GROUPS => 'usergroups',
|
||||
RelationParameters::NAVIGATION_HIDING => 'navigationhiding',
|
||||
RelationParameters::SAVED_SEARCHES => 'savedsearches',
|
||||
RelationParameters::DESIGNER_SETTINGS => 'designer_settings',
|
||||
]));
|
||||
|
||||
$dbi = self::createMock(DatabaseInterface::class);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -77,10 +77,10 @@ class RelationTest extends AbstractTestCase
|
||||
);
|
||||
|
||||
$relationParameters = RelationParameters::fromArray([
|
||||
'displaywork' => true,
|
||||
'db' => 'pmadb',
|
||||
'table_info' => 'table_info',
|
||||
'relation' => 'relation',
|
||||
RelationParameters::DISPLAY_WORK => true,
|
||||
RelationParameters::DATABASE => 'pmadb',
|
||||
RelationParameters::TABLE_INFO => 'table_info',
|
||||
RelationParameters::RELATION => 'relation',
|
||||
]);
|
||||
(new ReflectionProperty(Relation::class, 'cache'))->setValue(null, $relationParameters);
|
||||
|
||||
@ -304,9 +304,9 @@ class RelationTest extends AbstractTestCase
|
||||
$relation->fixPmaTables('db_pma', false);
|
||||
|
||||
$relationParameters = RelationParameters::fromArray([
|
||||
'db' => 'db_pma',
|
||||
'userconfigwork' => true,
|
||||
'userconfig' => 'pma__userconfig',
|
||||
RelationParameters::DATABASE => 'db_pma',
|
||||
RelationParameters::USER_CONFIG_WORK => true,
|
||||
RelationParameters::USER_CONFIG => 'pma__userconfig',
|
||||
]);
|
||||
self::assertSame($relationParameters->toArray(), $relation->getRelationParameters()->toArray());
|
||||
|
||||
@ -575,9 +575,9 @@ class RelationTest extends AbstractTestCase
|
||||
self::assertSame('db_pma', $config->selectedServer['pmadb']);
|
||||
|
||||
$relationParameters = RelationParameters::fromArray([
|
||||
'db' => 'db_pma',
|
||||
'userconfigwork' => true,
|
||||
'userconfig' => 'pma__userconfig',
|
||||
RelationParameters::DATABASE => 'db_pma',
|
||||
RelationParameters::USER_CONFIG_WORK => true,
|
||||
RelationParameters::USER_CONFIG => 'pma__userconfig',
|
||||
]);
|
||||
self::assertSame($relationParameters->toArray(), $relation->getRelationParameters()->toArray());
|
||||
|
||||
@ -856,9 +856,9 @@ class RelationTest extends AbstractTestCase
|
||||
self::assertSame('db_pma', $config->selectedServer['pmadb']);
|
||||
|
||||
$relationParameters = RelationParameters::fromArray([
|
||||
'db' => 'db_pma',
|
||||
'userconfigwork' => true,
|
||||
'userconfig' => 'pma__userconfig',
|
||||
RelationParameters::DATABASE => 'db_pma',
|
||||
RelationParameters::USER_CONFIG_WORK => true,
|
||||
RelationParameters::USER_CONFIG => 'pma__userconfig',
|
||||
]);
|
||||
self::assertSame($relationParameters->toArray(), $relation->getRelationParameters()->toArray());
|
||||
|
||||
@ -1547,9 +1547,9 @@ class RelationTest extends AbstractTestCase
|
||||
|
||||
// Should all be false for server = 0
|
||||
$relationParameters = RelationParameters::fromArray([
|
||||
'db' => 'phpmyadmin',
|
||||
'userconfigwork' => true,
|
||||
'userconfig' => 'pma__userconfig',
|
||||
RelationParameters::DATABASE => 'phpmyadmin',
|
||||
RelationParameters::USER_CONFIG_WORK => true,
|
||||
RelationParameters::USER_CONFIG => 'pma__userconfig',
|
||||
]);
|
||||
self::assertSame($relationParameters->toArray(), $relation->getRelationParameters()->toArray());
|
||||
|
||||
@ -1633,9 +1633,9 @@ class RelationTest extends AbstractTestCase
|
||||
$dummyDbi->assertAllSelectsConsumed();
|
||||
|
||||
$relationParameters = RelationParameters::fromArray([
|
||||
'db' => 'phpmyadmin',
|
||||
'userconfigwork' => false,
|
||||
'userconfig' => 'pma__userconfig',
|
||||
RelationParameters::DATABASE => 'phpmyadmin',
|
||||
RelationParameters::USER_CONFIG_WORK => false,
|
||||
RelationParameters::USER_CONFIG => 'pma__userconfig',
|
||||
]);
|
||||
self::assertSame($relationParameters->toArray(), $relation->getRelationParameters()->toArray());
|
||||
|
||||
@ -1718,9 +1718,9 @@ class RelationTest extends AbstractTestCase
|
||||
$relation = new Relation($dbi);
|
||||
$relation->initRelationParamsCache();
|
||||
|
||||
self::assertArrayHasKey(
|
||||
'relation',
|
||||
$relation->getRelationParameters()->toArray(),
|
||||
self::assertSame(
|
||||
'pma__userconfig_custom',
|
||||
$relation->getRelationParameters()->toArray()[RelationParameters::USER_CONFIG],
|
||||
'The cache is expected to be filled because the custom override'
|
||||
. 'was understood (pma__userconfig vs pma__userconfig_custom)',
|
||||
);
|
||||
@ -1742,9 +1742,9 @@ class RelationTest extends AbstractTestCase
|
||||
$dummyDbi->assertAllSelectsConsumed();
|
||||
|
||||
$relationParameters = RelationParameters::fromArray([
|
||||
'db' => 'PMA-storage',
|
||||
'userconfigwork' => true,
|
||||
'userconfig' => 'pma__userconfig_custom',
|
||||
RelationParameters::DATABASE => 'PMA-storage',
|
||||
RelationParameters::USER_CONFIG_WORK => true,
|
||||
RelationParameters::USER_CONFIG => 'pma__userconfig_custom',
|
||||
]);
|
||||
self::assertSame($relationParameters->toArray(), $relationData->toArray());
|
||||
|
||||
@ -1828,14 +1828,8 @@ class RelationTest extends AbstractTestCase
|
||||
$relation = new Relation($dbi);
|
||||
$relation->initRelationParamsCache();
|
||||
|
||||
/**
|
||||
* TODO: Warning! This test doesn't actually test anything.
|
||||
* The method above does't initialize Relation param cache.
|
||||
* A proper test is needed to verify that the user disabled features result in disabled Relation cache.
|
||||
*/
|
||||
self::assertArrayHasKey(
|
||||
'relation',
|
||||
$relation->getRelationParameters()->toArray(),
|
||||
self::assertNull(
|
||||
$relation->getRelationParameters()->toArray()[RelationParameters::TRACKING],
|
||||
'The cache is expected to be filled because the custom override'
|
||||
. 'was understood',
|
||||
);
|
||||
@ -1860,9 +1854,9 @@ class RelationTest extends AbstractTestCase
|
||||
$dummyDbi->assertAllSelectsConsumed();
|
||||
|
||||
$relationParameters = RelationParameters::fromArray([
|
||||
'db' => 'PMA-storage',
|
||||
'trackingwork' => false,
|
||||
'tracking' => false,
|
||||
RelationParameters::DATABASE => 'PMA-storage',
|
||||
RelationParameters::TRACKING_WORK => false,
|
||||
RelationParameters::TRACKING => false,
|
||||
]);
|
||||
self::assertSame($relationParameters->toArray(), $relationData->toArray());
|
||||
self::assertNull($relationParameters->trackingFeature, 'The feature should not be enabled');
|
||||
@ -1952,9 +1946,9 @@ class RelationTest extends AbstractTestCase
|
||||
$relation = new Relation($dbi);
|
||||
$relation->initRelationParamsCache();
|
||||
|
||||
self::assertArrayHasKey(
|
||||
'relation',
|
||||
$relation->getRelationParameters()->toArray(),
|
||||
self::assertSame(
|
||||
'pma__favorite_custom',
|
||||
$relation->getRelationParameters()->toArray()[RelationParameters::FAVORITE],
|
||||
'The cache is expected to be filled because the custom override'
|
||||
. 'was understood',
|
||||
);
|
||||
@ -1966,11 +1960,11 @@ class RelationTest extends AbstractTestCase
|
||||
$dummyDbi->assertAllSelectsConsumed();
|
||||
|
||||
$relationParameters = RelationParameters::fromArray([
|
||||
'db' => 'PMA-storage',
|
||||
'trackingwork' => false,
|
||||
'tracking' => false,
|
||||
'favorite' => 'pma__favorite_custom',
|
||||
'favoritework' => true,
|
||||
RelationParameters::DATABASE => 'PMA-storage',
|
||||
RelationParameters::TRACKING_WORK => false,
|
||||
RelationParameters::TRACKING => false,
|
||||
RelationParameters::FAVORITE => 'pma__favorite_custom',
|
||||
RelationParameters::FAVORITE_WORK => true,
|
||||
]);
|
||||
self::assertSame($relationParameters->toArray(), $relationData->toArray());
|
||||
self::assertNull($relationParameters->trackingFeature, 'The feature should not be enabled');
|
||||
@ -2184,30 +2178,30 @@ class RelationTest extends AbstractTestCase
|
||||
// phpcs:disable Generic.Files.LineLength.TooLong
|
||||
return [
|
||||
[
|
||||
['user' => 'user', 'db' => 'pmadb', 'commwork' => true, 'column_info' => 'column_info'],
|
||||
[RelationParameters::USER => 'user', RelationParameters::DATABASE => 'pmadb', RelationParameters::COMM_WORK => true, RelationParameters::COLUMN_INFO => 'column_info'],
|
||||
['UPDATE `pmadb`.`column_info` SET db_name = \'db_2\', table_name = \'table_2\' WHERE db_name = \'db_1\' AND table_name = \'table_1\''],
|
||||
],
|
||||
[
|
||||
['user' => 'user', 'db' => 'pmadb', 'displaywork' => true, 'relation' => 'relation', 'table_info' => 'table_info'],
|
||||
[RelationParameters::USER => 'user', RelationParameters::DATABASE => 'pmadb', RelationParameters::DISPLAY_WORK => true, RelationParameters::RELATION => 'relation', RelationParameters::TABLE_INFO => 'table_info'],
|
||||
['UPDATE `pmadb`.`table_info` SET db_name = \'db_2\', table_name = \'table_2\' WHERE db_name = \'db_1\' AND table_name = \'table_1\''],
|
||||
],
|
||||
[
|
||||
['user' => 'user', 'db' => 'pmadb', 'relwork' => true, 'relation' => 'relation'],
|
||||
[RelationParameters::USER => 'user', RelationParameters::DATABASE => 'pmadb', RelationParameters::REL_WORK => true, RelationParameters::RELATION => 'relation'],
|
||||
[
|
||||
'UPDATE `pmadb`.`relation` SET foreign_db = \'db_2\', foreign_table = \'table_2\' WHERE foreign_db = \'db_1\' AND foreign_table = \'table_1\'',
|
||||
'UPDATE `pmadb`.`relation` SET master_db = \'db_2\', master_table = \'table_2\' WHERE master_db = \'db_1\' AND master_table = \'table_1\'',
|
||||
],
|
||||
],
|
||||
[
|
||||
['user' => 'user', 'db' => 'pmadb', 'pdfwork' => true, 'pdf_pages' => 'pdf_pages', 'table_coords' => 'table_coords'],
|
||||
[RelationParameters::USER => 'user', RelationParameters::DATABASE => 'pmadb', RelationParameters::PDF_WORK => true, RelationParameters::PDF_PAGES => 'pdf_pages', RelationParameters::TABLE_COORDS => 'table_coords'],
|
||||
['DELETE FROM `pmadb`.`table_coords` WHERE db_name = \'db_1\' AND table_name = \'table_1\''],
|
||||
],
|
||||
[
|
||||
['user' => 'user', 'db' => 'pmadb', 'uiprefswork' => true, 'table_uiprefs' => 'table_uiprefs'],
|
||||
[RelationParameters::USER => 'user', RelationParameters::DATABASE => 'pmadb', RelationParameters::UI_PREFS_WORK => true, RelationParameters::TABLE_UI_PREFS => 'table_uiprefs'],
|
||||
['UPDATE `pmadb`.`table_uiprefs` SET db_name = \'db_2\', table_name = \'table_2\' WHERE db_name = \'db_1\' AND table_name = \'table_1\''],
|
||||
],
|
||||
[
|
||||
['user' => 'user', 'db' => 'pmadb', 'navwork' => true, 'navigationhiding' => 'navigationhiding'],
|
||||
[RelationParameters::USER => 'user', RelationParameters::DATABASE => 'pmadb', RelationParameters::NAV_WORK => true, RelationParameters::NAVIGATION_HIDING => 'navigationhiding'],
|
||||
[
|
||||
'UPDATE `pmadb`.`navigationhiding` SET db_name = \'db_2\', table_name = \'table_2\' WHERE db_name = \'db_1\' AND table_name = \'table_1\'',
|
||||
'UPDATE `pmadb`.`navigationhiding` SET db_name = \'db_2\', item_name = \'table_2\' WHERE db_name = \'db_1\' AND item_name = \'table_1\' AND item_type = \'table\'',
|
||||
@ -2225,11 +2219,11 @@ class RelationTest extends AbstractTestCase
|
||||
$relation = new Relation($dbi);
|
||||
|
||||
$relationParameters = RelationParameters::fromArray([
|
||||
'user' => 'user',
|
||||
'db' => 'pma`db',
|
||||
'pdfwork' => true,
|
||||
'pdf_pages' => 'pdf_pages',
|
||||
'table_coords' => 'table`coords',
|
||||
RelationParameters::USER => 'user',
|
||||
RelationParameters::DATABASE => 'pma`db',
|
||||
RelationParameters::PDF_WORK => true,
|
||||
RelationParameters::PDF_PAGES => 'pdf_pages',
|
||||
RelationParameters::TABLE_COORDS => 'table`coords',
|
||||
]);
|
||||
(new ReflectionProperty(Relation::class, 'cache'))->setValue(null, $relationParameters);
|
||||
|
||||
|
||||
@ -61,10 +61,10 @@ class AddControllerTest extends AbstractTestCase
|
||||
$config = Config::getInstance();
|
||||
$config->selectedServer['user'] = 'test_user';
|
||||
$relationParameters = RelationParameters::fromArray([
|
||||
'user' => 'test_user',
|
||||
'db' => 'pmadb',
|
||||
'bookmarkwork' => true,
|
||||
'bookmark' => 'bookmark',
|
||||
RelationParameters::USER => 'test_user',
|
||||
RelationParameters::DATABASE => 'pmadb',
|
||||
RelationParameters::BOOKMARK_WORK => true,
|
||||
RelationParameters::BOOKMARK => 'bookmark',
|
||||
]);
|
||||
(new ReflectionProperty(Relation::class, 'cache'))->setValue(null, $relationParameters);
|
||||
|
||||
|
||||
@ -38,9 +38,9 @@ class CreateControllerTest extends AbstractTestCase
|
||||
public function testCreate(): void
|
||||
{
|
||||
$relationParameters = RelationParameters::fromArray([
|
||||
'exporttemplateswork' => true,
|
||||
'db' => 'db',
|
||||
'export_templates' => 'table',
|
||||
RelationParameters::EXPORT_TEMPLATES_WORK => true,
|
||||
RelationParameters::DATABASE => 'db',
|
||||
RelationParameters::EXPORT_TEMPLATES => 'table',
|
||||
]);
|
||||
(new ReflectionProperty(Relation::class, 'cache'))->setValue(null, $relationParameters);
|
||||
|
||||
|
||||
@ -36,9 +36,9 @@ class LoadControllerTest extends AbstractTestCase
|
||||
public function testLoad(): void
|
||||
{
|
||||
$relationParameters = RelationParameters::fromArray([
|
||||
'exporttemplateswork' => true,
|
||||
'db' => 'db',
|
||||
'export_templates' => 'table',
|
||||
RelationParameters::EXPORT_TEMPLATES_WORK => true,
|
||||
RelationParameters::DATABASE => 'db',
|
||||
RelationParameters::EXPORT_TEMPLATES => 'table',
|
||||
]);
|
||||
(new ReflectionProperty(Relation::class, 'cache'))->setValue(null, $relationParameters);
|
||||
|
||||
|
||||
@ -45,9 +45,9 @@ final class SyncFavoriteTablesControllerTest extends AbstractTestCase
|
||||
')', true);
|
||||
|
||||
$relationParameters = RelationParameters::fromArray([
|
||||
'db' => 'pmadb',
|
||||
'favoritework' => 'favoritework',
|
||||
'favorite' => 'favorite',
|
||||
RelationParameters::DATABASE => 'pmadb',
|
||||
RelationParameters::FAVORITE_WORK => 'favoritework',
|
||||
RelationParameters::FAVORITE => 'favorite',
|
||||
]);
|
||||
(new ReflectionProperty(Relation::class, 'cache'))->setValue(null, $relationParameters);
|
||||
|
||||
|
||||
@ -52,20 +52,20 @@ class ReplaceControllerTest extends AbstractTestCase
|
||||
$config->selectedServer['DisableIS'] = false;
|
||||
|
||||
$relationParameters = RelationParameters::fromArray([
|
||||
'table_coords' => 'table_name',
|
||||
'displaywork' => true,
|
||||
'db' => 'information_schema',
|
||||
'table_info' => 'table_info',
|
||||
'relwork' => true,
|
||||
'relation' => 'relation',
|
||||
'mimework' => true,
|
||||
'commwork' => true,
|
||||
'column_info' => 'column_info',
|
||||
'pdf_pages' => 'pdf_pages',
|
||||
'bookmarkwork' => true,
|
||||
'bookmark' => 'bookmark',
|
||||
'uiprefswork' => true,
|
||||
'table_uiprefs' => 'table_uiprefs',
|
||||
RelationParameters::TABLE_COORDS => 'table_name',
|
||||
RelationParameters::DISPLAY_WORK => true,
|
||||
RelationParameters::DATABASE => 'information_schema',
|
||||
RelationParameters::TABLE_INFO => 'table_info',
|
||||
RelationParameters::REL_WORK => true,
|
||||
RelationParameters::RELATION => 'relation',
|
||||
RelationParameters::MIME_WORK => true,
|
||||
RelationParameters::COMM_WORK => true,
|
||||
RelationParameters::COLUMN_INFO => 'column_info',
|
||||
RelationParameters::PDF_PAGES => 'pdf_pages',
|
||||
RelationParameters::BOOKMARK_WORK => true,
|
||||
RelationParameters::BOOKMARK => 'bookmark',
|
||||
RelationParameters::UI_PREFS_WORK => true,
|
||||
RelationParameters::TABLE_UI_PREFS => 'table_uiprefs',
|
||||
]);
|
||||
(new ReflectionProperty(Relation::class, 'cache'))->setValue(null, $relationParameters);
|
||||
}
|
||||
|
||||
@ -117,11 +117,11 @@ class CentralColumnsTest extends AbstractTestCase
|
||||
Current::$table = 'PMA_table';
|
||||
|
||||
$relationParameters = RelationParameters::fromArray([
|
||||
'centralcolumnswork' => true,
|
||||
'relwork' => true,
|
||||
'db' => 'phpmyadmin',
|
||||
'relation' => 'relation',
|
||||
'central_columns' => 'pma_central_columns',
|
||||
RelationParameters::CENTRAL_COLUMNS_WORK => true,
|
||||
RelationParameters::REL_WORK => true,
|
||||
RelationParameters::DATABASE => 'phpmyadmin',
|
||||
RelationParameters::RELATION => 'relation',
|
||||
RelationParameters::CENTRAL_COLUMNS => 'pma_central_columns',
|
||||
]);
|
||||
(new ReflectionProperty(Relation::class, 'cache'))->setValue(null, $relationParameters);
|
||||
|
||||
|
||||
@ -404,12 +404,12 @@ final class CommonTest extends AbstractTestCase
|
||||
private static function setRelationParameters(): void
|
||||
{
|
||||
$relationParameters = RelationParameters::fromArray([
|
||||
'db' => 'pmadb',
|
||||
'pdfwork' => true,
|
||||
'pdf_pages' => 'pdf_pages',
|
||||
'table_coords' => 'table_coords',
|
||||
'relwork' => true,
|
||||
'relation' => 'rel db',
|
||||
RelationParameters::DATABASE => 'pmadb',
|
||||
RelationParameters::PDF_WORK => true,
|
||||
RelationParameters::PDF_PAGES => 'pdf_pages',
|
||||
RelationParameters::TABLE_COORDS => 'table_coords',
|
||||
RelationParameters::REL_WORK => true,
|
||||
RelationParameters::RELATION => 'rel db',
|
||||
]);
|
||||
(new ReflectionProperty(Relation::class, 'cache'))->setValue(null, $relationParameters);
|
||||
}
|
||||
|
||||
@ -39,10 +39,10 @@ class DesignerTest extends AbstractTestCase
|
||||
|
||||
$_SESSION = [' PMA_token ' => 'token'];
|
||||
$relationParameters = RelationParameters::fromArray([
|
||||
'db' => 'pmadb',
|
||||
'pdf_pages' => 'pdf_pages',
|
||||
'table_coords' => 'table_coords',
|
||||
'pdfwork' => true,
|
||||
RelationParameters::DATABASE => 'pmadb',
|
||||
RelationParameters::PDF_PAGES => 'pdf_pages',
|
||||
RelationParameters::TABLE_COORDS => 'table_coords',
|
||||
RelationParameters::PDF_WORK => true,
|
||||
]);
|
||||
(new ReflectionProperty(Relation::class, 'cache'))->setValue(null, $relationParameters);
|
||||
}
|
||||
|
||||
@ -652,9 +652,9 @@ class ResultsTest extends AbstractTestCase
|
||||
// Fake relation settings
|
||||
$_SESSION['tmpval']['relational_display'] = 'K';
|
||||
$relationParameters = RelationParameters::fromArray([
|
||||
'db' => 'db',
|
||||
'mimework' => true,
|
||||
'column_info' => 'column_info',
|
||||
RelationParameters::DATABASE => 'db',
|
||||
RelationParameters::MIME_WORK => true,
|
||||
RelationParameters::COLUMN_INFO => 'column_info',
|
||||
]);
|
||||
(new ReflectionProperty(Relation::class, 'cache'))->setValue(null, $relationParameters);
|
||||
$config = Config::getInstance();
|
||||
|
||||
@ -40,9 +40,9 @@ class NavigationTest extends AbstractTestCase
|
||||
$config->settings['ActionLinksMode'] = 'both';
|
||||
|
||||
$relationParameters = RelationParameters::fromArray([
|
||||
'db' => 'pmadb',
|
||||
'navwork' => true,
|
||||
'navigationhiding' => 'navigationhiding',
|
||||
RelationParameters::DATABASE => 'pmadb',
|
||||
RelationParameters::NAV_WORK => true,
|
||||
RelationParameters::NAVIGATION_HIDING => 'navigationhiding',
|
||||
]);
|
||||
(new ReflectionProperty(Relation::class, 'cache'))->setValue(null, $relationParameters);
|
||||
|
||||
|
||||
@ -34,9 +34,9 @@ class NodeDatabaseChildTest extends AbstractTestCase
|
||||
$config->settings['DefaultTabDatabase'] = '/database/structure';
|
||||
$config->settings['ServerDefault'] = 1;
|
||||
$relationParameters = RelationParameters::fromArray([
|
||||
'db' => 'pmadb',
|
||||
'navwork' => true,
|
||||
'navigationhiding' => 'navigationhiding',
|
||||
RelationParameters::DATABASE => 'pmadb',
|
||||
RelationParameters::NAV_WORK => true,
|
||||
RelationParameters::NAVIGATION_HIDING => 'navigationhiding',
|
||||
]);
|
||||
(new ReflectionProperty(Relation::class, 'cache'))->setValue(null, $relationParameters);
|
||||
$this->object = $this->getMockBuilder(NodeDatabaseChild::class)
|
||||
@ -61,9 +61,9 @@ class NodeDatabaseChildTest extends AbstractTestCase
|
||||
public function testGetHtmlForControlButtons(): void
|
||||
{
|
||||
$relationParameters = RelationParameters::fromArray([
|
||||
'db' => 'pmadb',
|
||||
'navwork' => true,
|
||||
'navigationhiding' => 'navigationhiding',
|
||||
RelationParameters::DATABASE => 'pmadb',
|
||||
RelationParameters::NAV_WORK => true,
|
||||
RelationParameters::NAVIGATION_HIDING => 'navigationhiding',
|
||||
]);
|
||||
|
||||
$parent = new NodeDatabase(Config::getInstance(), 'parent');
|
||||
|
||||
@ -73,9 +73,9 @@ class NodeDatabaseTest extends AbstractTestCase
|
||||
$userPrivileges = new UserPrivileges();
|
||||
|
||||
$relationParameters = RelationParameters::fromArray([
|
||||
'db' => 'pmadb',
|
||||
'navwork' => true,
|
||||
'navigationhiding' => 'navigationhiding',
|
||||
RelationParameters::DATABASE => 'pmadb',
|
||||
RelationParameters::NAV_WORK => true,
|
||||
RelationParameters::NAVIGATION_HIDING => 'navigationhiding',
|
||||
]);
|
||||
|
||||
$parent = new NodeDatabase($config, 'default');
|
||||
|
||||
@ -349,9 +349,9 @@ final class NodeTest extends AbstractTestCase
|
||||
$expectedSql .= 'ORDER BY SCHEMA_NAME ASC';
|
||||
|
||||
$relationParameters = RelationParameters::fromArray([
|
||||
'db' => 'pmadb',
|
||||
'navwork' => true,
|
||||
'navigationhiding' => 'navigationhiding',
|
||||
RelationParameters::DATABASE => 'pmadb',
|
||||
RelationParameters::NAV_WORK => true,
|
||||
RelationParameters::NAVIGATION_HIDING => 'navigationhiding',
|
||||
]);
|
||||
|
||||
$node = new Node($config, 'node');
|
||||
@ -381,9 +381,9 @@ final class NodeTest extends AbstractTestCase
|
||||
$expectedSql .= 'LIMIT 10, 20';
|
||||
|
||||
$relationParameters = RelationParameters::fromArray([
|
||||
'db' => 'pmadb',
|
||||
'navwork' => true,
|
||||
'navigationhiding' => 'navigationhiding',
|
||||
RelationParameters::DATABASE => 'pmadb',
|
||||
RelationParameters::NAV_WORK => true,
|
||||
RelationParameters::NAVIGATION_HIDING => 'navigationhiding',
|
||||
]);
|
||||
|
||||
$node = new Node($config, 'node');
|
||||
@ -407,9 +407,9 @@ final class NodeTest extends AbstractTestCase
|
||||
$config->settings['NavigationTreeDbSeparator'] = '_';
|
||||
|
||||
$relationParameters = RelationParameters::fromArray([
|
||||
'db' => 'pmadb',
|
||||
'navwork' => true,
|
||||
'navigationhiding' => 'navigationhiding',
|
||||
RelationParameters::DATABASE => 'pmadb',
|
||||
RelationParameters::NAV_WORK => true,
|
||||
RelationParameters::NAVIGATION_HIDING => 'navigationhiding',
|
||||
]);
|
||||
|
||||
$node = new Node($config, 'node');
|
||||
|
||||
@ -60,10 +60,10 @@ final class AuthenticationPluginTest extends AbstractTestCase
|
||||
$_SESSION['two_factor_check'] = false;
|
||||
|
||||
$relationParameters = RelationParameters::fromArray([
|
||||
'user' => 'test_user',
|
||||
'db' => 'db_pma',
|
||||
'userconfigwork' => true,
|
||||
'userconfig' => 'pma__userconfig',
|
||||
RelationParameters::USER => 'test_user',
|
||||
RelationParameters::DATABASE => 'db_pma',
|
||||
RelationParameters::USER_CONFIG_WORK => true,
|
||||
RelationParameters::USER_CONFIG => 'pma__userconfig',
|
||||
]);
|
||||
(new ReflectionProperty(Relation::class, 'cache'))->setValue(null, $relationParameters);
|
||||
(new ReflectionProperty(ResponseRenderer::class, 'instance'))->setValue(null, null);
|
||||
@ -122,10 +122,10 @@ final class AuthenticationPluginTest extends AbstractTestCase
|
||||
$_SESSION['two_factor_check'] = false;
|
||||
|
||||
$relationParameters = RelationParameters::fromArray([
|
||||
'user' => 'test_user',
|
||||
'db' => 'db_pma',
|
||||
'userconfigwork' => true,
|
||||
'userconfig' => 'pma__userconfig',
|
||||
RelationParameters::USER => 'test_user',
|
||||
RelationParameters::DATABASE => 'db_pma',
|
||||
RelationParameters::USER_CONFIG_WORK => true,
|
||||
RelationParameters::USER_CONFIG => 'pma__userconfig',
|
||||
]);
|
||||
(new ReflectionProperty(Relation::class, 'cache'))->setValue(null, $relationParameters);
|
||||
(new ReflectionProperty(ResponseRenderer::class, 'instance'))->setValue(null, null);
|
||||
|
||||
@ -433,12 +433,12 @@ class ExportHtmlwordTest extends AbstractTestCase
|
||||
->willReturn('1');
|
||||
|
||||
$relationParameters = RelationParameters::fromArray([
|
||||
'relwork' => true,
|
||||
'commwork' => true,
|
||||
'mimework' => true,
|
||||
'db' => 'database',
|
||||
'relation' => 'rel',
|
||||
'column_info' => 'col',
|
||||
RelationParameters::REL_WORK => true,
|
||||
RelationParameters::COMM_WORK => true,
|
||||
RelationParameters::MIME_WORK => true,
|
||||
RelationParameters::DATABASE => 'database',
|
||||
RelationParameters::RELATION => 'rel',
|
||||
RelationParameters::COLUMN_INFO => 'col',
|
||||
]);
|
||||
(new ReflectionProperty(Relation::class, 'cache'))->setValue(null, $relationParameters);
|
||||
|
||||
@ -506,12 +506,12 @@ class ExportHtmlwordTest extends AbstractTestCase
|
||||
$this->object->transformations = new Transformations($dbi, $relation);
|
||||
|
||||
$relationParameters = RelationParameters::fromArray([
|
||||
'relwork' => true,
|
||||
'commwork' => true,
|
||||
'mimework' => true,
|
||||
'db' => 'database',
|
||||
'relation' => 'rel',
|
||||
'column_info' => 'col',
|
||||
RelationParameters::REL_WORK => true,
|
||||
RelationParameters::COMM_WORK => true,
|
||||
RelationParameters::MIME_WORK => true,
|
||||
RelationParameters::DATABASE => 'database',
|
||||
RelationParameters::RELATION => 'rel',
|
||||
RelationParameters::COLUMN_INFO => 'col',
|
||||
]);
|
||||
(new ReflectionProperty(Relation::class, 'cache'))->setValue(null, $relationParameters);
|
||||
|
||||
@ -545,9 +545,9 @@ class ExportHtmlwordTest extends AbstractTestCase
|
||||
DatabaseInterface::$instance = $dbi;
|
||||
|
||||
$relationParameters = RelationParameters::fromArray([
|
||||
'db' => 'database',
|
||||
'relation' => 'rel',
|
||||
'column_info' => 'col',
|
||||
RelationParameters::DATABASE => 'database',
|
||||
RelationParameters::RELATION => 'rel',
|
||||
RelationParameters::COLUMN_INFO => 'col',
|
||||
]);
|
||||
(new ReflectionProperty(Relation::class, 'cache'))->setValue(null, $relationParameters);
|
||||
|
||||
|
||||
@ -79,11 +79,11 @@ class ExportLatexTest extends AbstractTestCase
|
||||
ExportPlugin::$singleTable = false;
|
||||
|
||||
$relationParameters = RelationParameters::fromArray([
|
||||
'db' => 'db',
|
||||
'relation' => 'relation',
|
||||
'column_info' => 'column_info',
|
||||
'relwork' => true,
|
||||
'mimework' => true,
|
||||
RelationParameters::DATABASE => 'db',
|
||||
RelationParameters::RELATION => 'relation',
|
||||
RelationParameters::COLUMN_INFO => 'column_info',
|
||||
RelationParameters::REL_WORK => true,
|
||||
RelationParameters::MIME_WORK => true,
|
||||
]);
|
||||
(new ReflectionProperty(Relation::class, 'cache'))->setValue(null, $relationParameters);
|
||||
|
||||
@ -608,12 +608,12 @@ class ExportLatexTest extends AbstractTestCase
|
||||
$this->object->transformations = new Transformations($dbi, $relation);
|
||||
|
||||
$relationParameters = RelationParameters::fromArray([
|
||||
'relwork' => true,
|
||||
'commwork' => true,
|
||||
'mimework' => true,
|
||||
'db' => 'database',
|
||||
'relation' => 'rel',
|
||||
'column_info' => 'col',
|
||||
RelationParameters::REL_WORK => true,
|
||||
RelationParameters::COMM_WORK => true,
|
||||
RelationParameters::MIME_WORK => true,
|
||||
RelationParameters::DATABASE => 'database',
|
||||
RelationParameters::RELATION => 'rel',
|
||||
RelationParameters::COLUMN_INFO => 'col',
|
||||
]);
|
||||
(new ReflectionProperty(Relation::class, 'cache'))->setValue(null, $relationParameters);
|
||||
|
||||
@ -693,12 +693,12 @@ class ExportLatexTest extends AbstractTestCase
|
||||
$this->object->transformations = new Transformations($dbi, $relation);
|
||||
|
||||
$relationParameters = RelationParameters::fromArray([
|
||||
'relwork' => true,
|
||||
'commwork' => true,
|
||||
'mimework' => true,
|
||||
'db' => 'database',
|
||||
'relation' => 'rel',
|
||||
'column_info' => 'col',
|
||||
RelationParameters::REL_WORK => true,
|
||||
RelationParameters::COMM_WORK => true,
|
||||
RelationParameters::MIME_WORK => true,
|
||||
RelationParameters::DATABASE => 'database',
|
||||
RelationParameters::RELATION => 'rel',
|
||||
RelationParameters::COLUMN_INFO => 'col',
|
||||
]);
|
||||
(new ReflectionProperty(Relation::class, 'cache'))->setValue(null, $relationParameters);
|
||||
|
||||
@ -750,9 +750,9 @@ class ExportLatexTest extends AbstractTestCase
|
||||
$this->object->setExportOptions($request, []);
|
||||
|
||||
$relationParameters = RelationParameters::fromArray([
|
||||
'db' => 'database',
|
||||
'relation' => 'rel',
|
||||
'column_info' => 'col',
|
||||
RelationParameters::DATABASE => 'database',
|
||||
RelationParameters::RELATION => 'rel',
|
||||
RelationParameters::COLUMN_INFO => 'col',
|
||||
]);
|
||||
(new ReflectionProperty(Relation::class, 'cache'))->setValue(null, $relationParameters);
|
||||
|
||||
|
||||
@ -96,11 +96,11 @@ class ExportOdtTest extends AbstractTestCase
|
||||
ExportPlugin::$singleTable = false;
|
||||
|
||||
$relationParameters = RelationParameters::fromArray([
|
||||
'db' => 'db',
|
||||
'relation' => 'relation',
|
||||
'column_info' => 'column_info',
|
||||
'relwork' => true,
|
||||
'mimework' => true,
|
||||
RelationParameters::DATABASE => 'db',
|
||||
RelationParameters::RELATION => 'relation',
|
||||
RelationParameters::COLUMN_INFO => 'column_info',
|
||||
RelationParameters::REL_WORK => true,
|
||||
RelationParameters::MIME_WORK => true,
|
||||
]);
|
||||
(new ReflectionProperty(Relation::class, 'cache'))->setValue(null, $relationParameters);
|
||||
|
||||
@ -621,12 +621,12 @@ class ExportOdtTest extends AbstractTestCase
|
||||
->willReturn('1');
|
||||
|
||||
$relationParameters = RelationParameters::fromArray([
|
||||
'relwork' => true,
|
||||
'commwork' => true,
|
||||
'mimework' => true,
|
||||
'db' => 'database',
|
||||
'relation' => 'rel',
|
||||
'column_info' => 'col',
|
||||
RelationParameters::REL_WORK => true,
|
||||
RelationParameters::COMM_WORK => true,
|
||||
RelationParameters::MIME_WORK => true,
|
||||
RelationParameters::DATABASE => 'database',
|
||||
RelationParameters::RELATION => 'rel',
|
||||
RelationParameters::COLUMN_INFO => 'col',
|
||||
]);
|
||||
(new ReflectionProperty(Relation::class, 'cache'))->setValue(null, $relationParameters);
|
||||
|
||||
@ -699,12 +699,12 @@ class ExportOdtTest extends AbstractTestCase
|
||||
$this->object->transformations = new Transformations($dbi, $relation);
|
||||
$this->object->buffer = '';
|
||||
$relationParameters = RelationParameters::fromArray([
|
||||
'relwork' => true,
|
||||
'commwork' => true,
|
||||
'mimework' => true,
|
||||
'db' => 'database',
|
||||
'relation' => 'rel',
|
||||
'column_info' => 'col',
|
||||
RelationParameters::REL_WORK => true,
|
||||
RelationParameters::COMM_WORK => true,
|
||||
RelationParameters::MIME_WORK => true,
|
||||
RelationParameters::DATABASE => 'database',
|
||||
RelationParameters::RELATION => 'rel',
|
||||
RelationParameters::COLUMN_INFO => 'col',
|
||||
]);
|
||||
(new ReflectionProperty(Relation::class, 'cache'))->setValue(null, $relationParameters);
|
||||
|
||||
|
||||
@ -120,11 +120,11 @@ class ExportSqlTest extends AbstractTestCase
|
||||
ExportPlugin::$singleTable = false;
|
||||
|
||||
$relationParameters = RelationParameters::fromArray([
|
||||
'db' => 'db',
|
||||
'relation' => 'relation',
|
||||
'column_info' => 'column_info',
|
||||
'relwork' => true,
|
||||
'mimework' => true,
|
||||
RelationParameters::DATABASE => 'db',
|
||||
RelationParameters::RELATION => 'relation',
|
||||
RelationParameters::COLUMN_INFO => 'column_info',
|
||||
RelationParameters::REL_WORK => true,
|
||||
RelationParameters::MIME_WORK => true,
|
||||
]);
|
||||
(new ReflectionProperty(Relation::class, 'cache'))->setValue(null, $relationParameters);
|
||||
|
||||
@ -865,12 +865,12 @@ SQL;
|
||||
public function testGetTableComments(): void
|
||||
{
|
||||
$relationParameters = RelationParameters::fromArray([
|
||||
'relwork' => true,
|
||||
'commwork' => true,
|
||||
'mimework' => true,
|
||||
'db' => 'database',
|
||||
'relation' => 'rel',
|
||||
'column_info' => 'col',
|
||||
RelationParameters::REL_WORK => true,
|
||||
RelationParameters::COMM_WORK => true,
|
||||
RelationParameters::MIME_WORK => true,
|
||||
RelationParameters::DATABASE => 'database',
|
||||
RelationParameters::RELATION => 'rel',
|
||||
RelationParameters::COLUMN_INFO => 'col',
|
||||
]);
|
||||
(new ReflectionProperty(Relation::class, 'cache'))->setValue(null, $relationParameters);
|
||||
|
||||
|
||||
@ -314,12 +314,12 @@ class ExportTexytextTest extends AbstractTestCase
|
||||
->willReturn('1');
|
||||
|
||||
$relationParameters = RelationParameters::fromArray([
|
||||
'relwork' => true,
|
||||
'commwork' => true,
|
||||
'mimework' => true,
|
||||
'db' => 'database',
|
||||
'relation' => 'rel',
|
||||
'column_info' => 'col',
|
||||
RelationParameters::REL_WORK => true,
|
||||
RelationParameters::COMM_WORK => true,
|
||||
RelationParameters::MIME_WORK => true,
|
||||
RelationParameters::DATABASE => 'database',
|
||||
RelationParameters::RELATION => 'rel',
|
||||
RelationParameters::COLUMN_INFO => 'col',
|
||||
]);
|
||||
(new ReflectionProperty(Relation::class, 'cache'))->setValue(null, $relationParameters);
|
||||
|
||||
|
||||
@ -1228,10 +1228,10 @@ class PrivilegesTest extends AbstractTestCase
|
||||
public function testGetUserGroupForUser(): void
|
||||
{
|
||||
$relationParameters = RelationParameters::fromArray([
|
||||
'db' => 'pmadb',
|
||||
'users' => 'users',
|
||||
'usergroups' => 'usergroups',
|
||||
'menuswork' => true,
|
||||
RelationParameters::DATABASE => 'pmadb',
|
||||
RelationParameters::USERS => 'users',
|
||||
RelationParameters::USER_GROUPS => 'usergroups',
|
||||
RelationParameters::MENUS_WORK => true,
|
||||
]);
|
||||
(new ReflectionProperty(Relation::class, 'cache'))->setValue(null, $relationParameters);
|
||||
|
||||
@ -1251,12 +1251,12 @@ class PrivilegesTest extends AbstractTestCase
|
||||
Config::getInstance()->selectedServer['DisableIS'] = false;
|
||||
|
||||
$relationParameters = RelationParameters::fromArray([
|
||||
'db' => 'pmadb',
|
||||
'users' => 'users',
|
||||
'usergroups' => 'usergroups',
|
||||
'menuswork' => true,
|
||||
'trackingwork' => true,
|
||||
'tracking' => 'tracking',
|
||||
RelationParameters::DATABASE => 'pmadb',
|
||||
RelationParameters::USERS => 'users',
|
||||
RelationParameters::USER_GROUPS => 'usergroups',
|
||||
RelationParameters::MENUS_WORK => true,
|
||||
RelationParameters::TRACKING_WORK => true,
|
||||
RelationParameters::TRACKING => 'tracking',
|
||||
]);
|
||||
(new ReflectionProperty(Relation::class, 'cache'))->setValue(null, $relationParameters);
|
||||
|
||||
|
||||
@ -77,12 +77,12 @@ class SqlQueryFormTest extends AbstractTestCase
|
||||
$config->settings['DefaultForeignKeyChecks'] = 'default';
|
||||
|
||||
$relationParameters = RelationParameters::fromArray([
|
||||
'table_coords' => 'table_name',
|
||||
'displaywork' => true,
|
||||
'db' => 'information_schema',
|
||||
'table_info' => 'table_info',
|
||||
'relwork' => true,
|
||||
'relation' => 'relation',
|
||||
RelationParameters::TABLE_COORDS => 'table_name',
|
||||
RelationParameters::DISPLAY_WORK => true,
|
||||
RelationParameters::DATABASE => 'information_schema',
|
||||
RelationParameters::TABLE_INFO => 'table_info',
|
||||
RelationParameters::REL_WORK => true,
|
||||
RelationParameters::RELATION => 'relation',
|
||||
]);
|
||||
(new ReflectionProperty(Relation::class, 'cache'))->setValue(null, $relationParameters);
|
||||
|
||||
|
||||
@ -52,16 +52,16 @@ class SystemDatabaseTest extends AbstractTestCase
|
||||
->willReturnCallback(static fn (string $string): string => "'" . $string . "'");
|
||||
|
||||
$relationParameters = RelationParameters::fromArray([
|
||||
'table_coords' => 'table_name',
|
||||
'displaywork' => true,
|
||||
'db' => 'information_schema',
|
||||
'table_info' => 'table_info',
|
||||
'relwork' => true,
|
||||
'commwork' => true,
|
||||
'pdfwork' => true,
|
||||
'mimework' => true,
|
||||
'column_info' => 'column_info',
|
||||
'relation' => 'relation',
|
||||
RelationParameters::TABLE_COORDS => 'table_name',
|
||||
RelationParameters::DISPLAY_WORK => true,
|
||||
RelationParameters::DATABASE => 'information_schema',
|
||||
RelationParameters::TABLE_INFO => 'table_info',
|
||||
RelationParameters::REL_WORK => true,
|
||||
RelationParameters::COMM_WORK => true,
|
||||
RelationParameters::PDF_WORK => true,
|
||||
RelationParameters::MIME_WORK => true,
|
||||
RelationParameters::COLUMN_INFO => 'column_info',
|
||||
RelationParameters::RELATION => 'relation',
|
||||
]);
|
||||
(new ReflectionProperty(Relation::class, 'cache'))->setValue(null, $relationParameters);
|
||||
|
||||
|
||||
@ -927,14 +927,20 @@ class TableTest extends AbstractTestCase
|
||||
$newFields = ['field3', 'filed4'];
|
||||
|
||||
$relationParameters = RelationParameters::fromArray([
|
||||
'db' => 'PMA_db',
|
||||
'relwork' => true,
|
||||
'relation' => 'relation',
|
||||
RelationParameters::DATABASE => 'PMA_db',
|
||||
RelationParameters::REL_WORK => true,
|
||||
RelationParameters::RELATION => 'relation',
|
||||
]);
|
||||
(new ReflectionProperty(Relation::class, 'cache'))->setValue(null, $relationParameters);
|
||||
|
||||
$object = new TableMover($this->mockedDbi, new Relation($this->mockedDbi));
|
||||
$ret = $object->duplicateInfo('relwork', 'relation', $getFields, $whereFields, $newFields);
|
||||
$ret = $object->duplicateInfo(
|
||||
RelationParameters::REL_WORK,
|
||||
RelationParameters::RELATION,
|
||||
$getFields,
|
||||
$whereFields,
|
||||
$newFields,
|
||||
);
|
||||
self::assertSame(-1, $ret);
|
||||
}
|
||||
|
||||
|
||||
@ -44,9 +44,9 @@ class TrackerTest extends AbstractTestCase
|
||||
$config->selectedServer['DisableIS'] = false;
|
||||
|
||||
$relationParameters = RelationParameters::fromArray([
|
||||
'db' => 'pmadb',
|
||||
'trackingwork' => true,
|
||||
'tracking' => 'tracking',
|
||||
RelationParameters::DATABASE => 'pmadb',
|
||||
RelationParameters::TRACKING_WORK => true,
|
||||
RelationParameters::TRACKING => 'tracking',
|
||||
]);
|
||||
(new ReflectionProperty(Relation::class, 'cache'))->setValue(null, $relationParameters);
|
||||
}
|
||||
@ -84,9 +84,9 @@ class TrackerTest extends AbstractTestCase
|
||||
);
|
||||
|
||||
$relationParameters = RelationParameters::fromArray([
|
||||
'trackingwork' => true,
|
||||
'db' => 'pmadb',
|
||||
'tracking' => 'tracking',
|
||||
RelationParameters::TRACKING_WORK => true,
|
||||
RelationParameters::DATABASE => 'pmadb',
|
||||
RelationParameters::TRACKING => 'tracking',
|
||||
]);
|
||||
(new ReflectionProperty(Relation::class, 'cache'))->setValue(null, $relationParameters);
|
||||
|
||||
@ -116,9 +116,9 @@ class TrackerTest extends AbstractTestCase
|
||||
);
|
||||
|
||||
$relationParameters = RelationParameters::fromArray([
|
||||
'trackingwork' => true,
|
||||
'db' => 'pmadb',
|
||||
'tracking' => 'tracking',
|
||||
RelationParameters::TRACKING_WORK => true,
|
||||
RelationParameters::DATABASE => 'pmadb',
|
||||
RelationParameters::TRACKING => 'tracking',
|
||||
]);
|
||||
(new ReflectionProperty(Relation::class, 'cache'))->setValue(null, $relationParameters);
|
||||
|
||||
|
||||
@ -31,9 +31,9 @@ class TrackingCheckerTest extends AbstractTestCase
|
||||
DatabaseInterface::$instance = $dbi;
|
||||
|
||||
$relationParameters = RelationParameters::fromArray([
|
||||
'db' => 'pmadb',
|
||||
'tracking' => 'tracking',
|
||||
'trackingwork' => true,
|
||||
RelationParameters::DATABASE => 'pmadb',
|
||||
RelationParameters::TRACKING => 'tracking',
|
||||
RelationParameters::TRACKING_WORK => true,
|
||||
]);
|
||||
(new ReflectionProperty(Relation::class, 'cache'))->setValue(null, $relationParameters);
|
||||
|
||||
|
||||
@ -58,9 +58,9 @@ class TrackingTest extends AbstractTestCase
|
||||
$config->selectedServer['tracking_default_statements'] = 'DELETE';
|
||||
|
||||
$relationParameters = RelationParameters::fromArray([
|
||||
'db' => 'pmadb',
|
||||
'tracking' => 'tracking',
|
||||
'trackingwork' => true,
|
||||
RelationParameters::DATABASE => 'pmadb',
|
||||
RelationParameters::TRACKING => 'tracking',
|
||||
RelationParameters::TRACKING_WORK => true,
|
||||
]);
|
||||
(new ReflectionProperty(Relation::class, 'cache'))->setValue(null, $relationParameters);
|
||||
|
||||
|
||||
@ -166,10 +166,10 @@ class TransformationsTest extends AbstractTestCase
|
||||
public function testGetMime(): void
|
||||
{
|
||||
$relationParameters = RelationParameters::fromArray([
|
||||
'db' => 'pmadb',
|
||||
'mimework' => true,
|
||||
'trackingwork' => true,
|
||||
'column_info' => 'column_info',
|
||||
RelationParameters::DATABASE => 'pmadb',
|
||||
RelationParameters::MIME_WORK => true,
|
||||
RelationParameters::TRACKING_WORK => true,
|
||||
RelationParameters::COLUMN_INFO => 'column_info',
|
||||
]);
|
||||
(new ReflectionProperty(Relation::class, 'cache'))->setValue(null, $relationParameters);
|
||||
self::assertSame(
|
||||
@ -216,9 +216,9 @@ class TransformationsTest extends AbstractTestCase
|
||||
self::assertFalse($actual);
|
||||
|
||||
$relationParameters = RelationParameters::fromArray([
|
||||
'db' => 'pmadb',
|
||||
'mimework' => true,
|
||||
'column_info' => 'column_info',
|
||||
RelationParameters::DATABASE => 'pmadb',
|
||||
RelationParameters::MIME_WORK => true,
|
||||
RelationParameters::COLUMN_INFO => 'column_info',
|
||||
]);
|
||||
(new ReflectionProperty(Relation::class, 'cache'))->setValue(null, $relationParameters);
|
||||
|
||||
|
||||
@ -92,10 +92,10 @@ class TwoFactorTest extends AbstractTestCase
|
||||
DatabaseInterface::$instance = $this->dbi;
|
||||
|
||||
$relationParameters = RelationParameters::fromArray([
|
||||
'db' => 'phpmyadmin',
|
||||
'user' => 'groot',
|
||||
'userconfigwork' => true,
|
||||
'userconfig' => 'pma__userconfig',
|
||||
RelationParameters::DATABASE => 'phpmyadmin',
|
||||
RelationParameters::USER => 'groot',
|
||||
RelationParameters::USER_CONFIG_WORK => true,
|
||||
RelationParameters::USER_CONFIG => 'pma__userconfig',
|
||||
]);
|
||||
(new ReflectionProperty(Relation::class, 'cache'))->setValue(null, $relationParameters);
|
||||
}
|
||||
|
||||
@ -90,10 +90,10 @@ class UserPreferencesTest extends AbstractTestCase
|
||||
|
||||
// case 2
|
||||
$relationParameters = RelationParameters::fromArray([
|
||||
'user' => 'user',
|
||||
'db' => "pma'db",
|
||||
'userconfig' => 'testconf',
|
||||
'userconfigwork' => true,
|
||||
RelationParameters::USER => 'user',
|
||||
RelationParameters::DATABASE => "pma'db",
|
||||
RelationParameters::USER_CONFIG => 'testconf',
|
||||
RelationParameters::USER_CONFIG_WORK => true,
|
||||
]);
|
||||
(new ReflectionProperty(Relation::class, 'cache'))->setValue(null, $relationParameters);
|
||||
|
||||
@ -163,10 +163,10 @@ class UserPreferencesTest extends AbstractTestCase
|
||||
|
||||
// case 2
|
||||
$relationParameters = RelationParameters::fromArray([
|
||||
'userconfigwork' => true,
|
||||
'db' => 'pmadb',
|
||||
'userconfig' => 'testconf',
|
||||
'user' => 'user',
|
||||
RelationParameters::USER_CONFIG_WORK => true,
|
||||
RelationParameters::DATABASE => 'pmadb',
|
||||
RelationParameters::USER_CONFIG => 'testconf',
|
||||
RelationParameters::USER => 'user',
|
||||
]);
|
||||
(new ReflectionProperty(Relation::class, 'cache'))->setValue(null, $relationParameters);
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user