But what does
discourse enable_readonly do?
It uses READONLY_MODE_KEY, which sets that ttl to 60, so it turns back off at some point. Now I see that
Is there some reason that this is the default behavior for this command? It’s taken me nearly a decade to learn that this command is totally different from the web interface readonly mode even after being burned a bunch of times. And I now remember that someone tried to tell me about these keys once and I failed to understand their significance.
IMHO a much more sane thing for discourse enable_readonly to do would be to do a Discourse.enable_readonly_mode(Discourse::STAFF_WRITES_ONLY_MODE_KEY). I wish I’d noticed that many years ago!
Could I submit a PR something like this:
desc "enable_readonly", "Enable the readonly mode, allowing staff writes"
def staff_writes_only
load_rails
Discourse.enable_readonly_mode(Discourse::STAFF_WRITES_ONLY_MODE_KEY)
puts 'The site is now in readonly mode with staff writes permitted.'
end