7 include_once (
'WHAT/Lib.Common.php');
8 include_once (
'FDL/freedom_util.php');
9 include_once (
'FDL/Class.SearchDoc.php');
10 include_once (
'WHAT/Lib.System.php');
12 include_once (
'FDL/Class.Form1NF.php');
14 ini_set(
'memory_limit',
'1G');
19 echo
" " . __FILE__ .
"\n";
20 echo
" --config=<config.xml>\n";
21 echo
" --outputsql=<file_name> | --outputpgservice=<pgservice>]\n";
22 echo
" [--tmppgservice=<tmp_pgservice_name>] (default tmp_1nf)\n";
23 echo
" [--tmpschemaname=<tmp_schemaname>] (default 1nf)\n";
24 echo
" [--tmpemptydb=<yes|no>] (default yes)\n";
25 echo
" [--sqllog=<file>] (default none)\n";
30 $usage->setDefinitionText(
"Export 1nf");
35 'config' =>
$usage->addRequiredParameter(
"config",
"configuration file") ,
36 'outputsql' =>
$usage->addOptionalParameter(
"outputsql",
"File to output sql", null,
"") ,
37 'outputpgservice' =>
$usage->addOptionalParameter(
"outputpgservice",
"Pgservice to output", null,
"") ,
38 'tmppgservice' =>
$usage->addOptionalParameter(
"tmppgservice",
"Tmp pgservice name", null,
'tmp_1nf') ,
39 'tmpschemaname' =>
$usage->addOptionalParameter(
'tmpschemaname',
"Tmp shema name", null,
'tmp_1nf') ,
40 'tmpemptydb' =>
$usage->addOptionalParameter(
"tmpemptydb",
"Tmp empty database", null,
"yes") ,
41 'sqllog' =>
$usage->addOptionalParameter(
"sqllog",
"File to log", null,
"") ,
48 if (!is_file(
$parms[
'config'])) {
49 $action->error(sprintf(_(
"Error: config file '%s' is not a file.",
$parms[
'config'])));
52 if (empty(
$parms[
'outputsql']) && empty(
$parms[
'outputpgservice'])) {
53 $action->error(sprintf(_(
"Error: at least one of those parameters is mandatory --outputsql --outputpgservice")));
56 if (empty(
$parms[
'tmppgservice'])) {
57 $action->error(sprintf(_(
"Error: missing or empty --tmppgservice")));
60 if (empty(
$parms[
'tmpschemaname'])) {
61 $action->error(sprintf(_(
"Error: missing or empty --tmpschemaname")));
65 if (
$parms[
'tmpemptydb'] !=
'' && in_array(
$parms[
'tmpemptydb'], array(
72 $parms[
'tmpemptydb'] =
'no';
73 } elseif (
$parms[
'tmpemptydb'] ==
'' || in_array(
$parms[
'tmpemptydb'], array(
81 $parms[
'tmpemptydb'] =
'yes';
83 $action->error(sprintf(_(
"Error: parameter tmpemptydb '%s' is not allowed.")));
Verify arguments for wsh programs.