---- Changes since 1.370 ----
Added an option on the backup form to create the destination directory if missing.
Re-wrote the backup form to use the new Webmin UI library.
+Improved support for Debian/Ubuntu systems that can have different PostgreSQL versions.
# Returns files and directories that can be backed up
sub backup_config_files
{
-return ( $config{'hba_conf'} );
+return ( $hba_conf_file );
}
# pre_backup(&files)
-hba_conf=/etc/postgresql/7.4/main/pg_hba.conf
+hba_conf=/etc/postgresql/7.4/main/pg_hba.conf /etc/postgresql/8.2/main/pg_hba.conf
psql=/usr/bin/psql
-start_cmd=/etc/init.d/postgresql-7.4 start
+start_cmd=if [ -r /etc/init.d/postgresql-7.4 ]; then /etc/init.d/postgresql-7.4 start; else /etc/init.d/postgresql-8.2 start; fi
basedb=template1
perpage=25
plib=
pass=
login=postgres
-stop_cmd=/etc/init.d/postgresql-7.4 stop
+stop_cmd=if [ -r /etc/init.d/postgresql-7.4 ]; then /etc/init.d/postgresql-7.4 stop; else /etc/init.d/postgresql-8.2 stop; fi
pid_file=/var/run/postmaster.pid
nodbi=0
dump_cmd=/usr/bin/pg_dump
stop_cmd=Command to stop PostgreSQL,3,Kill process
setup_cmd=Command to initialize PostgreSQL,3,None
pid_file=Path to postmaster PID file,8
-hba_conf=Path to host access config file,8
+hba_conf=Paths to host access config file,9,60,3,\t
host=PostgreSQL host to connect to,3,localhost
port=PostgreSQL port to connect to,3,Default
dump_cmd=Path to pg_dump command,0
stop_cmd=Ordre per aturar PostgreSQL,3,Mata el procés
setup_cmd=Ordre per inicialitzar PostgreSQL,3,Cap
pid_file=Camí del fitxer de PID de postmaster,8
-hba_conf=Camí del fitxer de configuració d'accés a hosts,8
host=Host PostgreSQL a connectar,3,localhost
port=Port PostgreSQL a connectar,3,Defecte
dump_cmd=Camí de l'ordre pg_dump,0
blob_mode=Zeige Blob- und Textfelder als,1,0-Daten in der Tabelle,1-Zu downloadende Verbindungen
date_subs=Verwende <tt>strftime</tt> als Ersatz der Backup-Speicherorte?,1,1-Ja,0-Nein
dump_cmd=Pfad zu <tt>pg_dump</tt>,0
-hba_conf=Pfad zur Host-Zugriff-Konfigurationsdatei,0
host=Verbinde zu PostgreSQL-Host,3,Localhost
line1=Konfigurierbare Options,11
line2=Systemkonfiguration,11
start_cmd=Comando para arrancar PostgreSQL,0
stop_cmd=Comando para parar PostgreSQL,3,Matar proceso
pid_file=Trayectoria a archivo PID del jefe de estafeta de correos,0
-hba_conf=Trayectoria archivo de configuración de acceso de máquinas,0
perpage=Número de filas a mostrar por página,0
host=Máquina PostgreSQL a conectarse,3,Local
unix=Usuario de Unix como el que ejecutar los comandos de PostgreSQL,3,root
stop_cmd=Commande pour arrêter PostgreSQL,3,Tuer le processus
setup_cmd=Commande pour initialiser PostgreSQL,3,Aucune
pid_file=Chemin d'accès au fichier PID du postmaster,0
-hba_conf=Chemin d'accès au fichier de configuration d'accès aux hôtes,0
host=Hôte PostgreSQL auquel se connecter,3,localhost
port=Port PostgreSQL auquel se connecter,3,Par défaut
dump_cmd=Chemin d'accès à la commande pg_dump,0
-hba_conf=pg_hba.confファイル,0
start_cmd=PostgreSQL起動コマンド,0
rstr_cmd=pg_restore コマンドのパス,0
plib=PostgreSQL シェアードライブラリ,3,必要無し
stop_cmd=PostgreSQLÄä»ß¥³¥Þ¥ó¥É,3,Kill ¥×¥í¥»¥¹
setup_cmd=PostgreSQL ½é´ü²½¥³¥Þ¥ó¥É,3,̵¤·
pid_file=postmaster PID ¥Õ¥¡¥¤¥ë,0
-hba_conf=pg_hba.conf¥Õ¥¡¥¤¥ë,0
host=PostgreSQLÀܳ¥Û¥¹¥È,3,¥í¡¼¥«¥ë¥Û¥¹¥È
port=PostgreSQL¤ÎÀܳ¥Ý¡¼¥È,3,¥Ç¥Õ¥©¥ë¥È
dump_cmd=pg_dump ¥³¥Þ¥ó¥É¤Î¥Ñ¥¹,0
-hba_conf=호스트 접근 설정 파일 경로,8
start_cmd=PostgreSQL 시작 명령,0
rstr_cmd=pg_restore 명령 경로,0
plib=PostgreSQL 공유 라이브러리 경로,3,필요 없음
stop_cmd=PostgreSQL Á¤Áö ¸í·É,3,ÇÁ·Î¼¼½º Á×ÀÓ
setup_cmd=PostgreSQL ÃʱâÈ ¸í·É,3,¾øÀ½
pid_file=postmaster PID ÆÄÀÏ °æ·Î,8
-hba_conf=È£½ºÆ® Á¢±Ù ¼³Á¤ ÆÄÀÏ °æ·Î,8
host=¿¬°áÇÒ PostgreSQL È£½ºÆ®,3,localhost
port=¿¬°áÇÒ PostgreSQL Æ÷Æ®,3,±âº»
dump_cmd=pg_dump ¸í·É °æ·Î,0
start_cmd=Polecenie uruchamiaj±ce PostgreSQLa,0
stop_cmd=Polecenie zatrzymuj±ce PostgreSQLa,3,Zabicie procesu
pid_file=¦cie¿ka z numerem PID procesu <tt>postmaster</tt>,0
-hba_conf=¦cie¿ka do pliku konfiguracyjnego dostêpu hostów,0
perpage=Ilo¶æ linii wy¶wietlanych na stronie,0
host=Host PostgreSQLa, z którym siê ³±czyæ,3,Localhost
stop_cmd=ëÏÍÁÎÄÁ ÄÌÑ ÏÓÔÁÎÏ×ËÉ PostgreSQL,3,õÂÉÔØ ÐÒÏÃÅÓÓ
setup_cmd=ëÏÍÁÎÄÁ ÄÌÑ ÉÎÉÃÉÁÌÉÚÁÃÉÉ PostgreSQL,3,îÅÔ
pid_file=ðÕÔØ Ë ÆÁÊÌÕ PID postmaster,0
-hba_conf=ðÕÔØ Ë ÆÁÊÌ ÎÁÓÔÒÏÅË ÄÏÓÔÕÐÎÙÈ ÕÚÌÏ×,0
host=õÚÅÌ PostgreSQL ÄÌÑ ÓÏÅÄÉÎÅÎÉÊ,3,localhost
unix=ðÏÌØÚÏ×ÁÔÅÌØ unix, ÏÔ ËÏÔÏÒÏÇÏ ÂÕÄÕÔ ÚÁÐÕÓËÁÔØÓÑ ËÏÍÁÎÄÙ PostgreSQL,3,root
start_cmd=Kommando för att starta PostgreSQL,0
stop_cmd=Kommando för att stanna PostgreSQL,3,Döda processen
pid_file=Sökväg till postmaster-PID-fil,0
-hba_conf=Sökväg till konfigurationsfil för datortillgång,0
perpage=Antal rader som ska visas per sida,0
host=PostgreSQL-dator att koppla upp mot,3,Localhost
stop_cmd=Command to stop PostgreSQL,3,Kill process
setup_cmd=Command to initialize PostgreSQL,3,None
pid_file=Path to postmaster PID file,0
-hba_conf=Path to host access config file,0
host=PostgreSQL host to connect to,3,localhost
port=PostgreSQL port to connect to,3,Default
dump_cmd=Path to pg_dump command,0
-hba_conf=Øëÿõ äî ôàéë íàñòðîþâàíü äîñòóïíèõ âóçë³â,0\r
start_cmd=Êîìàíäà äëÿ çàïóñêó PostgreSQL,0\r
plib=Øëÿõ äî ïîä³ëþâàíèõ á³áë³îòåê PostgreSQL,3,Íå ïîòð³áíèé\r
pass=Ïàðîëü àäì³í³ñòðàòîðà,12\r
start_cmd=Æô¶¯ PostgreSQL µÄÃüÁî,0
stop_cmd=Í£Ö¹ PostgreSQL µÄÃüÁî,3,¹Ø±Õ½ø³Ì
pid_file=postmaster ½ø³Ì±êʶÎļþµÄ·¾¶,0
-hba_conf=Ö÷»ú·ÃÎÊÅäÖÃÎļþ·¾¶,0
perpage=ÿҳÏÔʾµÄÐÐÊý,0
-hba_conf=主机访问配置文件路径,0
start_cmd=启动 PostgreSQL 的命令,0
perpage=每页显示的行数,0
plib=PostgreSQL 共享库路径,3,不需要
start_cmd=±Ò°Ê PostgreSQL ªº©R¥O,0\r
stop_cmd=°±¤î PostgreSQL ªº©R¥O,3,Ãö³¬µ{§Ç
pid_file=postmaster PIDÀɮ׸ô®|,0
-hba_conf=¥D¾÷¶i¤J°t¸mÀɮ׸ô®|,0
perpage=¨C¶Åã¥Üªº¦æ¼Æ,0
host=PostgreSQL¥D¾÷³s½u¨ì,3,¥»¦aºÝ
unix=°õ¦æPostgreSQL«ü¥OªºUnix¨Ï¥ÎªÌ,3,root
-hba_conf=主機進入配置檔案路徑,0
start_cmd=啟動 PostgreSQL 的命令,0
host=PostgreSQL主機連線到,3,本地端
perpage=每頁顯示的行數,0
&ReadParse();
$access{'users'} || &error($text{'host_ecannot'});
-&lock_file($config{'hba_conf'});
+&lock_file($hba_conf_file);
@hosts = &get_hba_config();
$host = $hosts[$in{'idx'}];
&swap_hba($host, $hosts[$in{'idx'}+1]);
-&unlock_file($config{'hba_conf'});
+&unlock_file($hba_conf_file);
&restart_postgresql();
&webmin_log('move', 'hba',
$host->{'type'} eq 'local' ? 'local' :
}
# Check for the config file
-if (!-r $config{'hba_conf'}) {
+if (!-r $hba_conf_file) {
&ui_print_header(undef, $text{'index_title'}, "", "intro", 1, 1, 0,
&help_search_link("postgresql", "man", "doc", "google"));
+ ($hba_conf_file) = split(/\t+/, $config{'hba_conf'});
if ($config{'setup_cmd'}) {
# Offer to setup DB for first time
- print &text('index_setup', "<tt>$config{'hba_conf'}</tt>",
+ print &text('index_setup', "<tt>$hba_conf_file</tt>",
"<tt>$config{'setup_cmd'}</tt>"),"<p>\n";
print "<form action=setup.cgi><center>\n";
print "<input type=submit value='$text{'index_setupok'}'>\n";
}
else {
# Config file wasn't found
- print &text('index_ehba', "<tt>$config{'hba_conf'}</tt>",
+ print &text('index_ehba', "<tt>$hba_conf_file</tt>",
"$gconfig{'webprefix'}/config.cgi?$module_name"),"<p>\n";
}
&ui_print_footer("/", $text{'index'});
return 0 if (!-x $config{'psql'});
if ($_[0]) {
# Check for .conf and if can login
- return 1 if (!-r $config{'hba_conf'});
+ return 1 if (!-r $hba_conf_file);
return 2 if (&is_postgresql_running() == 1);
}
return 1;
}
$max_dbs = $config{'max_dbs'};
}
+foreach my $hba (split(/\t+/, $config{'hba_conf'})) {
+ if (-r $hba) {
+ $hba_conf_file = $hba;
+ last;
+ }
+ }
$cron_cmd = "$module_config_directory/backup.pl";
if (!$config{'nodbi'}) {
sub get_hba_config
{
local $lnum = 0;
-open(HBA, $config{'hba_conf'});
+open(HBA, $hba_conf_file);
while(<HBA>) {
s/\r|\n//g;
s/^\s*#.*$//g;
# create_hba(&hba, version)
sub create_hba
{
-local $lref = &read_file_lines($config{'hba_conf'});
+local $lref = &read_file_lines($hba_conf_file);
push(@$lref, &hba_line($_[0], $_[1]));
&flush_file_lines();
}
# delete_hba(&hba, version)
sub delete_hba
{
-local $lref = &read_file_lines($config{'hba_conf'});
+local $lref = &read_file_lines($hba_conf_file);
splice(@$lref, $_[0]->{'line'}, 1);
&flush_file_lines();
}
# modify_hba(&hba, version)
sub modify_hba
{
-local $lref = &read_file_lines($config{'hba_conf'});
+local $lref = &read_file_lines($hba_conf_file);
splice(@$lref, $_[0]->{'line'}, 1, &hba_line($_[0], $_[1]));
&flush_file_lines();
}
# swap_hba(&hba1, &hba2)
sub swap_hba
{
-local $lref = &read_file_lines($config{'hba_conf'});
+local $lref = &read_file_lines($hba_conf_file);
local $line0 = $lref->[$_[0]->{'line'}];
local $line1 = $lref->[$_[1]->{'line'}];
$lref->[$_[1]->{'line'}] = $line0;
require './postgresql-lib.pl';
&ReadParse();
-&lock_file($config{'hba_conf'});
+&lock_file($hba_conf_file);
$v = &get_postgresql_version();
@all = &get_hba_config($v);
$host = $all[$in{'idx'}] if (!$in{'new'});
&modify_hba($host, $v);
}
}
-&unlock_file($config{'hba_conf'});
+&unlock_file($hba_conf_file);
&restart_postgresql();
&webmin_log($in{'new'} ? 'create' : $in{'delete'} ? 'delete' : 'modify',
'hba', $host->{'type'} eq 'local' ? 'local' :
&ReadParse();
$access{'users'} || &error($text{'host_ecannot'});
-&lock_file($config{'hba_conf'});
+&lock_file($hba_conf_file);
@hosts = &get_hba_config();
$host = $hosts[$in{'idx'}];
&swap_hba($host, $hosts[$in{'idx'}-1]);
-&unlock_file($config{'hba_conf'});
+&unlock_file($hba_conf_file);
&restart_postgresql();
&webmin_log('move', 'hba',
$host->{'type'} eq 'local' ? 'local' :