update
This commit is contained in:
parent
ab2311587c
commit
9fcd228eb2
13 changed files with 398 additions and 14 deletions
|
|
@ -4,6 +4,24 @@
|
|||
// Dieses Skript verbindet sich mit einer alten Datenbank (wo der Live-Dump importiert wurde)
|
||||
// und kopiert die relevanten Daten in die neue tippspiel2027 Datenbank.
|
||||
// Tote Features wie "Spieler Ligen" und "grünes Trikot" werden ignoriert.
|
||||
// IBANs werden beim Import direkt verschlüsselt (sofern IBAN_KEY gesetzt ist),
|
||||
// damit Klartext-IBANs gar nicht erst in der neuen DB landen.
|
||||
|
||||
// Crypto-Klasse laden (funktioniert im Container und direkt auf dem Host).
|
||||
$cryptoCandidates = [
|
||||
__DIR__ . '/../tippspiel/src/Core/Crypto.php',
|
||||
__DIR__ . '/src/Core/Crypto.php',
|
||||
];
|
||||
$cryptoFile = null;
|
||||
foreach ($cryptoCandidates as $candidate) {
|
||||
if (file_exists($candidate)) {
|
||||
$cryptoFile = $candidate;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ($cryptoFile !== null) {
|
||||
require_once $cryptoFile;
|
||||
}
|
||||
|
||||
$host = getenv('DB_HOST') ?: '127.0.0.1';
|
||||
$user = getenv('DB_USER') ?: 'root';
|
||||
|
|
@ -76,6 +94,11 @@ try {
|
|||
}
|
||||
}
|
||||
|
||||
// IBAN beim Import verschlüsseln (ohne IBAN_KEY bleibt sie Klartext)
|
||||
if ($table === 'users' && $cryptoFile !== null && !empty($filteredRow['iban'])) {
|
||||
$filteredRow['iban'] = \App\Core\Crypto::encrypt((string)$filteredRow['iban']);
|
||||
}
|
||||
|
||||
if (!empty($filteredRow)) {
|
||||
$cols = '`' . implode('`, `', array_keys($filteredRow)) . '`';
|
||||
$vals = implode(', ', array_fill(0, count($filteredRow), '?'));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue