<?xml version="1.0" encoding="UTF-8"?>
<project name="inc_folders" default="build">
	<target name="folders-create" description="Creates folders, to store build artifacts" depends="create-aliases,folders-delete">
		<!--<mkdir dir="${build.api.dir}"/>-->
		<!--<mkdir dir="${build.coverage.dir}"/>-->
		<mkdir dir="${build.logs.dir}"/>
		<!--<mkdir dir="${build.pdepend.dir}"/>-->
		<mkdir dir="${build.cache.dir}"/>
		<mkdir dir="${build.dir}/test_data"/>
		<mkdir dir="${build.dir}/system/remote_code_coverage"/>

		<if>
			<isfalse value="${local.build}"/>
			<then>
				<copy todir="${base.dir}/system" overwrite="true">
					<fileset dir="${build.dir}/test_data">
						<include name="**/*"/>
					</fileset>
				</copy>

				<echo message="Setting 'RewriteBase /' to solve problems with 'VirtualDocumentRoot' option"/>
				<echo file="${base.dir}/.htaccess" append="true">
					RewriteBase /
				</echo>
			</then>
		</if>
	</target>

	<target name="folders-delete" description="Deletes folders, where build artifacts are stored" depends="create-aliases">
		<!--<delete dir="${build.api.dir}"/>-->
		<!--<delete dir="${build.coverage.dir}"/>-->
		<delete dir="${build.logs.dir}"/>
		<!--<delete dir="${build.pdepend.dir}"/>-->
	</target>

	<target name="config-create" description="Creates '/system/config.php' file" depends="create-aliases,config-delete">
		<touch file="${base.dir}/system/config.php" />

		<echo file="${base.dir}/system/config.php">&lt;?php
			$_CONFIG['Misc']['WriteablePath'] = '/system';
			$_CONFIG['Misc']['RestrictedPath'] = '/system/.restricted';
			$_CONFIG['Misc']['WebsitePath'] = '${website.path}';
			$_CONFIG['Misc']['Domain'] = '${website.domain}';
			$_CONFIG['Misc']['AdminDirectory'] = '/admin';
			$_CONFIG['Misc']['AdminPresetsDirectory'] = '/admin';
			$_CONFIG['Misc']['ApplicationClass'] = 'kApplication';
			$_CONFIG['Misc']['ApplicationPath'] = '/core/kernel/application.php';
			$_CONFIG['Misc']['CacheHandler'] = 'Fake';
			$_CONFIG['Misc']['MemcacheServers'] = 'localhost:11211';
			$_CONFIG['Misc']['CompressionEngine'] = 'php';
			$_CONFIG['Misc']['WebsiteCharset'] = 'utf-8';
			$_CONFIG['Misc']['EnableSystemLog'] = '1';
			$_CONFIG['Misc']['SystemLogMaxLevel'] = '5';
			$_CONFIG['Misc']['TrustProxy'] = '0';

			$_CONFIG['Database']['DBType'] = 'mysql';
			$_CONFIG['Database']['DBHost'] = '${db.host}';
			$_CONFIG['Database']['DBName'] = '${db.name}';
			$_CONFIG['Database']['DBUser'] = '${db.user}';
			$_CONFIG['Database']['DBUserPassword'] = '${db.password}';
			$_CONFIG['Database']['DBCollation'] = 'utf8_general_ci';
			$_CONFIG['Database']['TablePrefix'] = '${db.tableprefix}';
			$_CONFIG['Database']['DBCharset'] = 'utf8';
		</echo>
	</target>

	<target name="config-delete" description="Deletes '/system/config.php' file" depends="create-aliases">
		<delete file="${base.dir}/system/config.php"/>
	</target>
</project>
