Repository navigation
Commit 26f7ba6
committed
Write the config before the account, so a reinstall onto live data works
install() created the Super Admin account and only then wrote config.php.
That breaks the one case this file is now most often opened for: a
database that still holds every booking and account, and a config.php
that a deploy erased.
In that state create_user() fails on the duplicate email, install()
returns early, and write_config() never runs -- so the panel is still
unconfigured, still shows "not set up yet", and the installer sends you
round the same loop with no way out. The data was never at risk, but
there was no route back in.
Now the config is written as soon as the database details are known to
work, and an account count decides what happens next: rows already there
means this is a reconnection rather than an installation, so no second
Super Admin is made and the last screen says to sign in with the existing
one. An empty database still gets the account it asked for, and if
creating it fails the message says the settings were saved and a reload
should let you in -- because by then it is true.
Verified by extracting the call order from the parsed function with
comments stripped: db_connect, migrate, write_config, the account count,
create_user, with the only early return between the write and the account
being the write failing itself. Checking it by eye first gave the wrong
answer -- the regex matched the words create_user() and write_config() in
the comment explaining the bug.
The full path could not be run here: this sandbox has no MySQL server, so
the installer's last four UI tests cannot pass and the reconnect branch
is unexercised against a live database.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0128YzbhrfGdegUSc9RrARRf1 parent b2c4a4d commit 26f7ba6
1 file changed
Lines changed: 46 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
170 | 170 | | |
171 | 171 | | |
172 | 172 | | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
173 | 204 | | |
174 | 205 | | |
175 | 206 | | |
176 | 207 | | |
177 | 208 | | |
178 | | - | |
179 | | - | |
180 | | - | |
181 | | - | |
182 | | - | |
183 | | - | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
184 | 213 | | |
185 | 214 | | |
186 | 215 | | |
| |||
306 | 335 | | |
307 | 336 | | |
308 | 337 | | |
309 | | - | |
310 | | - | |
311 | | - | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
312 | 344 | | |
313 | 345 | | |
314 | | - | |
315 | | - | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
316 | 351 | | |
317 | 352 | | |
318 | 353 | | |
| |||
0 commit comments