<?php
// Creates or updates the tables of the AfterLogic webmail installed in $WEB__DIR through its own API.
// Exit code 1 when the API or its settings are not usable.

define('ROOTPATH', realpath(getenv('WEB__DIR')) . '/');
include_once ROOTPATH . 'libraries/afterlogic/api.php';

if (!CApi::IsValid()) {
	exit(1);
}
$settings =& CApi::GetSettings();
if (!$settings) {
	exit(1);
}

CDbCreator::ClearStatic();
CDbCreator::CreateConnector($settings);
CApi::Manager('db')->SyncTables();
exit(0);
