Skip to main content

whitehall: Rake tasks

These rake tasks come from the desc descriptions in whitehall’s lib/tasks folder. To change what’s shown here, change the description in the code.

analyse_component_usage

Analyse component usage

k exec deploy/whitehall-admin -- rake analyse_component_usage[document_class,number_of_docs,type_field_name,type_field_value]

View source (lib/tasks/analyse_component_usage.rake)

data_hygiene:merge_people

Merge people records

k exec deploy/whitehall-admin -- rake data_hygiene:merge_people[person_to_merge,person_to_keep]

View source (lib/tasks/data_hygiene.rake)

data_hygiene:reassign_role_appointment_speeches

Reassign role appointment speeches

k exec deploy/whitehall-admin -- rake data_hygiene:reassign_role_appointment_speeches[old_role_appointment_id,new_role_appointment_id]

View source (lib/tasks/data_hygiene.rake)

db:data:migrate

Run all data migrations, or a specific version assigned to environment variable VERSION

k exec deploy/whitehall-admin -- rake db:data:migrate

View source (lib/tasks/data_migrator.rake)

election:remove_mp_letters

Remove MP from MP’s letters

k exec deploy/whitehall-admin -- rake election:remove_mp_letters

View source (lib/tasks/election.rake)

election:republish_political_content

Republish all political content

k exec deploy/whitehall-admin -- rake election:republish_political_content

View source (lib/tasks/election.rake)

election:end_ministerial_appointments

Removes all current ministerial appointments with the exception of the prime minister.

k exec deploy/whitehall-admin -- rake election:end_ministerial_appointments[end_date]
More about this task
Usage:
  rake election:end_ministerial_appointments
or to specify an end date other than today
  rake election:end_ministerial_appointments[2017-06-09]

View source (lib/tasks/election.rake)

election:mark_political_content_for

Mark editions of a given organisation as political.

k exec deploy/whitehall-admin -- rake election:mark_political_content_for[slug,date,dry_run]
More about this task
Used to retrospectively mark content as political when an organisation is changed to be political.
Usage:
  rake election:mark_political_content_for[organisation_slug,2024-12-03,true]

View source (lib/tasks/election.rake)

election:unmark_political_content_for

Remove political marker from editions of a given organisation.

k exec deploy/whitehall-admin -- rake election:unmark_political_content_for[slug,date,dry_run]
More about this task
Used to retrospectively unmark political content when an organisation is changed to no longer be political.
Usage:
  rake election:unmark_political_content_for[organisation_slug,2024-12-03,true]

View source (lib/tasks/election.rake)

publisher_notifications:send

Send notifications to publishers. Task is run daily. Check Cron job in Helm Charts.

k exec deploy/whitehall-admin -- rake publisher_notifications:send

View source (lib/tasks/publisher_notifications.rake)

publishing_api:redirect_unpublished_statistics_announcement

Manually redirect already unpublished Statistics Announcements

k exec deploy/whitehall-admin -- rake publishing_api:redirect_unpublished_statistics_announcement[slug,alternative_url,locale]

View source (lib/tasks/publishing_api.rake)

publishing_api:redirect_html_attachments:by_content_id

Redirect HTML Attachments to a given URL

k exec deploy/whitehall-admin -- rake publishing_api:redirect_html_attachments:by_content_id[content_id,destination]

View source (lib/tasks/publishing_api.rake)

reporting:matching_docs

Prints a list of content IDs for documents whose govspeak content contains a given regular expression

k exec deploy/whitehall-admin -- rake reporting:matching_docs[regex]

View source (lib/tasks/reporting.rake)

reporting:invalid_editions

Prints a report of all ‘invalid editions’, broken down by edition state

k exec deploy/whitehall-admin -- rake reporting:invalid_editions

View source (lib/tasks/reporting.rake)

reporting:invalid_editions_created_since

Prints a report of all ‘invalid editions’ created since a certain date (e.g. ‘2015-05-08’), broken down by edition state

k exec deploy/whitehall-admin -- rake reporting:invalid_editions_created_since[from_date]

View source (lib/tasks/reporting.rake)

reslug:person

Change a person slug.

k exec deploy/whitehall-admin -- rake reslug:person[old_slug,new_slug]
More about this task
This rake task changes a person's slug in whitehall.

It performs the following steps:
- changes the person's slug
- republishes the person to Publishing API (automatically handles the redirect)

View source (lib/tasks/reslugging.rake)

reslug:role

Change a role slug (DANGER!).

k exec deploy/whitehall-admin -- rake reslug:role[old_slug,new_slug]
More about this task
This rake task changes a roles's slug in whitehall.

It performs the following steps:
- changes the role's slug
- republishes the role to Publishing API (automatically handles the redirect)

View source (lib/tasks/reslugging.rake)

reslug:topical_event

Change a topical_event’s slug in whitehall (DANGER!).

k exec deploy/whitehall-admin -- rake reslug:topical_event[old_slug,new_slug]
More about this task
It performs the following steps:
- changes the topical_events slug
- republishes the topical_event to Publishing API (automatically handles the redirect)

View source (lib/tasks/reslugging.rake)

reslug:html_attachment

Change a html attachment’s slug in whitehall and redirect old slug

k exec deploy/whitehall-admin -- rake reslug:html_attachment[publication_document_id,old_attachment_slug]
More about this task
It performs the following steps:
- changes a html attachment slug
- republishes the document and attachment to Publishing API (automatically handles the redirect)

View source (lib/tasks/reslugging.rake)

reslug:policy_group

Change the slug of a PolicyGroup

k exec deploy/whitehall-admin -- rake reslug:policy_group[old_slug,new_slug]

View source (lib/tasks/reslugging.rake)

reslug:world_location

Change the slug of a WorldLocation

k exec deploy/whitehall-admin -- rake reslug:world_location[old_slug,new_slug]

View source (lib/tasks/reslugging.rake)

reslug:organisation

Change an organisation slug (DANGER!).

k exec deploy/whitehall-admin -- rake reslug:organisation[old_slug,new_slug]
More about this task
This rake task changes the slug of an organisation in whitehall.

It performs the following steps:
- updates the Organisation's slug
- republishes the org to Publishing API (which creates a redirect)

View source (lib/tasks/reslugging.rake)

reslug:statistics_annoucement

Change the slug of a StatisticsAnnouncement

k exec deploy/whitehall-admin -- rake reslug:statistics_annoucement[old_slug,new_slug]

View source (lib/tasks/reslugging.rake)

publishing:scheduled:requeue_all_jobs

Clears all scheduled publishing jobs then requeues all scheduled editions (and open/close actions for editions that ‘HasOpeningAndClosingDates’). This task is intended to be used after a db restore or in the event of the Sidekiq queue being emptied.

k exec deploy/whitehall-admin -- rake publishing:scheduled:requeue_all_jobs

View source (lib/tasks/scheduled_publishing.rake)

send_review_reminders

Send review reminder emails for when the review_at date has passed

k exec deploy/whitehall-admin -- rake send_review_reminders

View source (lib/tasks/send_review_reminders.rake)

set_taxonomy_topic_email_override

override email notifications for a document collection to a given taxonomy topic, can only be run on against a document that has never been published.

k exec deploy/whitehall-admin -- rake set_taxonomy_topic_email_override[document_collection_id,taxon_content_id,confirmation_string]

View source (lib/tasks/set_taxonomy_topic_email_override.rake)

sidekiq_queues_stats

display Sidekiq job stats across all queues and sets

k exec deploy/whitehall-admin -- rake sidekiq_queues_stats

View source (lib/tasks/sidekiq_queues_stats.rake)

taxonomy:rebuild_cache

Rebuild the taxonomy cache

k exec deploy/whitehall-admin -- rake taxonomy:rebuild_cache

View source (lib/tasks/taxonomy.rake)

taxonomy:populate_end_to_end_test_data

Populate end-to-end test data

k exec deploy/whitehall-admin -- rake taxonomy:populate_end_to_end_test_data

View source (lib/tasks/taxonomy.rake)

republish_attachments

Republish all documents with non-pdf attachments

k exec deploy/whitehall-admin -- rake republish_attachments[content_type,weeks_ago,state]

View source (lib/tasks/attachments/republish_attachments.rake)

repubish_docs_with_attachments

Republish all documents with attachments for organisations

k exec deploy/whitehall-admin -- rake repubish_docs_with_attachments

View source (lib/tasks/attachments/republish_docs_with_attachments.rake)

republish_draft_html_attachments_associated_with_responses

Republish all documents with draft html attachments whose parent is a `Response`

k exec deploy/whitehall-admin -- rake republish_draft_html_attachments_associated_with_responses

View source (lib/tasks/attachments/republish_draft_html_attachments_associated_with_responses.rake)

republish_historically_political_html_attachments

Republish all documents with html attachments which are historically political

k exec deploy/whitehall-admin -- rake republish_historically_political_html_attachments

View source (lib/tasks/attachments/republish_historically_political_html_attachments.rake)

republish_nation_inapplicable_html_attachments

Republish all documents with html attachments and national inapplicabilites

k exec deploy/whitehall-admin -- rake republish_nation_inapplicable_html_attachments

View source (lib/tasks/attachments/republish_nation_applicable_html_attachments.rake)