Skip to content

Ensure that we display an appropriate error message for when there is .maintenance file#3948

Merged
katinthehatsite merged 11 commits into
trunkfrom
fix/stuck-lock-file
Jul 7, 2026
Merged

Ensure that we display an appropriate error message for when there is .maintenance file#3948
katinthehatsite merged 11 commits into
trunkfrom
fix/stuck-lock-file

Conversation

@katinthehatsite

@katinthehatsite katinthehatsite commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Related issues

Fixes STU-1847

How AI was used in this PR

It was used to implement the solution.

Proposed Changes

This PR ensures that when there is a .maintenance file and a fresh lock, the appropriate message is displayed to the user if they try to stop and start the site. It detects the lock that is fresher than 10 minutes and after 10 minutes, WordPress will ignore the stale lock file.

Testing Instructions

  • Pull the changes from this branch and start Studio with npm start
  • Create a site (or use an existing one) and start it
  • Test fresh lock — create a .maintenance file with a recent timestamp by running in your Terminal the following (make sure to replace with the name of your site):
  echo '<?php $upgrading = '$(date +%s)'; ?>' > ~/Studio/<your-site-name>/.maintenance
  • Stop the site in Studio, then try to start it. You should see a message saying WordPress is in maintenance
    mode and the lock will expire within 10 minutes:
Screenshot 2026-06-25 at 12 03 28 PM
  • Test no lock — delete the file:
    rm ~/Studio/<your-site-name>/.maintenance
  • Start should work normally.

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?

@katinthehatsite katinthehatsite self-assigned this Jun 24, 2026
@katinthehatsite katinthehatsite marked this pull request as draft June 24, 2026 14:34
@wpmobilebot

wpmobilebot commented Jun 24, 2026

Copy link
Copy Markdown
Collaborator

📊 Performance Test Results

Comparing 9e71055 vs trunk

app-size

Metric trunk 9e71055 Diff Change
App Size (Mac) 1411.96 MB 1411.97 MB +0.01 MB ⚪ 0.0%

site-editor

Metric trunk 9e71055 Diff Change
load 1088 ms 1072 ms 16 ms ⚪ 0.0%

site-startup

Metric trunk 9e71055 Diff Change
siteCreation 6532 ms 6514 ms 18 ms ⚪ 0.0%
siteStartup 2393 ms 2385 ms 8 ms ⚪ 0.0%

Results are median values from multiple test runs.

Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change (<50ms diff)

@katinthehatsite katinthehatsite changed the title Ensure lock files get detected after 10 minutes Ensure that we display an appropriate error message for when there is .maintenance file Jun 25, 2026
@katinthehatsite

Copy link
Copy Markdown
Contributor Author

This is the behaviour compared to trunk:

Screenshot 2026-06-25 at 2 16 25 PM

@katinthehatsite katinthehatsite marked this pull request as ready for review June 25, 2026 12:16
@katinthehatsite katinthehatsite requested a review from a team July 3, 2026 09:01

@bcotrim bcotrim left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest moving the checkMaintenanceFile to the CLI so it covers the app, cli and agent workflows.
The app can still catch the error to display the correct Maintenance file error message.
What do you think?

@katinthehatsite katinthehatsite requested a review from bcotrim July 3, 2026 14:32
@katinthehatsite

Copy link
Copy Markdown
Contributor Author

Thanks for the review @bcotrim - I applied your suggestion!

Comment thread apps/studio/src/hooks/use-site-details.tsx Outdated
Comment thread apps/studio/src/hooks/use-site-details.tsx Outdated

@gavande1 gavande1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for addressing the concerns. I tested this, and it looks good to me. ✅

@katinthehatsite

Copy link
Copy Markdown
Contributor Author

Thanks for the review @gavande1 🙇

@katinthehatsite katinthehatsite merged commit 5a8170b into trunk Jul 7, 2026
11 checks passed
@katinthehatsite katinthehatsite deleted the fix/stuck-lock-file branch July 7, 2026 14:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants