<xf:title>{{ phrase('rebuild_caches') }}</xf:title>

<xf:if is="$success">
	<div class="blockMessage blockMessage--success blockMessage--iconic">{{ phrase('cache_rebuilt_successfully') }}</div>
</xf:if>

<xf:if is="$hasStoppedManualJobs">
	<div class="blockMessage blockMessage--important blockMessage--iconic">
		{{ phrase('there_manual_rebuild_jobs_awaiting_completion_continue_running', {'link': link('tools/run-job')}) }}
	</div>
</xf:if>

<!--[XF:rebuild_top]-->

<xf:set var="$searchBody">
	<xf:selectrow name="options[type]"
		label="{{ phrase('content_type') }}">

		<xf:option>{{ phrase('(all)') }}</xf:option>
		<xf:options source="{{ $xf.app.getContentTypePhrases(true, 'search_handler_class') }}" />
	</xf:selectrow>

	<xf:checkboxrow>
		<xf:option name="options[truncate]">{{ phrase('delete_index_before_rebuilding') }}</xf:option>
	</xf:checkboxrow>

	<xf:numberboxrow name="options[batch]" value="500" min="1"
		label="{{ phrase('items_to_process_per_page') }}" />
</xf:set>
<xf:macro name="rebuild_job"
	arg-header="{{ phrase('rebuild_search_index') }}"
	arg-body="{$searchBody}"
	arg-job="XF:SearchRebuild" />
<!--[XF:after_search]-->

<xf:set var="$threadBody">
	<xf:checkboxrow>
		<xf:option name="options[position_rebuild]" value="1"
			label="{{ phrase('rebuild_position_and_post_counters') }}"
			hint="{{ phrase('will_slow_process_down_only_needed_if_posts_in_incorrect_order') }}" />
	</xf:checkboxrow>
</xf:set>
<xf:macro name="rebuild_job"
	arg-header="{{ phrase('rebuild_threads') }}"
	arg-body="{$threadBody}"
	arg-job="XF:Thread" />
<!--[XF:after_thread]-->

<xf:macro name="rebuild_job"
	arg-header="{{ phrase('rebuild_forums') }}"
	arg-job="XF:Forum" />
<!--[XF:after_forums]-->

<xf:macro name="rebuild_job"
	arg-header="{{ phrase('rebuild_user_caches') }}"
	arg-job="XF:User" />
<!--[XF:after_users]-->

<xf:macro name="rebuild_job"
	arg-header="{{ phrase('rebuild_user_group_promotions') }}"
	arg-job="XF:UserGroupPromotion" />
<!--[XF:after_promotions]-->

<xf:macro name="rebuild_job"
	arg-header="{{ phrase('rebuild_trophies') }}"
	arg-job="XF:Trophy" />
<!--[XF:after_trophies]-->

<xf:macro name="rebuild_job"
	arg-header="{{ phrase('rebuild_reaction_score') }}"
	arg-job="XF:ReactionScore" />
<!--[XF:after_reactions]-->

<xf:set var="$likesContentTypes" value="{$xf.app.getContentTypePhrases(true, 'like_handler_class')}" />
<xf:if is="$likesContentTypes">
	<xf:set var="$likesCountedBody">
		<xf:selectrow name="options[type]"
			label="{{ phrase('content_type') }}">

			<xf:options source="{$likesContentTypes}" />
		</xf:selectrow>
	</xf:set>
	<xf:macro name="rebuild_job"
		arg-header="{{ phrase('rebuild_likes_counted_status') }}"
		arg-body="{$likesCountedBody}"
		arg-job="XF:LikeIsCounted" />
</xf:if>
<!--[XF:after_like_status]-->

<xf:set var="$reactionsCountedBody">
	<xf:selectrow name="options[type]"
		label="{{ phrase('content_type') }}">

		<xf:options source="{{ $xf.app.getContentTypePhrases(true, 'reaction_handler_class') }}" />
	</xf:selectrow>
</xf:set>
<xf:macro name="rebuild_job"
	arg-header="{{ phrase('rebuild_reactions_counted_status') }}"
	arg-body="{$reactionsCountedBody}"
	arg-job="XF:ReactionIsCounted" />
<!--[XF:after_reaction_status]-->

<xf:macro name="rebuild_job"
	arg-header="{{ phrase('rebuild_attachment_thumbnails') }}"
	arg-job="XF:AttachmentThumb" />
<!--[XF:after_thumbnails]-->

<xf:macro name="rebuild_job"
	arg-header="{{ phrase('rebuild_conversations') }}"
	arg-job="XF:Conversation" />
<!--[XF:after_conversations]-->

<xf:macro name="rebuild_job"
	arg-header="{{ phrase('rebuild_profile_posts') }}"
	arg-job="XF:ProfilePost" />
<!--[XF:after_profile_posts]-->

<xf:macro name="rebuild_job"
	arg-header="{{ phrase('rebuild_poll_information') }}"
	arg-job="XF:Poll" />
<!--[XF:after_polls]-->

<xf:set var="$statsBody">
	<xf:numberboxrow name="options[batch]" value="28" min="1"
		label="{{ phrase('days_to_process_per_page') }}" />

	<xf:checkboxrow>
		<xf:option name="options[delete]" value="1"
			label="{{ phrase('delete_existing_cached_data') }}"
			hint="{{ phrase('some_data_can_not_be_rebuilt') }}" />
	</xf:checkboxrow>
</xf:set>
<xf:macro name="rebuild_job"
	arg-header="{{ phrase('rebuild_daily_statistics') }}"
	arg-body="{$statsBody}"
	arg-job="XF:Stats" />
<!--[XF:after_stats]-->

<xf:form action="{{ link('tools/clean-up-permissions') }}" class="block">
	<div class="block-container">
		<h2 class="block-header">{{ phrase('clean_up_permissions') }}</h2>
		<div class="block-body">
			<xf:inforow>{{ phrase('this_will_clean_up_permission_combinations_no_longer_in_use') }}</xf:inforow>
		</div>
		<xf:submitrow submit="{{ phrase('run') }}" />
	</div>
</xf:form>
<!--[XF:after_permissions]-->

<xf:set var="$postMdBody">
	<xf:checkboxrow name="options[types]" listclass="listColumns">
		<xf:option value="attachments"
			label="{{ phrase('attachments') }}"
			selected="true" />
	</xf:checkboxrow>
</xf:set>
<xf:macro name="rebuild_job"
	arg-header="{{ phrase('rebuild_post_embed_metadata') }}"
	arg-body="{$postMdBody}"
	arg-job="XF:PostEmbedMetadata" />

<xf:set var="$conversationMdBody">
	<xf:checkboxrow name="options[types]" listclass="listColumns">
		<xf:option value="attachments"
			label="{{ phrase('attachments') }}"
			selected="true" />
	</xf:checkboxrow>
</xf:set>
<xf:macro name="rebuild_job"
	arg-header="{{ phrase('rebuild_conversation_embed_metadata') }}"
	arg-body="{$conversationMdBody}"
	arg-job="XF:ConversationEmbedMetadata" />

<xf:set var="$profilePostMdBody">
	<xf:checkboxrow name="options[types]" listclass="listColumns">
		<xf:option value="attachments"
			label="{{ phrase('attachments') }}"
			selected="true" />
	</xf:checkboxrow>
</xf:set>
<xf:macro name="rebuild_job"
	arg-header="{{ phrase('rebuild_profile_post_embed_metadata') }}"
	arg-body="{$profilePostMdBody}"
	arg-job="XF:ProfilePostEmbedMetadata" />

<xf:set var="$profilePostCommentMdBody">
	<xf:checkboxrow name="options[types]" listclass="listColumns">
		<xf:option value="attachments"
			label="{{ phrase('attachments') }}"
			selected="true" />
	</xf:checkboxrow>
</xf:set>
<xf:macro name="rebuild_job"
	arg-header="{{ phrase('rebuild_profile_post_comment_embed_metadata') }}"
	arg-body="{$profilePostCommentMdBody}"
	arg-job="XF:ProfilePostCommentEmbedMetadata" />
<!--[XF:after_metadata]-->

<xf:set var="$sitemapBody">
	<xf:inforow>{{ phrase('sitemap_contents_can_be_controlled_via_sitemap_options') }}</xf:inforow>
</xf:set>
<xf:macro name="rebuild_job"
	arg-header="{{ phrase('rebuild_sitemap') }}"
	arg-body="{$sitemapBody}"
	arg-job="XF:Sitemap" />
<!--[XF:after_sitemap]-->

<xf:set var="$gravatarBody">
	<xf:checkboxrow>
		<xf:option name="options[posters_only]" selected="1" label="{{ phrase('limit_to_users_who_have_posted') }}" />
		<xf:option name="options[import_table]" label="{{ phrase('limit_to_imported_users_logged_in_this_table:') }}">
			<xf:textbox name="options[import_table_name]" />
		</xf:option>
		<xf:explain>{{ phrase('fetch_gravatars_job_explain') }}</xf:explain>
	</xf:checkboxrow>
</xf:set>
<xf:macro name="rebuild_job"
	arg-header="{{ phrase('fetch_gravatars_for_users_with_no_avatar') }}"
	arg-body="{$gravatarBody}"
	arg-job="XF:Gravatar" />

<!--[XF:rebuild_bottom]-->

<xf:macro name="rebuild_job" arg-header="!" arg-body="" arg-submit="{{ phrase('rebuild_now') }}" arg-job="!">
	<span class="u-anchorTarget" id="job-{{ $job|replace(':', '-')|to_lower }}"></span>
	<xf:form action="{{ link('tools/rebuild') }}" class="block">
		<div class="block-container">
			<h2 class="block-header">{$header|raw}</h2>
			<xf:if is="$body"><div class="block-body">{$body|raw}</div></xf:if>
			<xf:submitrow submit="{$submit}" />
		</div>
		<xf:hiddenval name="job">{$job}</xf:hiddenval>
	</xf:form>
</xf:macro>