31 Commits
Author SHA1 Message Date
Gerhard SchlagerandGitHub b36a60fa9b DEV: Slack import script (#22386)
It's very simple import script and currently imports only the following content:
* Users
* Messages as Discourse topics/posts
* Attachments

Each channel can be mapped to a category and tags. It uses regular expressions to convert formatted messages ("rich text") into Markdown used by Discourse. In the future we could convert the `blocks` attribute from each message into Markdown instead of applying regular expressions on the `text` attribute.
2023-07-04 21:37:45 +02:00
Ted JohanssonandGitHub aaac31cbcf DEV: Replace #pluck_first freedom patch with AR #pick in core (#19893)
The #pluck_first freedom patch, first introduced by @danielwaterworth has served us well, and is used widely throughout both core and plugins. It seems to have been a common enough use case that Rails 6 introduced it's own method #pick with the exact same implementation. This allows us to retire the freedom patch and switch over to the built-in ActiveRecord method.

There is no replacement for #pluck_first!, but a quick search shows we are using this in a very limited capacity, and in some cases incorrectly (by assuming a nil return rather than an exception), which can quite easily be replaced with #pick plus some extra handling.
2023-02-13 12:39:45 +08:00
03af13b0f6 DEV: Add import script for Yammer (#20074)
Co-authored-by: Jay Pfaffman <[email protected]>
2023-01-31 10:12:01 +01:00
David Taylor b7c21ceb26 DEV: Apply syntax_tree formatting to script/* 2023-01-09 11:13:22 +00:00
Peter ZhuandGitHub 077003d795 DEV: Fix methods removed in Ruby 3.2 (#15459)
* File.exists? is deprecated and removed in Ruby 3.2 in favor of
File.exist?
* Dir.exists? is deprecated and removed in Ruby 3.2 in favor of
Dir.exist?
2022-01-05 18:45:08 +01:00
Dan UngureanuandGitHub 01b482cd8d DEV: Prefer .pluck_first over .pluck.first (#13607) 2021-07-02 10:03:54 +08:00
706ab8f5ab Improvements to phpBB3 import script (#10999)
* FEATURE: Import attachments

* FEATURE: Add support for importing multiple forums in one

* FEATURE: Add support for category and tag mapping

* FEATURE: Import groups

* FIX: Add spaces around images

* FEATURE: Custom mapping of user rank to trust levels

* FIX: Do not fail import if it cannot import polls

* FIX: Optimize existing records lookup

Co-authored-by: Gerhard Schlager <[email protected]>
Co-authored-by: Jarek Radosz <[email protected]>
2021-01-14 21:44:43 +02:00
Krzysztof KotlarekandSam 0db72e4291 DEV: Upgrading Discourse to Zeitwerk (#8098)
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.
2019-10-02 14:01:53 +10:00
Gerhard SchlagerandJustin DiRose 53cf6fdb65 Import avatars and likes in the Zendesk AP importer
Co-authored-by: Justin DiRose <[email protected]>
2019-08-14 10:42:52 +02:00
Gerhard Schlager f128d05e27 DEV: Refactor helper methods for upload markdown
Follow-up to f71fefdc
2019-07-25 16:36:35 +02:00
Gerhard Schlager f71fefdc39 DEV: Make attachment markdown reusable 2019-07-25 14:04:18 +02:00
Guo Xiang Tan 7dc35f6e33 FIX: Use new attachment markdown format in ImportScripts::Uploader. 2019-06-11 14:49:28 +08:00
Gerhard Schlager 4474693c69 Make import scripts work with frozen strings 2019-05-30 22:22:24 +02:00
Sam SaffronandGuo Xiang Tan 5fbcc5cb35 DEV: enable frozen string literal on all files
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
2019-05-13 09:31:32 +08:00
Guo Xiang Tan 6e3e106e45 DEV: Prefer public_send over send. 2019-05-07 09:33:21 +08:00
Gerhard Schlager 06eced2e9f FEATURE: Import script for AnswerBase
Improves the generic database used by some import scripts:
* Adds additional columns for users
* Adds support for attachments
* Allows setting the data type for keys (numeric or string) to ensure correct sorting
2019-02-28 22:08:12 +01:00
Régis Hanol 641e8d7422 PERF: user imports would slow down the more users were imported 2018-10-22 11:14:13 +02:00
Régis Hanol 99d5f97085 Merge users based on their email in vBulletin importer 2018-10-19 15:16:45 +02:00
Guo Xiang Tan de949b9c1d Rename FileHelper.is_image? -> FileHelper.is_supported_image?. 2018-09-12 09:22:28 +08:00
Neil Lalonde 57c67053f8 FEATURE: Zendesk importer that uses its API to get data 2018-08-28 10:21:39 -04:00
Gerhard Schlager 2fdfae2185 Fix the import of avatars and attachments
This time for real ;-)
2018-08-12 22:26:07 +02:00
Gerhard Schlager 35c7b8a117 FIX: Importers failed to import avatars 2018-08-12 22:02:17 +02:00
Gerhard Schlager 5b5b6e93a8 Use short upload URL in import scripts 2018-06-17 22:57:32 +02:00
Gerhard Schlager dee8ef7d6d Create avatar from file in base importer 2018-06-17 22:57:31 +02:00
Régis Hanol 468037c9d0 FEATURE: SMF1 importer 2018-05-28 11:02:19 +02:00
Gerhard Schlager fe7afe054b Adds import script for Zendesk
It also adds a generic SQLite database that can be used when the data needs some transformation before the actual import.
2018-05-22 21:55:54 +02:00
Guo Xiang TanandGitHub 5269b652cd Add rubocop to our build. (#5004) 2017-07-28 10:20:09 +09:00
Régis Hanol 4f5884da92 REFACTOR: upload workflow creation into UploadCreator
- Automatically convert large-ish PNG/BMP to JPEG
- Updated fast_image to latest version
2017-05-11 00:16:57 +02:00
Régis Hanol 50c2a382d5 50% faster vBulletin 4 importer 2017-02-01 14:33:09 +01:00
Neil Lalonde 2d61385fa8 FEATURE: Zoho importer 2015-12-04 15:06:46 -05:00
Gerhard Schlager 1667080cf7 Improves the base importer
- Move some methods into their own classes in order to make it easier
  to reuse them outside of classes extending the base importer. For
  compatibility reasons the old methods are still in the base importer
  and delegate to the new objects. The following methods and hashes were
  extracted:
    - all the lookup maps for existing and imported data
    - all the methods used for uploads and attachments
- No need to store failed users and groups. This information wasn't
  used anyway.
- Print progress instead of category names when importing categories.
- Allow importers to override if bbcode_to_md should be used (until now
  it always used ARGV)
- Allow importers to add additional site settings that automatically get
  restored after the importer finishes.
- Show how many posts and messages are imported per minute. This should
  help detecting when the import is slowing down and needs to be
  restarted.
- Use max_image_width and max_image_height from settings instead of
  hard-coded values for uploaded images.
2015-07-16 15:28:42 +02:00