/**
* Helpers to test SQL connection and send a test email.
* @param $action
* @param $httpVars
* @param $fileVars
* @throws Exception
*/
public function testConnexions($action, $httpVars, $fileVars)
{
$data = array();
AJXP_Utils::parseStandardFormParameters($httpVars, $data, null, "DRIVER_OPTION_");
if ($action == "boot_test_sql_connexion") {
$p = AJXP_Utils::cleanDibiDriverParameters($data["db_type"]);
if ($p["driver"] == "sqlite3") {
$dbFile = AJXP_VarsFilter::filter($p["database"]);
if (!file_exists(dirname($dbFile))) {
mkdir(dirname($dbFile), 0755, true);
}
}
// Should throw an exception if there was a problem.
dibi::connect($p);
dibi::disconnect();
echo 'SUCCESS:Connexion established!';
} else {
if ($action == "boot_test_mailer") {
$mailerPlug = AJXP_PluginsService::findPluginById("mailer.phpmailer-lite");
$mailerPlug->loadConfigs(array("MAILER" => $data["MAILER_ENABLE"]["MAILER_SYSTEM"]));
$mailerPlug->sendMail(array("adress" => $data["MAILER_ENABLE"]["MAILER_ADMIN"]), "Pydio Test Mail", "Body of the test", array("adress" => $data["MAILER_ENABLE"]["MAILER_ADMIN"]));
echo 'SUCCESS:Mail sent to the admin adress, please check it is in your inbox!';
}
}
}