Implemented issue #1254 - Feature Request: clear caller log.
This commit is contained in:
parent
daaf1525cd
commit
547f002f71
3 changed files with 45 additions and 0 deletions
|
@ -358,5 +358,23 @@ returns
|
|||
)
|
||||
}
|
||||
end
|
||||
|
||||
=begin
|
||||
|
||||
cleanup caller logs
|
||||
|
||||
Cti::Log.cleanup
|
||||
|
||||
optional you can put the max oldest chat entries as argument
|
||||
|
||||
Cti::Log.cleanup(12.months)
|
||||
|
||||
=end
|
||||
|
||||
def self.cleanup(diff = 12.months)
|
||||
Cti::Log.where('created_at < ?', Time.zone.now - diff).delete_all
|
||||
true
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
|
18
db/migrate/20170714000003_cleanup_cti_log.rb
Normal file
18
db/migrate/20170714000003_cleanup_cti_log.rb
Normal file
|
@ -0,0 +1,18 @@
|
|||
class CleanupCtiLog < ActiveRecord::Migration
|
||||
def up
|
||||
|
||||
# return if it's a new setup
|
||||
return if !Setting.find_by(name: 'system_init_done')
|
||||
|
||||
Scheduler.create_if_not_exists(
|
||||
name: 'Cleanup Cti::Log',
|
||||
method: 'Cti::Log.cleanup',
|
||||
period: 1.month,
|
||||
prio: 2,
|
||||
active: true,
|
||||
updated_by_id: 1,
|
||||
created_by_id: 1,
|
||||
)
|
||||
end
|
||||
|
||||
end
|
|
@ -156,6 +156,15 @@ Scheduler.create_if_not_exists(
|
|||
updated_by_id: 1,
|
||||
created_by_id: 1,
|
||||
)
|
||||
Scheduler.create_if_not_exists(
|
||||
name: 'Cleanup Cti::Log',
|
||||
method: 'Cti::Log.cleanup',
|
||||
period: 1.month,
|
||||
prio: 2,
|
||||
active: true,
|
||||
updated_by_id: 1,
|
||||
created_by_id: 1,
|
||||
)
|
||||
Scheduler.create_if_not_exists(
|
||||
name: 'Import Jobs',
|
||||
method: 'ImportJob.start_registered',
|
||||
|
|
Loading…
Reference in a new issue