diff --git a/main.go b/main.go index 682a264..f0c6f03 100644 --- a/main.go +++ b/main.go @@ -79,6 +79,6 @@ func migratePosts() { WordpressUser: wordpressKey, WordpressPassword: wordpressSecret, } - postMigration.Execute() - fmt.Println("Migration complete, please check database for results.") + results := postMigration.Execute() + fmt.Println("Migration complete, migrated", len(results), "Posts") } diff --git a/results.txt b/results.txt new file mode 100644 index 0000000..eead398 Binary files /dev/null and b/results.txt differ diff --git a/services/migration/migrate-posts.go b/services/migration/migrate-posts.go index 64868dc..f9f6de4 100644 --- a/services/migration/migrate-posts.go +++ b/services/migration/migrate-posts.go @@ -89,6 +89,13 @@ func (migration MigratePosts) Execute() []PostResult { wordPressCategoryIds = append(wordPressCategoryIds, categoryResult.WordpressId) firstCategoryResult = categoryResult } + + if len(wordPressCategoryIds) == 0 { + errorMessage = "This post has no categories and is broken on the production site." + createPostFailureResult(postId, errorMessage, migration.ResultsDatabase) + continue + } + createWordpressPost.Categories = wordPressCategoryIds //Get Author ID editor, findEditorErr := GetEditor(postBase.Author, migration.ResultsDatabase) diff --git a/services/slowtwitch/url-converter.go b/services/slowtwitch/url-converter.go index 27440d3..cb47d55 100644 --- a/services/slowtwitch/url-converter.go +++ b/services/slowtwitch/url-converter.go @@ -27,5 +27,6 @@ func convert(path string) string { output = strings.ReplaceAll(output, ")", "_") output = strings.ReplaceAll(output, "?", "") output = strings.ReplaceAll(output, ",", "") + output = strings.ReplaceAll(output, "%", "%25") return output }