Sha256: 5f3de2d5b0888229054d797b63d36ff47cd03a20399cd5bb2f2347452e108c6d

Contents?: true

Size: 722 Bytes

Versions: 10

Compression:

Stored size: 722 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
      when :repair_references     ;  Card::Reference.repair_all
      when :empty_trash           ;  Card.empty_trash
      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

10 entries across 10 versions & 1 rubygems

Version Path
card-1.15.7 mod/05_standard/set/self/all.rb
card-1.15.6 mod/05_standard/set/self/all.rb
card-1.15.5 mod/05_standard/set/self/all.rb
card-1.15.4 mod/05_standard/set/self/all.rb
card-1.15.3 mod/05_standard/set/self/all.rb
card-1.15.2 mod/05_standard/set/self/all.rb
card-1.15.1 mod/05_standard/set/self/all.rb
card-1.15.0 mod/05_standard/set/self/all.rb
card-1.15.pre2 mod/05_standard/set/self/all.rb
card-1.15.pre mod/05_standard/set/self/all.rb