<?php
include_once 'includes/datasets_conf/_base.class.php';
class datasets_conf_delete extends datasets_conf {

function delete_conf($datasets_id) {
	$this->init($datasets_id);

	$fields = $this->new_data_set('fields');
	$fields->delete('where datasets_id='.$datasets_id);

	$data_def_file_name = $this->application_path.'/etc/data_def/'.$this->dsn['dataname'].'.def.conf';
	if(file_exists($data_def_file_name)) unlink($data_def_file_name);
	$data_view_file_name = $this->application_path.'/etc/data_view/'.$this->dsn['dataname'].'.view.conf';
	if(file_exists($data_view_file_name)) unlink($data_view_file_name);
	$search_view_file_name = $this->application_path.'/etc/data_view/'.$this->dsn['dataname'].'_search.view.conf';
	if(file_exists($search_view_file_name)) unlink($search_view_file_name);
	$data_set_file_name = $this->application_path.'/etc/data_set/'.$this->dsn['dataname'].'.set.conf';
	if(file_exists($data_set_file_name)) unlink($data_set_file_name);
	$sql_file_name = $this->application_path.'/etc/sql/'.$this->system.'/'.$this->dsn['dataname'].'.sql';
	if(file_exists($sql_file_name)) unlink($sql_file_name);
	if($_ENV['windir']) {
		$init_file_name = $this->application_path.'/bin/init_'.$this->dsn['dataname'].'.bat';
	} else {
		$init_file_name = $this->application_path.'/bin/init_'.$this->dsn['dataname'].'.sh';
	}
	if(file_exists($init_file_name)) unlink($init_file_name);
}

} // end of class datasets_conf_delete
?>