getMessage()."\ndi:\n".$err->getDebugInfo().
"\nui:\n".$err->getUserInfo()."\n\n";
exit(1);
}
if(!function_exists('domxml_open_file')){
trigger_error("DOMXML PHP extension required and not found.", E_USER_ERROR);
exit(2);
}
PEAR::setErrorHandling(PEAR_ERROR_PRINT, "%s
\n");
$dbc = DB::connect($config['dsn'], TRUE);
if(PEAR::isError($dbc)){
echo "Database connection problem.\n";
echo "Check if database '{$config['dsn']['database']}' exists".
" with corresponding permissions.\n";
echo "Database access is defined by 'dsn' values in var/conf.php.\n";
exit(1);
}
$dbc->setFetchMode(DB_FETCHMODE_ASSOC);
$gb =& new GreenBox($dbc, $config);
$tr =& new Transport($dbc, $gb, $config);
$pr =& new Prefs($gb);
echo "#StorageServer step 2:\n# trying uninstall ...\n";
$dbc->setErrorHandling(PEAR_ERROR_RETURN);
$pr->uninstall();
$tr->uninstall();
$gb->uninstall();
echo "# Install ...\n";
#PEAR::setErrorHandling(PEAR_ERROR_PRINT, "%s
\n");
PEAR::setErrorHandling(PEAR_ERROR_DIE, "%s
\n");
$r = $gb->install();
if(PEAR::isError($r)){ echo $r->getUserInfo()."\n"; exit; }
echo "# Testing ...\n";
$gb->test();
$log = $gb->test_log;
if($log) echo "# testlog:\n{$log}";
#echo "# Reinstall + testdata insert ...\n";
#$gb->reinstall();
#$gb->sessid = $gb->login('root', $gb->config['tmpRootPass']);
#$gb->testData();
#$gb->logout($gb->sessid); unset($gb->sessid);
#echo "# TREE DUMP:\n";
#echo $gb->dumpTree();
echo "# Delete test data ...\n";
$gb->deleteData();
if(!($fp = @fopen($config['storageDir']."/_writeTest", 'w'))){
echo "\nmake {$config['storageDir']} dir webdaemon-writeable".
"\nand run install again\n\n";
exit(1);
}else{
fclose($fp); unlink($config['storageDir']."/_writeTest");
echo "#storageServer main: OK\n";
}
echo "# Install Transport submodule ...";
$r = $tr->install();
if(PEAR::isError($r)){ echo $r->getUserInfo()."\n"; exit; }
echo "\n";
echo "# Install Prefs submodule ...";
$r = $pr->install();
if(PEAR::isError($r)){ echo $r->getUserInfo()."\n"; exit; }
echo "\n";
echo "#storageServer submodules: OK\n";
echo "\n";
$dbc->disconnect();
?>