<commit_before>#!/bin/bash

mpath="/srv/hmuriel/jahia2wp-httpd/htdocs"
declare -a paths=("epfl" "epfl/education" "epfl/research" 
	"epfl/research/labs" "epfl/research/labs/dcsl" "epfl/research/labs/nal" 
	"epfl/research/publications" "inside" "inside/students")
for path in "${paths[@]}"
do
	ids=$(wp post list --post_type='page' --format=ids --path="${mpath}/${path}")
	if [ -n "$ids" ]; then
		echo "ids for $path: ${ids[@]}";
		wp post delete --force --path=$mpath/$path $ids
	else
		echo "No posts for $path"
	fi
done<commit_msg>Added functionality to also clean the menues to avoid having duplicates in the custom menu entries (e.g. legal notice)<commit_after>#!/bin/bash

mpath="/srv/hmuriel/jahia2wp-httpd/htdocs"
declare -a paths=("epfl" "epfl/education" "epfl/research" 
	"epfl/research/labs" "epfl/research/labs/dcsl" "epfl/research/labs/nal" 
	"epfl/research/publications" "inside" "inside/students")
for path in "${paths[@]}"
do
	ids=$(wp post list --post_type='page' --format=ids --path="${mpath}/${path}")
	if [ -n "$ids" ]; then
		echo "ids for $path: ${ids[@]}";
		wp post delete --force --path=$mpath/$path $ids
	else
		echo "No posts for $path"
	fi
	# Delete any remaining menu entries
	menu_list=$(wp menu list --fields=term_id --format=ids --path="${mpath}/${path}")
	for menu in $menu_list
	do
		db_ids=$(wp menu item list $menu --fields=db_id --format=ids --path="${mpath}/${path}")
		if [ -n "$db_ids" ]; then
			echo "menu entries from menu $menu to delete: $db_ids";
			wp menu item delete $db_ids --path="${mpath}/${path}";
		fi
	done
done
{'fraction_non_alphanumeric': 0.19297124600638976, 'fraction_numerical': 0.0012779552715654952, 'mean_word_length': 4.25503355704698, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4010874', 'n_tokens_mistral': 622, 'n_tokens_neox': 581, 'n_words': 156}