mirror of
https://github.com/discourse/discourse-data-explorer.git
synced 2025-03-06 17:39:08 +00:00
This commit updates the plugin to the latest guidelines, as shown in discourse-plugin-skeleton, which involves moving a lot of the code to dedicated files, use proper namespaces, use the autoloader as much as possible, etc.
21 lines
460 B
Ruby
21 lines
460 B
Ruby
# frozen_string_literal: true
|
|
|
|
module Jobs
|
|
class DeleteHiddenQueries < ::Jobs::Scheduled
|
|
every 7.days
|
|
|
|
def execute(args)
|
|
return unless SiteSetting.data_explorer_enabled
|
|
|
|
DiscourseDataExplorer::Query
|
|
.where("id > 0")
|
|
.where(hidden: true)
|
|
.where(
|
|
"(last_run_at IS NULL OR last_run_at < :days_ago) AND updated_at < :days_ago",
|
|
days_ago: 7.days.ago,
|
|
)
|
|
.delete_all
|
|
end
|
|
end
|
|
end
|