<?php
	require("§lib_inc.php");

	if( !ini_get('safe_mode') )
	{
		set_time_limit(0);
	}
	
	flush();

	drop_index_if_exists("IDX_PAT_LIBELLE", "oxg_patronyms");
	mysql_query($sql_query="CREATE INDEX IDX_PAT_LIBELLE ON oxg_patronyms (libelle)") or mysql_die();

	drop_index_if_exists("IDX_IND_PATRO", "oxg_individuals");
	drop_index_if_exists("IDX_IND_CONT", "oxg_individuals");
	drop_index_if_exists("IDX_IND_IND", "oxg_individuals");
	drop_index_if_exists("IDX_IND_FAM", "oxg_individuals");
	mysql_query($sql_query="CREATE INDEX IDX_IND_PATRO ON oxg_individuals (id_patronym)") or mysql_die();
	mysql_query($sql_query="CREATE INDEX IDX_IND_CONT ON oxg_individuals (contemporary)") or mysql_die();
	mysql_query($sql_query="CREATE INDEX IDX_IND_IND ON oxg_individuals (id_individual)") or mysql_die();
	mysql_query($sql_query="CREATE INDEX IDX_IND_FAM ON oxg_individuals (id_family)") or mysql_die();

	drop_index_if_exists("IDX_EVT_FATHER", "oxg_events");
	drop_index_if_exists("IDX_EVT_TYPE", "oxg_events");
	drop_index_if_exists("IDX_EVT_INFO1", "oxg_events");
	drop_index_if_exists("IDX_EVT_INFO2", "oxg_events");
	drop_index_if_exists("IDX_EVT_INFO3", "oxg_events");
	mysql_query($sql_query="CREATE INDEX IDX_EVT_FATHER ON oxg_events (id_family, id_father, type_father)") or mysql_die();
	mysql_query($sql_query="CREATE INDEX IDX_EVT_TYPE  ON oxg_events (type)") or mysql_die();
	mysql_query($sql_query="CREATE INDEX IDX_EVT_INFO1 ON oxg_events (info1)") or mysql_die();
	mysql_query($sql_query="CREATE INDEX IDX_EVT_INFO2 ON oxg_events (info2)") or mysql_die();
	mysql_query($sql_query="CREATE INDEX IDX_EVT_INFO3 ON oxg_events (info3)") or mysql_die();

	drop_index_if_exists("IDX_EVT2_IND", "oxg_events2");
	drop_index_if_exists("IDX_EVT2_TYPE", "oxg_events2");
	drop_index_if_exists("IDX_EVT2_COUNTRY", "oxg_events2");
	drop_index_if_exists("IDX_EVT2_ZONE", "oxg_events2");
	drop_index_if_exists("IDX_EVT2_CITY", "oxg_events2");
	mysql_query($sql_query="CREATE INDEX IDX_EVT2_IND ON oxg_events2 (id_family, id_individu)") or mysql_die();
	mysql_query($sql_query="CREATE INDEX IDX_EVT2_TYPE ON oxg_events2 (type)") or mysql_die();
	mysql_query($sql_query="CREATE INDEX IDX_EVT2_COUNTRY ON oxg_events2 (id_country)") or mysql_die();
	mysql_query($sql_query="CREATE INDEX IDX_EVT2_ZONE ON oxg_events2 (id_zone)") or mysql_die();
	mysql_query($sql_query="CREATE INDEX IDX_EVT2_CITY ON oxg_events2 (id_city)") or mysql_die();

	drop_index_if_exists("IDX_FLASH_COUNTRY", "oxg_flashlist");
	drop_index_if_exists("IDX_FLASH_CITY", "oxg_flashlist");
	drop_index_if_exists("IDX_FLASH_PAYS", "oxg_flashlist");
	drop_index_if_exists("IDX_FLASH_VILLE", "oxg_flashlist");
	drop_index_if_exists("IDX_FLASH_NAME", "oxg_flashlist");
	drop_index_if_exists("IDX_FLASH_KEY", "oxg_flashlist");
	mysql_query($sql_query="CREATE INDEX IDX_FLASH_COUNTRY ON oxg_flashlist (country)") or mysql_die();
	mysql_query($sql_query="CREATE INDEX IDX_FLASH_CITY ON oxg_flashlist (city)") or mysql_die();
	mysql_query($sql_query="CREATE INDEX IDX_FLASH_PAYS ON oxg_flashlist (pays)") or mysql_die();
	mysql_query($sql_query="CREATE INDEX IDX_FLASH_VILLE ON oxg_flashlist (ville)") or mysql_die();
	mysql_query($sql_query="CREATE INDEX IDX_FLASH_NAME ON oxg_flashlist (name)") or mysql_die();
	mysql_query($sql_query="CREATE INDEX IDX_FLASH_KEY ON oxg_flashlist (id_family, country, zone, city, name)") or mysql_die();

	drop_index_if_exists("IDX_FLASH_MONTH", "oxg_calendar");
	drop_index_if_exists("IDX_FLASH_DAY", "oxg_calendar");
	drop_index_if_exists("IDX_FLASH_TOTAL", "oxg_calendar");
	mysql_query($sql_query="CREATE INDEX IDX_FLASH_MONTH ON oxg_calendar (month)") or mysql_die();
	mysql_query($sql_query="CREATE INDEX IDX_FLASH_DAY ON oxg_calendar (day)") or mysql_die();
	mysql_query($sql_query="CREATE INDEX IDX_FLASH_TOTAL ON oxg_calendar (total)") or mysql_die();

?>
<HTML><H3>
<?php
	display_lng_text("AUTO_CREATE_GEN_BASE");
	echo "</H3>";
	affiche_pied_page_admin(true);
?>
</HTML>