Korjaa deploy_data.php - pakota datan ylikirjoitus
initUsers() luo oletusadminin ennen deploy-skriptiä, joten tiedostot eivät ole tyhjiä. Nyt ylikirjoitetaan aina. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -57,16 +57,8 @@ $files = [
|
||||
|
||||
foreach ($files as $filename => $data) {
|
||||
$path = $dataDir . '/' . $filename;
|
||||
$existing = file_exists($path) ? json_decode(file_get_contents($path), true) : null;
|
||||
|
||||
// Ylikirjoita jos tyhjä, olematon tai vain default-data
|
||||
if ($existing === null || $existing === [] || $existing === (object)[] ||
|
||||
(is_array($existing) && count($existing) === 0)) {
|
||||
file_put_contents($path, json_encode($data, $flags));
|
||||
echo "✓ Luotu: $filename\n";
|
||||
} else {
|
||||
echo "⊘ Ohitettu (data olemassa): $filename\n";
|
||||
}
|
||||
file_put_contents($path, json_encode($data, $flags));
|
||||
echo "✓ Kirjoitettu: $filename\n";
|
||||
}
|
||||
|
||||
// Varmista companies-hakemisto
|
||||
|
||||
Reference in New Issue
Block a user