A platform for community discussion. Free, open, simple.
FEATURE: posts:rebake_uncooked_posts to look at mismatching baked_version
Sam Saffron73f178a634e3
diff --git a/lib/tasks/posts.rake b/lib/tasks/posts.rakeindex 31b774f4238..93f149ed519 100644--- a/lib/tasks/posts.rake+++ b/lib/tasks/posts.rake@@ -8,7 +8,7 @@ task 'posts:rebake' => :environment doendtask 'posts:rebake_uncooked_posts' => :environment do- uncooked = Post.where(baked_version: nil)+ uncooked = Post.where('baked_version <> ? or baked_version IS NULL', Post::BAKED_VERSION)rebaked = 0total = uncooked.countdiff --git a/lib/tasks/uploads.rake b/lib/tasks/uploads.rakeindex 8a819d4b393..5186480a449 100644--- a/lib/tasks/uploads.rake+++ b/lib/tasks/uploads.rake@@ -243,7 +243,7 @@ def migration_successful?(db, should_raise = false)raise "rake posts:missing_uploads identified #{count} issues. #{failure_message}" if count > 0 && should_raisesuccess &&= count == 0- count = Post.where('baked_version <> ?', Post::BAKED_VERSION).count+ count = Post.where('baked_version <> ? OR baked_version IS NULL', Post::BAKED_VERSION).countif count > 0puts "No posts require rebaking"else@@ -498,7 +498,7 @@ def migrate_to_s3puts "Flagging all posts containing oneboxes for rebake..."- count = Post.where("cooked LIKE '%class=\"lightbox\"%'").update_all(baked_version: Post::BAKED_VERSION - 1)+ count = Post.where("cooked LIKE '%class=\"lightbox\"%'").update_all(baked_version: nil)puts "#{count} posts were flagged for a rebake"endend