Skip to content

Commit a8d514a

Browse files
committed
Remove db and table globals from DbTableExists class
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
1 parent b3104df commit a8d514a

23 files changed

Lines changed: 79 additions & 88 deletions

libraries/classes/Controllers/Database/RoutinesController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public function __invoke(): void
6262
$errorUrl = Util::getScriptNameForOption($cfg['DefaultTabTable'], 'table');
6363
$errorUrl .= Url::getCommon($urlParams, '&');
6464

65-
DbTableExists::check();
65+
DbTableExists::check($db, $table);
6666
} else {
6767
$table = '';
6868

libraries/classes/Controllers/Database/TriggersController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public function __invoke(): void
4848
$errorUrl = Util::getScriptNameForOption($cfg['DefaultTabTable'], 'table');
4949
$errorUrl .= Url::getCommon($urlParams, '&');
5050

51-
DbTableExists::check();
51+
DbTableExists::check($db, $table);
5252
} else {
5353
$table = '';
5454

libraries/classes/Controllers/Table/AddFieldController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ public function __invoke(): void
173173
$errorUrl = Util::getScriptNameForOption($cfg['DefaultTabTable'], 'table');
174174
$errorUrl .= Url::getCommon($url_params, '&');
175175

176-
DbTableExists::check();
176+
DbTableExists::check($db, $table);
177177

178178
$active_page = Url::getFromRoute('/table/structure');
179179
/**

libraries/classes/Controllers/Table/ChangeController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public function __invoke(): void
5858
$this->response->addHTML($pageSettings->getErrorHTML());
5959
$this->response->addHTML($pageSettings->getHTML());
6060

61-
DbTableExists::check();
61+
DbTableExists::check($db, $table);
6262

6363
/**
6464
* Determine whether Insert or Edit and set global variables

libraries/classes/Controllers/Table/ChartController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public function __invoke(): void
9090
$errorUrl = Util::getScriptNameForOption($cfg['DefaultTabTable'], 'table');
9191
$errorUrl .= Url::getCommon($url_params, '&');
9292

93-
DbTableExists::check();
93+
DbTableExists::check($db, $table);
9494

9595
$url_params['goto'] = Util::getScriptNameForOption($cfg['DefaultTabTable'], 'table');
9696
$url_params['back'] = Url::getFromRoute('/table/sql');
@@ -179,7 +179,7 @@ public function ajax(): void
179179
$errorUrl = Util::getScriptNameForOption($cfg['DefaultTabTable'], 'table');
180180
$errorUrl .= Url::getCommon($urlParams, '&');
181181

182-
DbTableExists::check();
182+
DbTableExists::check($db, $table);
183183
}
184184

185185
$parser = new Parser($sql_query);

libraries/classes/Controllers/Table/DeleteConfirmController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public function __invoke(): void
3333
$errorUrl = Util::getScriptNameForOption($cfg['DefaultTabTable'], 'table');
3434
$errorUrl .= Url::getCommon($urlParams, '&');
3535

36-
DbTableExists::check();
36+
DbTableExists::check($db, $table);
3737

3838
$this->render('table/delete/confirm', [
3939
'db' => $db,

libraries/classes/Controllers/Table/DropColumnConfirmationController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ final class DropColumnConfirmationController extends AbstractController
1414
{
1515
public function __invoke(): void
1616
{
17-
global $urlParams, $errorUrl, $cfg;
17+
global $db, $table, $urlParams, $errorUrl, $cfg;
1818

1919
$selected = $_POST['selected_fld'] ?? null;
2020

@@ -31,7 +31,7 @@ public function __invoke(): void
3131
$errorUrl = Util::getScriptNameForOption($cfg['DefaultTabTable'], 'table');
3232
$errorUrl .= Url::getCommon($urlParams, '&');
3333

34-
DbTableExists::check();
34+
DbTableExists::check($db, $table);
3535

3636
$this->render('table/structure/drop_confirm', [
3737
'db' => $this->db,

libraries/classes/Controllers/Table/FindReplaceController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public function __invoke(): void
6969
$errorUrl = Util::getScriptNameForOption($cfg['DefaultTabTable'], 'table');
7070
$errorUrl .= Url::getCommon($urlParams, '&');
7171

72-
DbTableExists::check();
72+
DbTableExists::check($db, $table);
7373

7474
if (isset($_POST['find'])) {
7575
$this->findAction();

libraries/classes/Controllers/Table/ImportController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public function __invoke(): void
5555
$errorUrl = Util::getScriptNameForOption($cfg['DefaultTabTable'], 'table');
5656
$errorUrl .= Url::getCommon($urlParams, '&');
5757

58-
DbTableExists::check();
58+
DbTableExists::check($db, $table);
5959

6060
$urlParams['goto'] = Url::getFromRoute('/table/import');
6161
$urlParams['back'] = Url::getFromRoute('/table/import');

libraries/classes/Controllers/Table/IndexRenameController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public function __invoke(): void
4747
$errorUrl = Util::getScriptNameForOption($cfg['DefaultTabTable'], 'table');
4848
$errorUrl .= Url::getCommon($urlParams, '&');
4949

50-
DbTableExists::check();
50+
DbTableExists::check($db, $table);
5151
}
5252

5353
if (isset($_POST['index'])) {

0 commit comments

Comments
 (0)