-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwdbcreate
More file actions
executable file
·105 lines (71 loc) · 3.48 KB
/
wdbcreate
File metadata and controls
executable file
·105 lines (71 loc) · 3.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
#!/usr/bin/php -q
<?php
include("WHAT/Lib.Common.php");
include("WHAT/wncurses.php");
include("WHAT/wenv.php");
global $_SERVER;
if ($_SERVER['HTTP_HOST'] != "") {
print "<BR><H1>:~(</H1>";
exit;
}
$env = getCurrentDb();
include_once(getPhpEnv($env));
ncurses_winit("Freedom Create Database");
ncurses_getmaxyx($fullscreen, $lines, $columns);
$IP=chop(`hostname -i`);
ncurses_color_set(6);
ncurses_mvaddstr(2,5,sprintf(_("Database : %s"), $dbaccess));
ncurses_mvaddstr(4,5,sprintf(_("Virtual Host : %s on %s"), $servername,$IP));
ncurses_refresh();
//---------------------------------------------------
$dbid=@pg_connect($dbaccess);
$wsh=array(); // application update
$migr=array();// migration
$post=array();// post install
$pre=array(); // pre install
$dump=array();
print "\n";
array_shift($argv);
$args=implode(" ",$argv);
if ($dbid) {
$small = ncurses_newwin(10, 50, 7, 25);
if (!$small) {
ncurses_exit();
}
ncurses_wborder($small,0,0, 0,0, 0,0, 0,0);
ncurses_wcolor_set($small,1);
ncurses_mvwaddstr($small, 4, 5, _("Access to default database : granted "));
ncurses_wattron($small,NCURSES_A_BOLD);
ncurses_mvwaddstr($small, 5, 5, _("Already created. creation aborted"));
ncurses_wattroff($small,NCURSES_A_BOLD);
// show our handiwork and refresh our small window
ncurses_wrefresh($small);
$pressed = ncurses_getch();// wait for a user keypress
ncurses_end();// clean up our screen
exit;
}
$actions[] = "mkdir -p $pubdir/virtual/$dbanakeen/FDLGEN";
$actions[] = "chown $httpuser $pubdir/virtual/$dbanakeen/FDLGEN";
$actions[] = "cd $pubdir/FDLGEN; ln -s ../virtual/$dbanakeen/FDLGEN ".strtoupper($dbfree);
$actions[] = "sed -e 's/@DBNAME@/$dbname/g' $pubdir/httpd.pam.in > /etc/pam.d/httpd_$dbanakeen";
$actions[] = "sed -e 's/@DBNAME@/$dbname/g' $pubdir/httpdwa.pam.in > /etc/pam.d/httpdwa_$dbanakeen";
$actions[] = "sed -e 's/@DBNAME@/anakeen/g' -e 's/@IP@/$IP/g' -e 's/@VIRTUALNAME@/".trim(`hostname -f`)."/g' $pubdir/apachevi.conf.in > $httpconf/71_mod_what_anakeen.conf";
$actions[] = "sed -e 's,@prefix@,$pubdir,g' -e 's/@DBNAME@/$dbanakeen/g' -e 's/@dbname@/".strtolower($dbanakeen)."/g' -e 's/@Dbname@/".ucfirst(strtolower($dbanakeen))."/g' -e 's/@IP@/$IP/g' -e 's/@VIRTUALNAME@/$servername/g' $pubdir/apachev.conf.in > $httpconf/71_mod_what_$dbanakeen.conf";
$actions[] = "$pubdir/CORE/CORE_post I ";
$actions[] = "$pubdir/wsh.php --api=appadmin --method=update --appname=CORE";
$actions[] = "echo \"update paramv set val= str_replace(val,'dbname=anakeen','dbname=$dbname') where val ~ 'dbname'\" | psql $dbpsql";
$actions[] = "echo \"update paramv set val= '".ucfirst(strtolower($dbanakeen))." Connection' where name ='CORE_REALM'\" | psql $dbpsql";
$actions[] = "$pubdir/wsh.php --api=appadmin --method=init --appname=FDL";
$actions[] = "$pubdir/wsh.php --api=set_param --param=FREEDOM_DB --value=\"user=anakeen dbname=$dbfree\"";
$actions[] = "$pubdir/wsh.php --api=set_param --param=CORE_CLIENT --value=\"$dbname\"";
$actions[] = "$pubdir/wsh.php --api=set_param --param=CORE_RFOOT --value=\"$dbfree\"";
$actions[] = "$pubdir/FDL/FDL_post I ";
// $actions[] = "mkdir -p $pubdir/FDLGEN/".strtoupper($dbfree);
$actions[] = "$pubdir/wsh.php --api=appadmin --method=update --appname=FDL";
$actions[] = "$pubdir/CORE/CORE_post U ";
$actions[] = "$pubdir/FDL/FDL_post U ";
ncurses_execute($actions);
ncurses_mvaddstr($lines-2, 4, _("Finished. See file log /tmp/whatchk.log"));
$pressed = ncurses_getch();// wait for a user keypress
ncurses_end();
?>