Check for .env file instead of users table#2199
Conversation
|
Warning Rate limit exceeded
To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughThe installer's already-installed detection gate was refactored from checking database state (users table presence and user count) to checking configuration state ( Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Review rate limit: 0/1 reviews remaining, refill in 45 minutes and 26 seconds.Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@app/Http/Controllers/System/InstallerController.php`:
- Around line 225-227: The current check if (file_exists(base_path('.env'))) in
InstallerController prevents dbsetup() from running right after envsetup();
remove or replace this gate so dbsetup() is not blocked by the just-created
.env. Specifically, update the InstallerController method that returns
view('system.installer.errors.already-installed') to stop using
file_exists(base_path('.env')) as the sentinel; instead use a separate marker
(e.g., a dedicated installed flag in .env like APP_INSTALLED, a database/lock
file, or a storage/install.lock) and have dbsetup() proceed when only .env
exists but the installed marker is absent. Ensure references to dbsetup() and
envsetup() remain intact and that the new sentinel check prevents real re-entry
after full install without blocking the immediate redirect from envsetup().
- Around line 164-166: The envsetup() method declares a RedirectResponse return
type but returns a View when .env exists (view
'system.installer.errors.already-installed'), causing a type error; fix by
making the method's declared return type compatible with both responses (e.g.,
change signature to return
Illuminate\Http\Response|Illuminate\Http\RedirectResponse or Symfony Response
union) or change the early-exit to return a RedirectResponse instead (redirect
to an appropriate route) so the actual return type matches the method signature;
update the signature for envsetup() and ensure imports for the chosen Response
class are present.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 415920c7-dc33-4319-9b30-e5ae2fa3aa5e
📒 Files selected for processing (1)
app/Http/Controllers/System/InstallerController.php
|
This is what happens when I just copy and paste blindy. Thanks for the fix |
closes #2198
Summary by CodeRabbit