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) {
|
foreach ($files as $filename => $data) {
|
||||||
$path = $dataDir . '/' . $filename;
|
$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));
|
file_put_contents($path, json_encode($data, $flags));
|
||||||
echo "✓ Luotu: $filename\n";
|
echo "✓ Kirjoitettu: $filename\n";
|
||||||
} else {
|
|
||||||
echo "⊘ Ohitettu (data olemassa): $filename\n";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Varmista companies-hakemisto
|
// Varmista companies-hakemisto
|
||||||
|
|||||||
Reference in New Issue
Block a user