Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display a warning if there are outstanding database updates #838

Draft
wants to merge 1 commit into
base: 3.x
Choose a base branch
from

Conversation

mstenta
Copy link
Member

@mstenta mstenta commented May 2, 2024

This adds a warning message that is displayed on every page if/when there are outstanding database updates that need to be run.

We've seen in the community forum/chat that sometimes people who are self-hosting don't know that they need to run database updates and rebuild the cache. This is dangerous because it means they could be running code that is not compatible with their database/configuration. This warning serves as a simple safety check to help prevent that.

Notably, this copies the logic and message text directly from the Drupal core system module's hook_requirements(), which shows a message on the admin status report page. All we are doing here is showing that same message on all pages, so it can't be missed.

mstenta added a commit to mstenta/farmOS that referenced this pull request May 2, 2024
@mstenta mstenta marked this pull request as ready for review May 2, 2024 17:05
@pcambra
Copy link
Collaborator

pcambra commented May 3, 2024

IMHO rather than doing the whole update check on every request, we could use cron to update a state, or at least restrict running this once an hour?

@mstenta
Copy link
Member Author

mstenta commented May 6, 2024

@pcambra +1 to making this less "heavy" :-)

Thinking... a cron job that updates a state variable seems like the right way to do it. But I worry that the same users who are most likely not running update.php also have not set up cron, so that might miss the target audience of this PR.

or at least restrict running this once an hour?

Perhaps this is the next-best option, and will ensure that the people who need to see it will.

The only downside, obviously, is that someone may end up running updated code for up to an hour before realizing they need to update their database. Depending on the updates, this could be more/less dangerous... but I suppose anything is better than nothing. 🤷

@mstenta mstenta marked this pull request as draft May 6, 2024 10:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants