Fix: active alternate root path with virtualmin
This commit is contained in:
parent
a39c95e3b4
commit
dc82d84e5c
@ -31,7 +31,7 @@ return "Regis Houssin";
|
|||||||
# script_dolibarr_versions()
|
# script_dolibarr_versions()
|
||||||
sub script_dolibarr_versions
|
sub script_dolibarr_versions
|
||||||
{
|
{
|
||||||
return ( "3.0.0", "2.9.0" );
|
return ( "3.0.0" );
|
||||||
}
|
}
|
||||||
|
|
||||||
sub script_dolibarr_category
|
sub script_dolibarr_category
|
||||||
@ -180,9 +180,11 @@ $err && return (0, "Failed to extract source : $err");
|
|||||||
# Add config file
|
# Add config file
|
||||||
local $cfiledir = "$opts->{'dir'}/conf/";
|
local $cfiledir = "$opts->{'dir'}/conf/";
|
||||||
local $docdir = "$opts->{'dir'}/documents";
|
local $docdir = "$opts->{'dir'}/documents";
|
||||||
|
local $altdir = "$opts->{'dir'}/custom";
|
||||||
local $cfile = $cfiledir."conf.php";
|
local $cfile = $cfiledir."conf.php";
|
||||||
local $oldcfile = &transname();
|
local $oldcfile = &transname();
|
||||||
local $olddocdir = &transname();
|
local $olddocdir = &transname();
|
||||||
|
local $oldaltdir = &transname();
|
||||||
local $url;
|
local $url;
|
||||||
|
|
||||||
$tmpl = &get_template($d->{'template'});
|
$tmpl = &get_template($d->{'template'});
|
||||||
@ -204,23 +206,27 @@ if ($opts->{'path'} =~ /\w/) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!$upgrade) {
|
if (!$upgrade) {
|
||||||
local $cdef = "$opts->{'dir'}/conf/conf.php.example";
|
local $cdef = "$opts->{'dir'}/conf/conf.php.example";
|
||||||
&run_as_domain_user($d, "cp ".quotemeta($cdef)." ".quotemeta($cfile));
|
&run_as_domain_user($d, "cp ".quotemeta($cdef)." ".quotemeta($cfile));
|
||||||
&set_ownership_permissions(undef, undef, 0777, $cfiledir);
|
&set_ownership_permissions(undef, undef, 0777, $cfiledir);
|
||||||
&set_ownership_permissions(undef, undef, 0666, $cfile);
|
&set_ownership_permissions(undef, undef, 0666, $cfile);
|
||||||
&run_as_domain_user($d, "mkdir ".quotemeta($docdir));
|
&run_as_domain_user($d, "mkdir ".quotemeta($docdir));
|
||||||
&set_ownership_permissions(undef, undef, 0777, $docdir);
|
&set_ownership_permissions(undef, undef, 0777, $docdir);
|
||||||
}
|
&run_as_domain_user($d, "mkdir ".quotemeta($altdir));
|
||||||
|
&set_ownership_permissions(undef, undef, 0777, $altdir);
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
# Preserve old config file and documents directory
|
# Preserve old config file, documents and custom directory
|
||||||
©_source_dest($cfile, $oldcfile);
|
©_source_dest($cfile, $oldcfile);
|
||||||
©_source_dest($docdir, $olddocdir);
|
©_source_dest($docdir, $olddocdir);
|
||||||
}
|
©_source_dest($altdir, $oldaltdir);
|
||||||
|
}
|
||||||
|
|
||||||
if ($upgrade) {
|
if ($upgrade) {
|
||||||
# Put back original config file and documents directory
|
# Put back original config file, documents and custom directory
|
||||||
©_source_dest_as_domain_user($d, $oldcfile, $cfile);
|
©_source_dest_as_domain_user($d, $oldcfile, $cfile);
|
||||||
©_source_dest_as_domain_user($d, $olddocdir, $docdir);
|
©_source_dest_as_domain_user($d, $olddocdir, $docdir);
|
||||||
|
©_source_dest_as_domain_user($d, $oldaltdir, $altdir);
|
||||||
|
|
||||||
# First page (Update database schema)
|
# First page (Update database schema)
|
||||||
local @params = ( [ "action", "upgrade" ],
|
local @params = ( [ "action", "upgrade" ],
|
||||||
@ -266,6 +272,8 @@ else {
|
|||||||
[ "main_force_https", $opts->{'forcehttps'} ],
|
[ "main_force_https", $opts->{'forcehttps'} ],
|
||||||
[ "dolibarr_main_db_character_set", $charset ],
|
[ "dolibarr_main_db_character_set", $charset ],
|
||||||
[ "dolibarr_main_db_collation", $collate ],
|
[ "dolibarr_main_db_collation", $collate ],
|
||||||
|
[ "usealternaterootdir", "1" ],
|
||||||
|
[ "main_alt_dir_name", "custom" ],
|
||||||
);
|
);
|
||||||
local $err = &call_dolibarr_wizard_page(\@params, "etape1", $d, $opts);
|
local $err = &call_dolibarr_wizard_page(\@params, "etape1", $d, $opts);
|
||||||
return (-1, "Dolibarr wizard failed : $err") if ($err);
|
return (-1, "Dolibarr wizard failed : $err") if ($err);
|
||||||
|
|||||||
@ -204,7 +204,13 @@ if ($_POST["action"] == "set")
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Force https
|
// Force https
|
||||||
$main_force_https = ( (GETPOST("main_force_https") && (GETPOST("main_force_https") == "on" || GETPOST("main_force_https") == 1)) ? '1' : '0');
|
$main_force_https = ( (GETPOST("main_force_https") && ( GETPOST("main_force_https") == "on" || GETPOST("main_force_https") == 1) ) ? '1' : '0');
|
||||||
|
|
||||||
|
// Use alternative directory
|
||||||
|
$main_use_alt_dir = ( (GETPOST("main_use_alt_dir") && ( GETPOST("main_use_alt_dir") == "on" || GETPOST("main_use_alt_dir") == 1) ) ? '' : '#');
|
||||||
|
|
||||||
|
// Alternative root directory name
|
||||||
|
$main_alt_dir_name = ( (GETPOST("main_alt_dir_name") && GETPOST("main_alt_dir_name") != '') ? GETPOST("main_alt_dir_name") : 'custom');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Write conf file on disk
|
* Write conf file on disk
|
||||||
@ -505,7 +511,7 @@ pFooter($error,$setuplang,'jsinfo');
|
|||||||
function write_conf_file($conffile)
|
function write_conf_file($conffile)
|
||||||
{
|
{
|
||||||
global $conf,$langs;
|
global $conf,$langs;
|
||||||
global $_POST,$main_dir,$main_data_dir,$main_force_https;
|
global $_POST,$main_dir,$main_data_dir,$main_force_https,$main_use_alt_dir,$main_alt_dir_name;
|
||||||
global $dolibarr_main_url_root,$dolibarr_main_document_root,$dolibarr_main_data_root,$dolibarr_main_db_host;
|
global $dolibarr_main_url_root,$dolibarr_main_document_root,$dolibarr_main_data_root,$dolibarr_main_db_host;
|
||||||
global $dolibarr_main_db_port,$dolibarr_main_db_name,$dolibarr_main_db_user,$dolibarr_main_db_pass;
|
global $dolibarr_main_db_port,$dolibarr_main_db_name,$dolibarr_main_db_user,$dolibarr_main_db_pass;
|
||||||
global $dolibarr_main_db_type,$dolibarr_main_db_character_set,$dolibarr_main_db_collation,$dolibarr_main_authentication;
|
global $dolibarr_main_db_type,$dolibarr_main_db_character_set,$dolibarr_main_db_collation,$dolibarr_main_authentication;
|
||||||
@ -535,10 +541,10 @@ function write_conf_file($conffile)
|
|||||||
fputs($fp, '$dolibarr_main_document_root=\''.addslashes($main_dir).'\';');
|
fputs($fp, '$dolibarr_main_document_root=\''.addslashes($main_dir).'\';');
|
||||||
fputs($fp,"\n");
|
fputs($fp,"\n");
|
||||||
|
|
||||||
fputs($fp, '#$dolibarr_main_url_root_alt=\''.addslashes($_POST["main_url"]."/custom").'\';');
|
fputs($fp, $main_use_alt_dir.'$dolibarr_main_url_root_alt=\''.addslashes($_POST["main_url"]."/".$main_alt_dir_name).'\';');
|
||||||
fputs($fp,"\n");
|
fputs($fp,"\n");
|
||||||
|
|
||||||
fputs($fp, '#$dolibarr_main_document_root_alt=\''.addslashes($main_dir."/custom").'\';');
|
fputs($fp, $main_use_alt_dir.'$dolibarr_main_document_root_alt=\''.addslashes($main_dir."/".$main_alt_dir_name).'\';');
|
||||||
fputs($fp,"\n");
|
fputs($fp,"\n");
|
||||||
|
|
||||||
fputs($fp, '$dolibarr_main_data_root=\''.addslashes($main_data_dir).'\';');
|
fputs($fp, '$dolibarr_main_data_root=\''.addslashes($main_data_dir).'\';');
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user