getMessage()."\ndi:\n".$err->getDebugInfo().
"\nui:\n".$err->getUserInfo()."\n";
exit(1);
}
if(!function_exists('pg_connect')){
trigger_error("PostgreSQL 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";
echo $dbc->getMessage()."\n";
exit(1);
}
$dbc->setFetchMode(DB_FETCHMODE_ASSOC);
$gb =& new GreenBox($dbc, $config);
$tr =& new Transport($dbc, $gb, $config);
$pr =& new Prefs($gb);
//------------------------------------------------------------------------------
// install
//------------------------------------------------------------------------------
echo "#StorageServer install:\n";
echo "# Install ...\n";
#PEAR::setErrorHandling(PEAR_ERROR_PRINT, "%s
\n");
PEAR::setErrorHandling(PEAR_ERROR_DIE, "%s
\n");
#$dbc->setErrorHandling(PEAR_ERROR_RETURN);
$r = $gb->install();
if(PEAR::isError($r)){ echo $r->getMessage()."\n"; echo $r->getUserInfo()."\n"; exit(1); }
#if(PEAR::isError($r)){ echo $r->getUserInfo()."\n"; exit(1); }
//------------------------------------------------------------------------------
// Storage directory writability test
//------------------------------------------------------------------------------
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";
}
//------------------------------------------------------------------------------
// Submodules
//------------------------------------------------------------------------------
$dbc->setErrorHandling(PEAR_ERROR_RETURN);
echo "# Install Transport submodule ...";
$r = $tr->install();
if(PEAR::isError($r)){ echo $r->getMessage()."\n"; echo $r->getUserInfo()."\n"; exit(1); }
echo "\n";
echo "# Install Prefs submodule ...";
$r = $pr->install();
if(PEAR::isError($r)){ echo $r->getUserInfo()."\n"; exit(1); }
echo "\n";
echo "#storageServer submodules: OK\n";
echo "\n";
$dbc->disconnect();
?>