diff --git a/app/controllers/admin/patchfiles_controller.rb b/app/controllers/admin/patchfiles_controller.rb index 88f98cc..1d312fe 100644 --- a/app/controllers/admin/patchfiles_controller.rb +++ b/app/controllers/admin/patchfiles_controller.rb @@ -40,6 +40,19 @@ class Admin::PatchfilesController < OrbitAdminController end end end + keys = OrbitWidget.all.map{|w| w.key}.uniq + keep_ids = [] + keys.each do |key| + keep_ids << OrbitWidget.where(:key=>key).desc(:id).first.id + end + orbit_widgets = OrbitWidget.all.to_a + orbit_widgets.each{|w| w.destroy if(!keep_ids.include? w.id)} + home_page = Page.where(:url=>'/').asc(:id).first + check_urls = ['/sitemap','/termofuse'] + check_urls.each do |check_url| + check_url_ids = Page.where(:url=>check_url,:parent_page_id=>home_page.id).desc(:id).to_a + check_url_ids[1..-1].each{|uniq_page| uniq_page.destroy} + end render :text => 'repair finish' end def index