Skip to content

Commit 97aac39

Browse files
committed
Remove the sub_part global variable
It's only used inside Util::getDbInfo() for pagination when not exporting. Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
1 parent 4405b8a commit 97aac39

19 files changed

Lines changed: 51 additions & 131 deletions

libraries/classes/Controllers/Database/DesignerController.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ public function __invoke(ServerRequest $request): void
5555
$GLOBALS['tables'] = $GLOBALS['tables'] ?? null;
5656
$GLOBALS['num_tables'] = $GLOBALS['num_tables'] ?? null;
5757
$GLOBALS['total_num_tables'] = $GLOBALS['total_num_tables'] ?? null;
58-
$GLOBALS['sub_part'] = $GLOBALS['sub_part'] ?? null;
5958
$GLOBALS['tooltip_truename'] = $GLOBALS['tooltip_truename'] ?? null;
6059
$GLOBALS['tooltip_aliasname'] = $GLOBALS['tooltip_aliasname'] ?? null;
6160
$GLOBALS['pos'] = $GLOBALS['pos'] ?? null;
@@ -239,12 +238,11 @@ public function __invoke(ServerRequest $request): void
239238
[
240239
$GLOBALS['tables'],
241240
$GLOBALS['num_tables'],
242-
$GLOBALS['total_num_tables'],
243-
$GLOBALS['sub_part'],,,
241+
$GLOBALS['total_num_tables'],,,
244242
$GLOBALS['tooltip_truename'],
245243
$GLOBALS['tooltip_aliasname'],
246244
$GLOBALS['pos'],
247-
] = Util::getDbInfo($GLOBALS['db'], $GLOBALS['sub_part'] ?? '');
245+
] = Util::getDbInfo($GLOBALS['db']);
248246

249247
// Embed some data into HTML, later it will be read
250248
// by designer/init.js and converted to JS variables.

libraries/classes/Controllers/Database/EventsController.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ public function __invoke(ServerRequest $request): void
3939
$GLOBALS['tables'] = $GLOBALS['tables'] ?? null;
4040
$GLOBALS['num_tables'] = $GLOBALS['num_tables'] ?? null;
4141
$GLOBALS['total_num_tables'] = $GLOBALS['total_num_tables'] ?? null;
42-
$GLOBALS['sub_part'] = $GLOBALS['sub_part'] ?? null;
4342
$GLOBALS['errors'] = $GLOBALS['errors'] ?? null;
4443
$GLOBALS['text_dir'] = $GLOBALS['text_dir'] ?? null;
4544
$GLOBALS['tooltip_truename'] = $GLOBALS['tooltip_truename'] ?? null;
@@ -62,12 +61,11 @@ public function __invoke(ServerRequest $request): void
6261
[
6362
$GLOBALS['tables'],
6463
$GLOBALS['num_tables'],
65-
$GLOBALS['total_num_tables'],
66-
$GLOBALS['sub_part'],,,
64+
$GLOBALS['total_num_tables'],,,
6765
$GLOBALS['tooltip_truename'],
6866
$GLOBALS['tooltip_aliasname'],
6967
$GLOBALS['pos'],
70-
] = Util::getDbInfo($GLOBALS['db'], $GLOBALS['sub_part'] ?? '');
68+
] = Util::getDbInfo($GLOBALS['db']);
7169
} elseif (strlen($GLOBALS['db']) > 0) {
7270
$this->dbi->selectDb($GLOBALS['db']);
7371
}

libraries/classes/Controllers/Database/ExportController.php

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ public function __construct(
4141

4242
public function __invoke(ServerRequest $request): void
4343
{
44-
$GLOBALS['sub_part'] = $GLOBALS['sub_part'] ?? null;
4544
$GLOBALS['urlParams'] = $GLOBALS['urlParams'] ?? null;
4645
$GLOBALS['tables'] = $GLOBALS['tables'] ?? null;
4746
$GLOBALS['num_tables'] = $GLOBALS['num_tables'] ?? null;
@@ -59,10 +58,6 @@ public function __invoke(ServerRequest $request): void
5958

6059
$this->addScriptFiles(['export.js']);
6160

62-
// $sub_part is used in Util::getDbInfo() to see if we are coming from
63-
// /database/export, in which case we don't obey $cfg['MaxTableList']
64-
$GLOBALS['sub_part'] = '_export';
65-
6661
$this->checkParameters(['db']);
6762

6863
$GLOBALS['errorUrl'] = Util::getScriptNameForOption($GLOBALS['cfg']['DefaultTabDatabase'], 'database');
@@ -77,12 +72,11 @@ public function __invoke(ServerRequest $request): void
7772
[
7873
$GLOBALS['tables'],
7974
$GLOBALS['num_tables'],
80-
$GLOBALS['total_num_tables'],
81-
$GLOBALS['sub_part'],,,
75+
$GLOBALS['total_num_tables'],,,
8276
$GLOBALS['tooltip_truename'],
8377
$GLOBALS['tooltip_aliasname'],
8478
$GLOBALS['pos'],
85-
] = Util::getDbInfo($GLOBALS['db'], $GLOBALS['sub_part']);
79+
] = Util::getDbInfo($GLOBALS['db'], false);
8680

8781
// exit if no tables in db found
8882
if ($GLOBALS['num_tables'] < 1) {

libraries/classes/Controllers/Database/ImportController.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ public function __invoke(ServerRequest $request): void
4343
$GLOBALS['tooltip_truename'] = $GLOBALS['tooltip_truename'] ?? null;
4444
$GLOBALS['tooltip_aliasname'] = $GLOBALS['tooltip_aliasname'] ?? null;
4545
$GLOBALS['pos'] = $GLOBALS['pos'] ?? null;
46-
$GLOBALS['sub_part'] = $GLOBALS['sub_part'] ?? null;
4746
$GLOBALS['SESSION_KEY'] = $GLOBALS['SESSION_KEY'] ?? null;
4847
$GLOBALS['errorUrl'] = $GLOBALS['errorUrl'] ?? null;
4948

@@ -65,12 +64,11 @@ public function __invoke(ServerRequest $request): void
6564
[
6665
$GLOBALS['tables'],
6766
$GLOBALS['num_tables'],
68-
$GLOBALS['total_num_tables'],
69-
$GLOBALS['sub_part'],,,
67+
$GLOBALS['total_num_tables'],,,
7068
$GLOBALS['tooltip_truename'],
7169
$GLOBALS['tooltip_aliasname'],
7270
$GLOBALS['pos'],
73-
] = Util::getDbInfo($GLOBALS['db'], $GLOBALS['sub_part'] ?? '');
71+
] = Util::getDbInfo($GLOBALS['db']);
7472

7573
[$GLOBALS['SESSION_KEY'], $uploadId] = Ajax::uploadProgressSetup();
7674

libraries/classes/Controllers/Database/Operations/CollationController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public function __invoke(ServerRequest $request): void
6969
* Changes tables charset if requested by the user
7070
*/
7171
if ($request->getParsedBodyParam('change_all_tables_collations') === 'on') {
72-
[$tables] = Util::getDbInfo($GLOBALS['db'], '');
72+
[$tables] = Util::getDbInfo($GLOBALS['db']);
7373
foreach ($tables as ['Name' => $tableName]) {
7474
if ($this->dbi->getTable($GLOBALS['db'], $tableName)->isView()) {
7575
// Skip views, we can not change the collation of a view.

libraries/classes/Controllers/Database/OperationsController.php

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ public function __invoke(ServerRequest $request): void
8080
$GLOBALS['urlParams'] = $GLOBALS['urlParams'] ?? null;
8181
$GLOBALS['tables'] = $GLOBALS['tables'] ?? null;
8282
$GLOBALS['total_num_tables'] = $GLOBALS['total_num_tables'] ?? null;
83-
$GLOBALS['sub_part'] = $GLOBALS['sub_part'] ?? null;
8483
$GLOBALS['tooltip_truename'] = $GLOBALS['tooltip_truename'] ?? null;
8584
$GLOBALS['db_collation'] = $GLOBALS['db_collation'] ?? null;
8685
$GLOBALS['tooltip_aliasname'] = $GLOBALS['tooltip_aliasname'] ?? null;
@@ -286,19 +285,15 @@ public function __invoke(ServerRequest $request): void
286285

287286
$GLOBALS['urlParams']['goto'] = Url::getFromRoute('/database/operations');
288287

289-
// Gets the database structure
290-
$GLOBALS['sub_part'] = '_structure';
291-
292288
[
293289
$GLOBALS['tables'],
294290
$GLOBALS['num_tables'],
295-
$GLOBALS['total_num_tables'],
296-
$GLOBALS['sub_part'],,
291+
$GLOBALS['total_num_tables'],,
297292
$isSystemSchema,
298293
$GLOBALS['tooltip_truename'],
299294
$GLOBALS['tooltip_aliasname'],
300295
$GLOBALS['pos'],
301-
] = Util::getDbInfo($GLOBALS['db'], $GLOBALS['sub_part']);
296+
] = Util::getDbInfo($GLOBALS['db']);
302297

303298
$oldMessage = '';
304299
if (isset($GLOBALS['message'])) {

libraries/classes/Controllers/Database/PrivilegesController.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,19 +89,16 @@ public function __invoke(ServerRequest $request): void
8989
)->getDisplay());
9090
}
9191

92-
// Gets the database structure
93-
$GLOBALS['sub_part'] = '_structure';
9492
ob_start();
9593

9694
[
9795
$GLOBALS['tables'],
9896
$GLOBALS['num_tables'],
99-
$GLOBALS['total_num_tables'],
100-
$GLOBALS['sub_part'],,,
97+
$GLOBALS['total_num_tables'],,,
10198
$GLOBALS['tooltip_truename'],
10299
$GLOBALS['tooltip_aliasname'],
103100
$GLOBALS['pos'],
104-
] = Util::getDbInfo($db->getName(), $GLOBALS['sub_part']);
101+
] = Util::getDbInfo($db->getName());
105102

106103
$content = ob_get_clean();
107104
$this->response->addHTML($content . "\n");

libraries/classes/Controllers/Database/QueryByExampleController.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ public function __invoke(ServerRequest $request): void
4646
$GLOBALS['savedSearch'] = $GLOBALS['savedSearch'] ?? null;
4747
$GLOBALS['currentSearchId'] = $GLOBALS['currentSearchId'] ?? null;
4848
$GLOBALS['goto'] = $GLOBALS['goto'] ?? null;
49-
$GLOBALS['sub_part'] = $GLOBALS['sub_part'] ?? null;
5049
$GLOBALS['tables'] = $GLOBALS['tables'] ?? null;
5150
$GLOBALS['num_tables'] = $GLOBALS['num_tables'] ?? null;
5251
$GLOBALS['total_num_tables'] = $GLOBALS['total_num_tables'] ?? null;
@@ -145,8 +144,6 @@ public function __invoke(ServerRequest $request): void
145144
}
146145
}
147146

148-
$GLOBALS['sub_part'] = '_qbe';
149-
150147
$this->checkParameters(['db']);
151148

152149
$GLOBALS['errorUrl'] = Util::getScriptNameForOption($GLOBALS['cfg']['DefaultTabDatabase'], 'database');
@@ -161,12 +158,11 @@ public function __invoke(ServerRequest $request): void
161158
[
162159
$GLOBALS['tables'],
163160
$GLOBALS['num_tables'],
164-
$GLOBALS['total_num_tables'],
165-
$GLOBALS['sub_part'],,,
161+
$GLOBALS['total_num_tables'],,,
166162
$GLOBALS['tooltip_truename'],
167163
$GLOBALS['tooltip_aliasname'],
168164
$GLOBALS['pos'],
169-
] = Util::getDbInfo($GLOBALS['db'], $GLOBALS['sub_part']);
165+
] = Util::getDbInfo($GLOBALS['db']);
170166

171167
$databaseQbe = new Qbe(
172168
$this->relation,

libraries/classes/Controllers/Database/RoutinesController.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ public function __invoke(ServerRequest $request): void
5050
$GLOBALS['tables'] = $GLOBALS['tables'] ?? null;
5151
$GLOBALS['num_tables'] = $GLOBALS['num_tables'] ?? null;
5252
$GLOBALS['total_num_tables'] = $GLOBALS['total_num_tables'] ?? null;
53-
$GLOBALS['sub_part'] = $GLOBALS['sub_part'] ?? null;
5453
$GLOBALS['tooltip_truename'] = $GLOBALS['tooltip_truename'] ?? null;
5554
$GLOBALS['tooltip_aliasname'] = $GLOBALS['tooltip_aliasname'] ?? null;
5655
$GLOBALS['pos'] = $GLOBALS['pos'] ?? null;
@@ -91,12 +90,11 @@ public function __invoke(ServerRequest $request): void
9190
[
9291
$GLOBALS['tables'],
9392
$GLOBALS['num_tables'],
94-
$GLOBALS['total_num_tables'],
95-
$GLOBALS['sub_part'],,,
93+
$GLOBALS['total_num_tables'],,,
9694
$GLOBALS['tooltip_truename'],
9795
$GLOBALS['tooltip_aliasname'],
9896
$GLOBALS['pos'],
99-
] = Util::getDbInfo($GLOBALS['db'], $GLOBALS['sub_part'] ?? '');
97+
] = Util::getDbInfo($GLOBALS['db']);
10098
}
10199
} elseif (strlen($GLOBALS['db']) > 0) {
102100
$this->dbi->selectDb($GLOBALS['db']);

libraries/classes/Controllers/Database/SearchController.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ public function __invoke(ServerRequest $request): void
3434
$GLOBALS['tables'] = $GLOBALS['tables'] ?? null;
3535
$GLOBALS['num_tables'] = $GLOBALS['num_tables'] ?? null;
3636
$GLOBALS['total_num_tables'] = $GLOBALS['total_num_tables'] ?? null;
37-
$GLOBALS['sub_part'] = $GLOBALS['sub_part'] ?? null;
3837
$GLOBALS['tooltip_truename'] = $GLOBALS['tooltip_truename'] ?? null;
3938
$GLOBALS['tooltip_aliasname'] = $GLOBALS['tooltip_aliasname'] ?? null;
4039
$GLOBALS['pos'] = $GLOBALS['pos'] ?? null;
@@ -70,12 +69,11 @@ public function __invoke(ServerRequest $request): void
7069
[
7170
$GLOBALS['tables'],
7271
$GLOBALS['num_tables'],
73-
$GLOBALS['total_num_tables'],
74-
$GLOBALS['sub_part'],,,
72+
$GLOBALS['total_num_tables'],,,
7573
$GLOBALS['tooltip_truename'],
7674
$GLOBALS['tooltip_aliasname'],
7775
$GLOBALS['pos'],
78-
] = Util::getDbInfo($GLOBALS['db'], $GLOBALS['sub_part'] ?? '');
76+
] = Util::getDbInfo($GLOBALS['db']);
7977
}
8078

8179
// Main search form has been submitted, get results

0 commit comments

Comments
 (0)