From 37226dc0ca43e40a9f37d85469a71df25340cdf8 Mon Sep 17 00:00:00 2001 From: Bruce Bolt Date: Tue, 15 Aug 2023 11:54:47 +0100 Subject: [PATCH] Add temporary rake task to cleanup Whitehall Frontend documents All public rendering has been removed from Whitehall, therefore no content items should exist that believe they should be rendered by Whitehall Frontend. A mismatch currently occurs where router believes these items of content should be redirected, but Content Store has a content item for them (e.g. policy areas). Presumably a temporary rake task or something on a console was run at some distant point in the past to implement the redirects in router, but the content items were never removed. Three issues were caused: - users can access the content items still, even though the content has been changed/withdrawn/moved - running the `register:routes` rake task in Content Store will result in `whitehall-frontend` being registered with router, even though it no longer exists - it's causing us to believe Whitehall Frontend still renders things when updating [these pages](https://docs.publishing.service.gov.uk/document-types.html) in the dev docs This completes that clean-up. --- lib/tasks/temp_cleanup_whitehall_frontend.rake | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 lib/tasks/temp_cleanup_whitehall_frontend.rake diff --git a/lib/tasks/temp_cleanup_whitehall_frontend.rake b/lib/tasks/temp_cleanup_whitehall_frontend.rake new file mode 100644 index 00000000..a551f32d --- /dev/null +++ b/lib/tasks/temp_cleanup_whitehall_frontend.rake @@ -0,0 +1,4 @@ +desc "Removes all legacy content items that were rendered by Whitehall Frontend" +task cleanup_whitehall_frontend: :environment do + ContentItem.where(rendering_app: "whitehall-frontend").delete_all +end