Commit 0701f96bea469fc0449912401ce06507f7c34184

Authored by Macartur Sousa
1 parent 4d00e066
Exists in master and in 79 other branches add_sisp_to_chef, add_super_archives_plugin, api_for_colab, automates_core_packing, backup_not_prod, changes_in_buttons_on_content_panel, colab_automated_login, colab_spb_plugin_recipe, colab_widgets_settings, design_validation, dev_env_minimal, disable_email_dev, fix_breadcrumbs_position, fix_categories_software_link, fix_edit_institution, fix_edit_software_with_another_license, fix_get_license_info, fix_gitlab_assets_permission, fix_list_style_inside_article, fix_list_style_on_folder_elements, fix_members_pagination, fix_merge_request_url, fix_models_translations, fix_no_license, fix_software_api, fix_software_block_migration, fix_software_communities_translations, fix_software_communities_unit_test, fix_style_create_institution_admin_panel, fix_superarchives_imports, fix_sym_links_noosfero, focus_search_field_theme, gov-user-refactoring, gov-user-refactoring-rails4, header_fix, institution_modal_on_rating, kalibro-conf-refactoring, kalibro-processor-package, lxc_settings, margin_fix, mezuro_cookbook, prezento, refactor_download_block, refactor_software_communities, refactor_software_for_sisp, register_page, release-process, release-process-v2, remove-unused-images, remove_broken_theme, remove_secondary_email_from_user, remove_sisp_buttons, removing_super_archives_email, review_message, scope2method, signals_user_noosfero, sisp_catalog_header, sisp_colab_config, sisp_dev, sisp_dev_master, sisp_simple_version, software_as_organization, software_catalog_style_fix, software_communities_html_refactor, software_infos_api, spb_minimal_env, spb_to_rails4, spec_refactor, stable-4.1, stable-4.2, stable-4.x, temp_soft_comm_refactoring, theme_header, theme_javascript_refactory, thread_dropdown, thread_page, update_search_by_categories, update_software_api, update_softwares_boxes

Removed noosfero patch

patches/noosfero/0001-Enhance-existing-backup-task-and-add-a-restore-one.patch
... ... @@ -1,137 +0,0 @@
1   -From c1918dc6090c011a297bc470c04d4158410e61b8 Mon Sep 17 00:00:00 2001
2   -From: Antonio Terceiro <terceiro@colivre.coop.br>
3   -Date: Wed, 11 Feb 2015 19:55:30 -0200
4   -Subject: [PATCH] Enhance existing backup task and add a restore one
5   -
6   -- `rake backup` will now create a tarball with everything that needs to
7   - be backed up (files + database dump)
8   -
9   -- `rake restore BACKUP=/path/to/(...).tar.gz` will restore that backup
10   - over the current Noosfero instance.
11   -
12   -Multi-tenant setups are not supported yet.
13   ----
14   - lib/tasks/backup.rake | 111 +++++++++++++++++++++++++++++++++++++++++++++++---
15   - 1 file changed, 105 insertions(+), 6 deletions(-)
16   -
17   -diff --git a/lib/tasks/backup.rake b/lib/tasks/backup.rake
18   -index 849d4d6..7e64d17 100644
19   ---- a/lib/tasks/backup.rake
20   -+++ b/lib/tasks/backup.rake
21   -@@ -1,8 +1,107 @@
22   --desc "Creates a backup of the user files stored in public/"
23   --task :backup do
24   -- dirs = Dir.glob('public/images/[0-9][0-9][0-9][0-9]') + ['public/articles', 'public/thumbnails', 'public/user_themes'].select { |d| File.exists?(d) }
25   -- tarball = 'backups/files-' + Time.now.strftime('%Y-%m-%d-%R') + '.tar'
26   -+task :load_backup_config do
27   -+ $config = YAML.load_file('config/database.yml')
28   -+end
29   -+
30   -+task :check_backup_support => :load_backup_config do
31   -+ if $config['production']['adapter'] != 'postgresql'
32   -+ fail("Only PostgreSQL is supported for backups at the moment")
33   -+ end
34   -+end
35   -+
36   -+backup_dirs = [
37   -+ 'public/image_uploads',
38   -+ 'public/articles',
39   -+ 'public/thumbnails',
40   -+ 'public/user_themes',
41   -+]
42   -+
43   -+desc "Creates a backup of the database and uploaded files"
44   -+task :backup => :check_backup_support do
45   -+ dirs = backup_dirs.select { |d| File.exists?(d) }
46   -+
47   -+ backup_name = Time.now.strftime('%Y-%m-%d-%R')
48   -+ backup_file = File.join('tmp/backup', backup_name) + '.tar.gz'
49   -+ mkdir_p 'tmp/backup'
50   -+ dump = File.join('tmp/backup', backup_name) + '.sql'
51   -+
52   -+ database = $config['production']['database']
53   -+ sh "pg_dump #{database} > #{dump}"
54   -+
55   -+ sh 'tar', 'caf', backup_file, dump, *dirs
56   -+ rm_f dump
57   -+
58   -+ puts "****************************************************"
59   -+ puts "Backup in #{backup_file} !"
60   -+ puts
61   -+ puts "To restore, use:"
62   -+ puts "$ rake restore BACKUP=#{backup_file}"
63   -+ puts "****************************************************"
64   -+end
65   -+
66   -+def invalid_backup!(message, items=[])
67   -+ puts "E: #{message}"
68   -+ items.each do |i|
69   -+ puts "E: - #{i}"
70   -+ end
71   -+ puts "E: Is this a backup archive created by Noosfero with \`rake backup\`?"
72   -+ exit 1
73   -+end
74   -+
75   -+desc "Restores a backup created previousy with \`rake backup\`"
76   -+task :restore => :check_backup_support do
77   -+ backup = ENV["BACKUP"]
78   -+ unless backup
79   -+ puts "usage: rake restore BACKUP=/path/to/backup"
80   -+ exit 1
81   -+ end
82   -+
83   -+ files = `tar taf #{backup}`.split
84   -+
85   -+ # validate files in the backup
86   -+ invalid_files = []
87   -+ files.each do |f|
88   -+ if f !~ /tmp\/backup\// && (backup_dirs.none? { |d| f =~ /^#{d}\// })
89   -+ invalid_files << f
90   -+ end
91   -+ end
92   -+ if invalid_files.size > 0
93   -+ invalid_backup!("Invalid files found in the backup archive", invalid_files)
94   -+ end
95   -+
96   -+ # find database dump in the archive
97   -+ dumps = files.select do |f|
98   -+ File.dirname(f) == 'tmp/backup' && f =~ /\.sql$/
99   -+ end
100   -+ if dumps.size == 0
101   -+ invalid_backup!("Could not find a database dump in the archive.")
102   -+ elsif dumps.size > 1
103   -+ invalid_backup!("Multiple database dumps found in the archive:", dumps)
104   -+ end
105   -+ dump = dumps.first
106   -+
107   -+ database = $config['production']['database']
108   -+ username = $config['production']['username']
109   -+
110   -+ puts "WARNING: backups should be restored to an empty database, otherwise"
111   -+ puts "data from the backup may not be loaded properly."
112   -+ puts
113   -+ puts 'You can remove the existing database and create a new one with:'
114   -+ puts
115   -+ puts "$ sudo -u postgres dropdb #{database}"
116   -+ puts "$ sudo -u postgres createdb #{database} --owner #{username}"
117   -+ puts
118   -+ print "Are you sure you want to continue (y/N)? "
119   -+ response = $stdin.gets.strip
120   -+ unless ['y', 'yes'].include?(response.downcase)
121   -+ puts "*** ABORTED."
122   -+ exit 1
123   -+ end
124   -+
125   -+ sh 'tar', 'xaf', backup
126   -+ sh "rails dbconsole production < #{dump}"
127   -+ rm_f dump
128   -
129   -- mkdir_p(File.dirname(tarball))
130   -- sh('tar', 'cf', tarball, *dirs)
131   -+ puts "****************************************************"
132   -+ puts "Backup restored!"
133   -+ puts "****************************************************"
134   - end
135   ---
136   -2.1.4
137   -
patches/noosfero/0001-Fix-backup-task.patch
... ... @@ -1,52 +0,0 @@
1   -From 3b814b256441be6e0fc98cb1afa695c4f13d6849 Mon Sep 17 00:00:00 2001
2   -From: Athos Ribeiro <athoscribeiro@gmail.com>
3   -Date: Fri, 8 May 2015 15:13:40 -0300
4   -Subject: [PATCH] Fix backup task
5   -
6   -- Adds host option to the postgres commands where necessary.
7   -- Passes -h option to tar when compressing in order to follow symlinks.
8   -
9   -Signed-off-by: Athos Ribeiro <athoscribeiro@gmail.com>
10   -Signed-off-by: Lucas Kanashiro <kanashiro.duarte@gmail.com>
11   ----
12   - lib/tasks/backup.rake | 10 ++++++----
13   - 1 file changed, 6 insertions(+), 4 deletions(-)
14   -
15   -diff --git a/lib/tasks/backup.rake b/lib/tasks/backup.rake
16   -index 7e64d17..14b2418 100644
17   ---- a/lib/tasks/backup.rake
18   -+++ b/lib/tasks/backup.rake
19   -@@ -25,9 +25,10 @@ task :backup => :check_backup_support do
20   - dump = File.join('tmp/backup', backup_name) + '.sql'
21   -
22   - database = $config['production']['database']
23   -- sh "pg_dump #{database} > #{dump}"
24   -+ host = $config['production']['host']
25   -+ sh "pg_dump -h #{host} #{database} > #{dump}"
26   -
27   -- sh 'tar', 'caf', backup_file, dump, *dirs
28   -+ sh 'tar', 'chaf', backup_file, dump, *dirs
29   - rm_f dump
30   -
31   - puts "****************************************************"
32   -@@ -81,14 +82,15 @@ task :restore => :check_backup_support do
33   -
34   - database = $config['production']['database']
35   - username = $config['production']['username']
36   -+ host = $config['production']['host']
37   -
38   - puts "WARNING: backups should be restored to an empty database, otherwise"
39   - puts "data from the backup may not be loaded properly."
40   - puts
41   - puts 'You can remove the existing database and create a new one with:'
42   - puts
43   -- puts "$ sudo -u postgres dropdb #{database}"
44   -- puts "$ sudo -u postgres createdb #{database} --owner #{username}"
45   -+ puts "$ sudo -u postgres dropdb -h #{host} #{database}"
46   -+ puts "$ sudo -u postgres createdb -h #{host} #{database} --owner #{username}"
47   - puts
48   - print "Are you sure you want to continue (y/N)? "
49   - response = $stdin.gets.strip
50   ---
51   -2.1.0
52   -
patches/noosfero/0001-Use-as-placeholder-for-current-user-in-URLs.patch
... ... @@ -1,196 +0,0 @@
1   -From 38e1a32782d0a2f5d66a936b707f307ceb13288f Mon Sep 17 00:00:00 2001
2   -From: David Carlos <ddavidcarlos1392@gmail.com>
3   -Date: Thu, 12 Mar 2015 14:59:38 -0300
4   -Subject: [PATCH] Use ~ as placeholder for current user in URLs
5   -
6   -When the :profile parameter is '~', replace it with the identifier of
7   -the currently logged-in user and redirect. This is useful for example
8   -for adding direct links to the control panel of the current user in
9   -documentation.
10   -
11   -Signed-off-by: Antonio Terceiro <terceiro@colivre.coop.br>
12   -Signed-off-by: Arthur Del Esposte <arthurmde@gmail.com>
13   -Signed-off-by: David Carlos <ddavidcarlos1392@gmail.com>
14   -Signed-off-by: Gabriela Navarro <navarro1703@gmail.com>
15   ----
16   - app/controllers/application_controller.rb | 12 ++++++++
17   - config/routes.rb | 40 +++++++++++++-------------
18   - lib/noosfero.rb | 6 ++++
19   - test/functional/application_controller_test.rb | 18 ++++++++++++
20   - test/integration/routing_test.rb | 4 +++
21   - 5 files changed, 60 insertions(+), 20 deletions(-)
22   -
23   -diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
24   -index 2bb0835..75fb3fd 100644
25   ---- a/app/controllers/application_controller.rb
26   -+++ b/app/controllers/application_controller.rb
27   -@@ -9,6 +9,7 @@ class ApplicationController < ActionController::Base
28   - before_filter :allow_cross_domain_access
29   - before_filter :login_required, :if => :private_environment?
30   - before_filter :verify_members_whitelist, :if => [:private_environment?, :user]
31   -+ before_filter :redirect_to_current_user
32   -
33   - def verify_members_whitelist
34   - render_access_denied unless user.is_admin? || environment.in_whitelist?(user)
35   -@@ -191,4 +192,15 @@ class ApplicationController < ActionController::Base
36   - def private_environment?
37   - @environment.enabled?(:restrict_to_members)
38   - end
39   -+
40   -+ def redirect_to_current_user
41   -+ if params[:profile] == '~'
42   -+ if logged_in?
43   -+ redirect_to params.merge(:profile => user.identifier)
44   -+ else
45   -+ render_not_found
46   -+ end
47   -+ end
48   -+ end
49   -+
50   - end
51   -diff --git a/config/routes.rb b/config/routes.rb
52   -index f370954..a54ea19 100644
53   ---- a/config/routes.rb
54   -+++ b/config/routes.rb
55   -@@ -57,37 +57,37 @@ Noosfero::Application.routes.draw do
56   - match 'search(/:action(/*category_path))', :controller => 'search'
57   -
58   - # events
59   -- match 'profile/:profile/events_by_day', :controller => 'events', :action => 'events_by_day', :profile => /#{Noosfero.identifier_format}/
60   -- match 'profile/:profile/events_by_month', :controller => 'events', :action => 'events_by_month', :profile => /#{Noosfero.identifier_format}/
61   -- match 'profile/:profile/events/:year/:month/:day', :controller => 'events', :action => 'events', :year => /\d*/, :month => /\d*/, :day => /\d*/, :profile => /#{Noosfero.identifier_format}/
62   -- match 'profile/:profile/events/:year/:month', :controller => 'events', :action => 'events', :year => /\d*/, :month => /\d*/, :profile => /#{Noosfero.identifier_format}/
63   -- match 'profile/:profile/events', :controller => 'events', :action => 'events', :profile => /#{Noosfero.identifier_format}/
64   -+ match 'profile/:profile/events_by_day', :controller => 'events', :action => 'events_by_day', :profile => /#{Noosfero.identifier_format_in_url}/
65   -+ match 'profile/:profile/events_by_month', :controller => 'events', :action => 'events_by_month', :profile => /#{Noosfero.identifier_format_in_url}/
66   -+ match 'profile/:profile/events/:year/:month/:day', :controller => 'events', :action => 'events', :year => /\d*/, :month => /\d*/, :day => /\d*/, :profile => /#{Noosfero.identifier_format_in_url}/
67   -+ match 'profile/:profile/events/:year/:month', :controller => 'events', :action => 'events', :year => /\d*/, :month => /\d*/, :profile => /#{Noosfero.identifier_format_in_url}/
68   -+ match 'profile/:profile/events', :controller => 'events', :action => 'events', :profile => /#{Noosfero.identifier_format_in_url}/
69   -
70   - # catalog
71   -- match 'catalog/:profile', :controller => 'catalog', :action => 'index', :profile => /#{Noosfero.identifier_format}/, :as => :catalog
72   -+ match 'catalog/:profile', :controller => 'catalog', :action => 'index', :profile => /#{Noosfero.identifier_format_in_url}/, :as => :catalog
73   -
74   - # invite
75   -- match 'profile/:profile/invite/friends', :controller => 'invite', :action => 'invite_friends', :profile => /#{Noosfero.identifier_format}/
76   -- match 'profile/:profile/invite/:action', :controller => 'invite', :profile => /#{Noosfero.identifier_format}/
77   -+ match 'profile/:profile/invite/friends', :controller => 'invite', :action => 'invite_friends', :profile => /#{Noosfero.identifier_format_in_url}/
78   -+ match 'profile/:profile/invite/:action', :controller => 'invite', :profile => /#{Noosfero.identifier_format_in_url}/
79   -
80   - # feeds per tag
81   -- match 'profile/:profile/tags/:id/feed', :controller => 'profile', :action =>'tag_feed', :id => /.+/, :profile => /#{Noosfero.identifier_format}/, :as => :tag_feed
82   -+ match 'profile/:profile/tags/:id/feed', :controller => 'profile', :action =>'tag_feed', :id => /.+/, :profile => /#{Noosfero.identifier_format_in_url}/, :as => :tag_feed
83   -
84   - # profile tags
85   -- match 'profile/:profile/tags/:id', :controller => 'profile', :action => 'content_tagged', :id => /.+/, :profile => /#{Noosfero.identifier_format}/
86   -- match 'profile/:profile/tags(/:id)', :controller => 'profile', :action => 'tags', :profile => /#{Noosfero.identifier_format}/
87   -+ match 'profile/:profile/tags/:id', :controller => 'profile', :action => 'content_tagged', :id => /.+/, :profile => /#{Noosfero.identifier_format_in_url}/
88   -+ match 'profile/:profile/tags(/:id)', :controller => 'profile', :action => 'tags', :profile => /#{Noosfero.identifier_format_in_url}/
89   -
90   - # profile search
91   -- match 'profile/:profile/search', :controller => 'profile_search', :action => 'index', :profile => /#{Noosfero.identifier_format}/
92   -+ match 'profile/:profile/search', :controller => 'profile_search', :action => 'index', :profile => /#{Noosfero.identifier_format_in_url}/
93   -
94   - # comments
95   -- match 'profile/:profile/comment/:action/:id', :controller => 'comment', :profile => /#{Noosfero.identifier_format}/
96   -+ match 'profile/:profile/comment/:action/:id', :controller => 'comment', :profile => /#{Noosfero.identifier_format_in_url}/
97   -
98   - # public profile information
99   -- match 'profile/:profile(/:action(/:id))', :controller => 'profile', :action => 'index', :id => /[^\/]*/, :profile => /#{Noosfero.identifier_format}/, :as => :profile
100   -+ match 'profile/:profile(/:action(/:id))', :controller => 'profile', :action => 'index', :id => /[^\/]*/, :profile => /#{Noosfero.identifier_format_in_url}/, :as => :profile
101   -
102   - # contact
103   -- match 'contact/:profile/:action(/:id)', :controller => 'contact', :action => 'index', :id => /.*/, :profile => /#{Noosfero.identifier_format}/
104   -+ match 'contact/:profile/:action(/:id)', :controller => 'contact', :action => 'index', :id => /.*/, :profile => /#{Noosfero.identifier_format_in_url}/
105   -
106   - # map balloon
107   - match 'map_balloon/:action/:id', :controller => 'map_balloon', :id => /.*/
108   -@@ -99,8 +99,8 @@ Noosfero::Application.routes.draw do
109   - ## Controllers that are profile-specific (for profile admins )
110   - ######################################################
111   - # profile customization - "My profile"
112   -- match 'myprofile/:profile', :controller => 'profile_editor', :action => 'index', :profile => /#{Noosfero.identifier_format}/
113   -- match 'myprofile/:profile/:controller(/:action(/:id))', :controller => Noosfero.pattern_for_controllers_in_directory('my_profile'), :profile => /#{Noosfero.identifier_format}/, :as => :myprofile
114   -+ match 'myprofile/:profile', :controller => 'profile_editor', :action => 'index', :profile => /#{Noosfero.identifier_format_in_url}/
115   -+ match 'myprofile/:profile/:controller(/:action(/:id))', :controller => Noosfero.pattern_for_controllers_in_directory('my_profile'), :profile => /#{Noosfero.identifier_format_in_url}/, :as => :myprofile
116   -
117   -
118   - ######################################################
119   -@@ -128,14 +128,14 @@ Noosfero::Application.routes.draw do
120   - # cache stuff - hack
121   - match 'public/:action/:id', :controller => 'public'
122   -
123   -- match ':profile/*page/versions', :controller => 'content_viewer', :action => 'article_versions', :profile => /#{Noosfero.identifier_format}/, :constraints => EnvironmentDomainConstraint.new
124   -+ match ':profile/*page/versions', :controller => 'content_viewer', :action => 'article_versions', :profile => /#{Noosfero.identifier_format_in_url}/, :constraints => EnvironmentDomainConstraint.new
125   - match '*page/versions', :controller => 'content_viewer', :action => 'article_versions'
126   -
127   -- match ':profile/*page/versions_diff', :controller => 'content_viewer', :action => 'versions_diff', :profile => /#{Noosfero.identifier_format}/, :constraints => EnvironmentDomainConstraint.new
128   -+ match ':profile/*page/versions_diff', :controller => 'content_viewer', :action => 'versions_diff', :profile => /#{Noosfero.identifier_format_in_url}/, :constraints => EnvironmentDomainConstraint.new
129   - match '*page/versions_diff', :controller => 'content_viewer', :action => 'versions_diff'
130   -
131   - # match requests for profiles that don't have a custom domain
132   -- match ':profile(/*page)', :controller => 'content_viewer', :action => 'view_page', :profile => /#{Noosfero.identifier_format}/, :constraints => EnvironmentDomainConstraint.new
133   -+ match ':profile(/*page)', :controller => 'content_viewer', :action => 'view_page', :profile => /#{Noosfero.identifier_format_in_url}/, :constraints => EnvironmentDomainConstraint.new
134   -
135   - # match requests for content in domains hosted for profiles
136   - match '/(*page)', :controller => 'content_viewer', :action => 'view_page'
137   -diff --git a/lib/noosfero.rb b/lib/noosfero.rb
138   -index d7ec786..b1ae492 100644
139   ---- a/lib/noosfero.rb
140   -+++ b/lib/noosfero.rb
141   -@@ -57,6 +57,12 @@ module Noosfero
142   - '[a-z0-9][a-z0-9~.]*([_\-][a-z0-9~.]+)*'
143   - end
144   -
145   -+ # All valid identifiers, plus ~ meaning "the current user". See
146   -+ # ApplicationController#redirect_to_current_user
147   -+ def self.identifier_format_in_url
148   -+ "(#{identifier_format}|~)"
149   -+ end
150   -+
151   - def self.default_hostname
152   - Environment.table_exists? && Environment.default ? Environment.default.default_hostname : 'localhost'
153   - end
154   -diff --git a/test/functional/application_controller_test.rb b/test/functional/application_controller_test.rb
155   -index 1c4ca48..1a99752 100644
156   ---- a/test/functional/application_controller_test.rb
157   -+++ b/test/functional/application_controller_test.rb
158   -@@ -578,4 +578,22 @@ class ApplicationControllerTest < ActionController::TestCase
159   - assert_response :success
160   - end
161   -
162   -+ should "redirect to 404 if profile is '~' and user is not logged in" do
163   -+ get :index, :profile => '~'
164   -+ assert_response :missing
165   -+ end
166   -+
167   -+ should "redirect to action when profile is '~' " do
168   -+ login_as('ze')
169   -+ get :index, :profile => '~'
170   -+ assert_response 302
171   -+ end
172   -+
173   -+ should "substitute '~' by current user and redirect properly " do
174   -+ login_as('ze')
175   -+ profile = Profile.where(:identifier => 'ze').first
176   -+ get :index, :profile => '~'
177   -+ assert_redirected_to :controller => 'test', :action => 'index', :profile => profile.identifier
178   -+ end
179   -+
180   - end
181   -diff --git a/test/integration/routing_test.rb b/test/integration/routing_test.rb
182   -index 5a77eff..1c57323 100644
183   ---- a/test/integration/routing_test.rb
184   -+++ b/test/integration/routing_test.rb
185   -@@ -272,4 +272,8 @@ class RoutingTest < ActionController::IntegrationTest
186   - assert_routing('/embed/block/12345', :controller => 'embed', :action => 'block', :id => '12345')
187   - end
188   -
189   -+ should 'accept ~ as placeholder for current user' do
190   -+ assert_routing('/profile/~', :controller => 'profile', :profile => '~', :action => 'index')
191   -+ end
192   -+
193   - end
194   ---
195   -2.1.4
196   -