MM-57512: Disable content extraction during import (#26619)

https://mattermost.atlassian.net/browse/MM-57512
```release-note
NONE
```
Этот коммит содержится в:
Agniva De Sarker
2024-04-03 09:04:33 +05:30
коммит произвёл GitHub
родитель fc8e537288
Коммит 273d4432b4
20 изменённых файлов: 155 добавлений и 139 удалений

Просмотреть файл

@@ -156,7 +156,7 @@ func bulkImportCmdF(command *cobra.Command, args []string) error {
CommandPrettyPrintln("")
if err, lineNumber := a.BulkImportWithPath(rctx, fileReader, nil, !apply, workers, importPath); err != nil {
if err, lineNumber := a.BulkImportWithPath(rctx, fileReader, nil, true, !apply, workers, importPath); err != nil {
CommandPrintErrorln(err.Error())
if lineNumber != 0 {
CommandPrintErrorln(fmt.Sprintf("Error occurred on data file line %v", lineNumber))

Просмотреть файл

@@ -112,6 +112,7 @@ func init() {
ImportValidateCmd.Flags().Bool("check-server-duplicates", true, "Set to false to ignore teams, channels, and users already present on the server")
ImportProcessCmd.Flags().Bool("bypass-upload", false, "If this is set, the file is not processed from the server, but rather directly read from the filesystem. Works only in --local mode.")
ImportProcessCmd.Flags().Bool("extract-content", true, "If this is set, document attachments will be extracted and indexed during the import process. It is advised to disable it to improve performance.")
ImportListCmd.AddCommand(
ImportListAvailableCmd,
@@ -271,11 +272,14 @@ func importProcessCmdF(c client.Client, command *cobra.Command, args []string) e
}
}
extractContent, _ := command.Flags().GetBool("extract-content")
job, _, err := c.CreateJob(context.TODO(), &model.Job{
Type: model.JobTypeImportProcess,
Data: map[string]string{
"import_file": importFile,
"local_mode": strconv.FormatBool(isLocal && bypassUpload),
"import_file": importFile,
"local_mode": strconv.FormatBool(isLocal && bypassUpload),
"extract_content": strconv.FormatBool(extractContent),
},
})
if err != nil {

Просмотреть файл

@@ -210,7 +210,11 @@ func (s *MmctlUnitTestSuite) TestImportProcessCmdF() {
importFile := "import.zip"
mockJob := &model.Job{
Type: model.JobTypeImportProcess,
Data: map[string]string{"import_file": importFile, "local_mode": "false"},
Data: map[string]string{
"import_file": importFile,
"local_mode": "false",
"extract_content": "false",
},
}
s.client.

Просмотреть файл

@@ -27,8 +27,9 @@ Options
::
--bypass-upload If this is set, the file is not processed from the server, but rather directly read from the filesystem. Works only in --local mode.
-h, --help help for process
--bypass-upload If this is set, the file is not processed from the server, but rather directly read from the filesystem. Works only in --local mode.
--extract-content If this is set, document attachments will be extracted and indexed during the import process. It is advised to disable it to improve performance. (default true)
-h, --help help for process
Options inherited from parent commands
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~