lib/railties/blacklight.rake in blacklight-6.18.0 vs lib/railties/blacklight.rake in blacklight-6.19.0

- old
+ new

@@ -1,14 +1,14 @@ namespace :blacklight do # task to clean out old, unsaved searches # rake blacklight:delete_old_searches[days_old] - # example cron entry to delete searches older than 7 days at 2:00 AM every day: + # example cron entry to delete searches older than 7 days at 2:00 AM every day: # 0 2 * * * cd /path/to/your/app && /path/to/rake blacklight:delete_old_searches[7] RAILS_ENV=your_env desc "Removes entries in the searches table that are older than the number of days given." task :delete_old_searches, [:days_old] => [:environment] do |t, args| - args.with_defaults(:days_old => 7) + args.with_defaults(:days_old => 7) Search.delete_old_searches(args[:days_old].to_i) end namespace :index do desc "Put sample data into solr" @@ -22,27 +22,22 @@ end end namespace :check do desc "Check the Solr connection and controller configuration" - task :solr, [:controller_name] => [:environment] do |_, args| - errors = 0 - verbose = ENV.fetch('VERBOSE', false).present? - - conn = Blacklight.default_index.connection - puts "[#{conn.uri}]" - - print " - admin/ping: " + task :solr, [:controller_name] => [:environment] do begin - response = conn.send_and_receive 'admin/ping', {} - puts response['status'] - errors += 1 unless response['status'] == "OK" + conn = Blacklight.default_index + if conn.ping + puts "OK" + else + puts "Unable to reach: #{conn.uri}" + exit 1 + end rescue => e - errors += 1 puts e.to_s + exit 1 end - - exit 1 if errors > 0 end task :controller, [:controller_name] => [:environment] do |_, args| errors = 0 verbose = ENV.fetch('VERBOSE', false).present?