asdasd
This commit is contained in:
@@ -1895,6 +1895,7 @@ class ApiKernel
|
||||
$this->respond([
|
||||
'ok' => true,
|
||||
'tables' => $schema['tables'] ?? [],
|
||||
'setup_hint' => $schema['setup_hint'] ?? null,
|
||||
'fetched' => $schema['fetched'] ?? date(DATE_ATOM),
|
||||
]);
|
||||
}
|
||||
@@ -1933,7 +1934,11 @@ class ApiKernel
|
||||
private function getBridgeSetupData(int $customerId): array
|
||||
{
|
||||
$settings = $this->getCustomerSettings($customerId);
|
||||
return $settings['bridge_setup'] ?? $this->defaultBridgeSetup();
|
||||
$setup = $settings['bridge_setup'] ?? $this->defaultBridgeSetup();
|
||||
if ((!$setup['tables'] || !count($setup['tables'])) && !empty($settings['bridge_tables'])) {
|
||||
$setup['tables'] = $this->normalizeBridgeTables($settings['bridge_tables']);
|
||||
}
|
||||
return $setup;
|
||||
}
|
||||
|
||||
private function saveCustomerSettings(int $customerId, array $data): array
|
||||
@@ -2555,6 +2560,15 @@ SQL;
|
||||
$content = preg_replace("/'pass'\\s*=>\\s*'[^']*',/", "'pass' => {$passValue},", $content, 1);
|
||||
}
|
||||
|
||||
$setupHint = [
|
||||
'mode' => $setup['mode'] ?? 'direct',
|
||||
'tables' => $tables,
|
||||
'direct' => $setup['direct'] ?? [],
|
||||
'config' => $setup['config'] ?? [],
|
||||
];
|
||||
$setupExport = $this->exportPhpValue($setupHint);
|
||||
$content = str_replace("'setup_hint' => '__SETUP_HINT__',", "'setup_hint' => {$setupExport},", $content);
|
||||
|
||||
$snippet = $this->buildBridgeSetupSnippet($setup);
|
||||
if (strpos($content, '// {{BRIDGE_DB_SETUP}}') !== false) {
|
||||
$content = str_replace('// {{BRIDGE_DB_SETUP}}', $snippet, $content);
|
||||
@@ -2708,6 +2722,11 @@ SQL;
|
||||
return '[' . implode(', ', $escaped) . ']';
|
||||
}
|
||||
|
||||
private function exportPhpValue($value): string
|
||||
{
|
||||
return var_export($value, true);
|
||||
}
|
||||
|
||||
private function bridgeDownloadTemplate(): string
|
||||
{
|
||||
return <<<'PHP'
|
||||
|
||||
Reference in New Issue
Block a user