FIX: Turn off search logging when read-only (#7877)

If `SiteSetting.log_search_queries` is enabled 500 errors will occur
when searching if the master db is down. This fix allows searching to
still work under these conditions.
This commit is contained in:
Blake Erickson 2019-07-10 18:05:31 -06:00 committed by Jeff Atwood
parent a49aa895d6
commit c76732722a
1 changed files with 1 additions and 1 deletions

View File

@ -213,7 +213,7 @@ class Search
# Query a term
def execute
if SiteSetting.log_search_queries? && @opts[:search_type].present?
if SiteSetting.log_search_queries? && @opts[:search_type].present? && !Discourse.readonly_mode?
status, search_log_id = SearchLog.log(
term: @term,
search_type: @opts[:search_type],