Daniel Waterworth
1a72a61822
FIX: Fixed testsuite
...
The backup restorer tests weren't cleaning up after themselves and
playing poorly with prefabrication.
2019-10-23 09:43:05 +01:00
Krzysztof Kotlarek
f69dacf979
FIX: Reconnect in restore process connects to correct DB ( #8218 )
...
Simplified flow of restore is like that
```
migrate_database
reconnect
extract_uploads
```
Problem with incorrect current database started with this fix https://github.com/discourse/discourse/commit/025d4ee91f4
Dump task is reconnecting to default database https://github.com/rails/rails/blob/master/activerecord/lib/active_record/railties/databases.rake#L429
And then, we are trying to reconnect to the original database with that code:
```
def reconnect_database
log "Reconnecting to the database..."
RailsMultisite::ConnectionManagement::establish_connection(db: @current_db)
end
```
This reconnect is not switching us back to correct database because of that check
https://github.com/discourse/rails_multisite/blob/master/lib/rails_multisite/connection_management.rb#L181
Basically, it finds existing handler and it thinks that we are connected to correct DB and this step can be skipped.
To solve it, we can reload RailsMultisite::ConnectionManagement which creates a new instance of that class
https://github.com/discourse/rails_multisite/blob/master/lib/rails_multisite/connection_management.rb#L38
2019-10-23 17:23:50 +11:00
Roman Rizzi
5357ab3324
SECURITY: Safely decompress backups when restoring. ( #8166 )
...
* SECURITY: Safely decompress backups when restoring.
* Fix tests and update theme_controller_spec to work with zip files instead of .tar.gz
2019-10-09 11:41:16 -03:00
Michael Brown
08b286808a
FIX: backups taken by pg_dump >= 11 are nonportable ( #7893 )
2019-07-15 18:07:44 -04:00
Sam Saffron
4ea21fa2d0
DEV: use #frozen_string_literal: true on all spec
...
This change both speeds up specs (less strings to allocate) and helps catch
cases where methods in Discourse are mutating inputs.
Overall we will be migrating everything to use #frozen_string_literal: true
it will take a while, but this is the first and safest move in this direction
2019-04-30 10:27:42 +10:00
Michael Brown
63a1e9b60a
backup restorer: tidy pg_dump schema portability logic, add test
2018-03-20 10:32:39 +08:00