Adds the “s3_uploads” option (default: false) to the discourse backup script, which temporarily forces the inclusion of S3 uploads in the backup.
Also removed all unnecessary “require” statements as loading Rails is sufficient.
The rest of the changes were made by the linter.
Before this commit, this output is possible:
```
Rewriting all occurrences of STRING1 to STRING2
THIS TASK WILL REWRITE DATA, ARE YOU SURE (type YES)
WILL RUN ON ALL 1 DBS
```
Which, when run from a script, might lead one to believe that YES was
automatically inserted into STDIN and the script is continuing.
Turns out this isn't the case so the obvious expectation is broken.
This commit swaps the order of those last lines to make it clear that
the script is blocked on input.
If someone types `yes` rather than `YES`, continue anyway.
The chance of typing `yes`, when you actually want to stop, is non-existent. The chance of typing `yes` when you meant `YES` is high, and it's very frustrating when the script quite because you got the case wrong!
This allows text editors to use correct syntax coloring for the heredoc sections.
Heredoc tag names we use:
languages: SQL, JS, RUBY, LUA, HTML, CSS, SCSS, SH, HBS, XML, YAML/YML, MF, ICS
other: MD, TEXT/TXT, RAW, EMAIL
Over the years we accrued many spelling mistakes in the code base.
This PR attempts to fix spelling mistakes and typos in all areas of the code that are extremely safe to change
- comments
- test descriptions
- other low risk areas
You can use `discourse restore --location=local FILENAME` if you want to restore a backup that is stored locally even though the `backup_location` has the value `s3`.
Zeitwerk simplifies working with dependencies in dev and makes it easier reloading class chains.
We no longer need to use Rails "require_dependency" anywhere and instead can just use standard
Ruby patterns to require files.
This is a far reaching change and we expect some followups here.
This reduces chances of errors where consumers of strings mutate inputs
and reduces memory usage of the app.
Test suite passes now, but there may be some stuff left, so we will run
a few sites on a branch prior to merging
This restores the previous functionality. The script now allows the following options:
* `discourse backup` (uses the system generated filename)
* `discourse backup <some_filename>` (uses the provided filename)
* `discourse backup </some/path/to/filename>` (moves the backup to the provided path with the given filename)
Remote backup stores do not support the last option.
Some file extensions (like `.tar.gz`) are automatically removed from the provided filename.
Here is a shell session showing what the new documenation looks like:
vagrant@discourse:~/vagrant$ bundle exec ruby ./script/discourse remap
ERROR: "discourse remap" was called with no arguments
Usage: "discourse remap [--global,--regex] FROM TO"
vagrant@discourse:~/vagrant$ bundle exec ruby ./script/discourse help remap
Usage:
discourse remap [--global,--regex] FROM TO
Options:
[--global], [--no-global]
[--regex], [--no-regex]
v, [--verbose=VERBOSE]
Description:
Replace a string sequence FROM with TO across all tables.
With --global option, the remapping is run on ***ALL*** databases. Instead of just running on the current database, run on every database on this machine. This option is useful for multi-site setups.
With --regex option, use PostgreSQL function regexp_replace to do the remapping. Enabling this interprets FROM as a PostgreSQL regular expression. TO can contain references to captures in the FROM match. See the "Regular Expression
Details" section and "regexp_replace" documentation in the PostgreSQL manual for more details.
Examples:
discourse remap talk.foo.com talk.bar.com # renaming a Discourse domain name
discourse remap --regex "[/?color(=[^]]*)*]" "" # removing "color" bbcodes
This adds a --regex option to discourse remap to use the regexp_replace
feature in PostgreSQL. Example usage:
discourse remap --regex "\[\/?color(=[^\]]*)*]" ""
removes all the "color" bbcodes.
Also, this commit fixes the --global option, which did not work because
of how Thor processes the options.
This adds a --regex option to discourse remap to use the regexp_replace
feature in PostgreSQL. Example usage:
discourse remap --regex "\[\/?color(=[^\]]*)*]" ""
removes all the "color" bbcodes.
Also, this commit fixes the --global option, which did not work because
of how Thor processes the options.
This adds a --regex option to discourse remap to use the regexp_replace
feature in PostgreSQL. Example usage:
discourse remap --regex "\[\/?color(=[^\]]*)*]" ""
removes all the "color" bbcodes.
Also, this commit fixes the --global option, which did not work because
of how Thor processes the options.
My discourse instance will be making regular automated public backups
of specific categories. It's preferred to be able to directly control
the path and filename of the output, rather than letting discourse
choose for me. This was already mostly supported, a filename parameter
just needed to be passed through the cli app.
- new hidden site setting 'migrate_to_new_scheme' (defaults to false)
- new rake tasks to toggle migration to new scheme
- FIX: migrate_to_new_scheme also works with CDN
- PERF: improve perf of the DbHelper.remap method
- REFACTOR: UrlHelper is now a class