canvas-lms/lib/data_fixup/set_wiki_has_no_front_page.rb

10 lines
344 B
Ruby

module DataFixup::SetWikiHasNoFrontPage
def self.run
while Wiki.where(:has_no_front_page => nil, :front_page_url => nil).
where("NOT EXISTS (?)", WikiPage.where("id=wiki_pages.wiki_id AND wiki_pages.url = ?",
Wiki::DEFAULT_FRONT_PAGE_URL)).
limit(1000).update_all(:has_no_front_page => true) > 0
end
end
end