Add repair sitemap , termofuse , and OrbitWidget appear repeatly.
This commit is contained in:
parent
ea9bb6b3fe
commit
504e82073d
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue