class Admin::MaintenanceController < ApplicationController
def reindex
confirm = params[:confirm].to_s
unless confirm == 'REINDEX'
redirect_to admin_root_path, alert: 'Type REINDEX to confirm.'
return
end
Rails.logger.info({ msg: 'admin.reindex_requested', actor_id: current_member.id, request_id: request.request_id }.to_json)
Search::ReindexAllJob.perform_later
redirect_to admin_root_path, notice: 'Reindex enqueued.'
end
end
Admin actions are production sharp edges. Require a typed confirmation string, log actor + request_id, and run the dangerous work in a background job. This reduces accidental incidents.