Sha256: 594d6ace06cf7204ebb0870b8d38f3082e20d7d402daf4a494ea39ce6cf60ded

Contents?: true

Size: 804 Bytes

Versions: 7

Compression:

Stored size: 804 Bytes

Contents

event :admin_tasks, :on=>:update, :before=>:approve do
  if task = Env.params[:task]
    if Auth.always_ok?
      case task.to_sym
      when :clear_cache           ;  Card::Cache.reset_global; Card::ViewCache.reset
      when :repair_references     ;  Card::Reference.repair_all
      when :empty_trash           ;  Card.empty_trash
      when :clear_view_cache      ;  Card::ViewCache.reset
      when :delete_old_revisions  ;  Card::Action.delete_old
      when :delete_old_sessions
        if months = Env.params[:months].to_i and months > 0
          ActiveRecord::SessionStore::Session.delete_all ["updated_at < ?", months.months.ago]
        end
      end
      Env.params[:success] = Card[:stats].name
      abort :success
    else
      raise Card::PermissionDenied.new(self)
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
card-1.16.6 mod/05_standard/set/self/all.rb
card-1.16.5 mod/05_standard/set/self/all.rb
card-1.16.4 mod/05_standard/set/self/all.rb
card-1.16.3 mod/05_standard/set/self/all.rb
card-1.16.2 mod/05_standard/set/self/all.rb
card-1.16.1 mod/05_standard/set/self/all.rb
card-1.16.0 mod/05_standard/set/self/all.rb