up
This commit is contained in:
@@ -32,6 +32,7 @@ $bridgeConfig = [
|
||||
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
|
||||
],
|
||||
],
|
||||
'tables_allow' => [], // optional whitelist: ['customers', 'orders']
|
||||
];
|
||||
|
||||
$localOverride = __DIR__ . '/emailtemplate.bridge.conf.php';
|
||||
@@ -115,13 +116,24 @@ try {
|
||||
$dbName = $m[1];
|
||||
}
|
||||
|
||||
$tablesStmt = $pdo->query('SHOW FULL TABLES');
|
||||
$tables = [];
|
||||
while ($row = $tablesStmt->fetch(PDO::FETCH_NUM)) {
|
||||
$tableName = $row[0];
|
||||
if ($tableName === null) {
|
||||
continue;
|
||||
$tablesStmt = $pdo->query('SHOW FULL TABLES');
|
||||
$tables = [];
|
||||
$whitelist = [];
|
||||
if (!empty($bridgeConfig['tables_allow']) && is_array($bridgeConfig['tables_allow'])) {
|
||||
foreach ($bridgeConfig['tables_allow'] as $tbl) {
|
||||
if (is_string($tbl) && $tbl !== '') {
|
||||
$whitelist[strtolower($tbl)] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
while ($row = $tablesStmt->fetch(PDO::FETCH_NUM)) {
|
||||
$tableName = $row[0];
|
||||
if ($tableName === null) {
|
||||
continue;
|
||||
}
|
||||
if ($whitelist && empty($whitelist[strtolower($tableName)])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$columnsStmt = $pdo->prepare(
|
||||
'SELECT COLUMN_NAME, DATA_TYPE, IS_NULLABLE, COLUMN_DEFAULT, COLUMN_KEY, EXTRA
|
||||
|
||||
Reference in New Issue
Block a user