mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
#NEW force_install_noedit : add value 3 to block all technical parameters excepted main_url (#30080)
* Bookcal : more date check * fix phpcs warning * No error if dateStartTimestamp not yet set * Docker for PROD * Update Readme * Fix else if CodeSniffer warning * Update Readme for Docker * Random DB password * Add install.forced.docker.php * Enable dolibarr_main_url_roo writable in forced mode * revert on main_url editable * force_install_noedit : new value '3' to block all technical parameters excepted main_url, used in install.forced.docker.php * force_install_noedit code 3 corrections * Fix HOST_USER_ID, add HOST_GROUP_ID * Fix phpcs * Not force https if DOL_MAIN_URL_ROOT yet contains https * Space after comma for phpcs * use HOST_GROUP_ID * Explanations to check https * Update main.inc.php --------- Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
This commit is contained in:
parent
7233e91b19
commit
fd5430c9d9
|
|
@ -1,6 +1,7 @@
|
|||
# How to use it ?
|
||||
|
||||
export HOST_USER_ID=$(id -u)
|
||||
export HOST_GROUP_ID=$(id -g)
|
||||
export MYSQL_ROOT_PWD=$(tr -dc A-Za-z0-9 </dev/urandom | head -c 13; echo)
|
||||
|
||||
docker-compose up -d
|
||||
|
|
|
|||
|
|
@ -1,25 +1,15 @@
|
|||
# This docker-compose.yml file is used to build and test quickly
|
||||
# a specific version of Dolibarr
|
||||
#
|
||||
# Before build, define the variable DOLI_VERSION as following:
|
||||
# $ export DOLI_VERSION=4.0.4
|
||||
# And then, you can run :
|
||||
# $ docker-compose up
|
||||
#
|
||||
# More information about Docker-compose : https://docs.docker.com/compose/
|
||||
|
||||
version: "3"
|
||||
|
||||
services:
|
||||
mariadb:
|
||||
container_name: dolibarr-mariadb-dev
|
||||
mariadb-prod:
|
||||
container_name: dolibarr-mariadb-prod
|
||||
image: mariadb:latest
|
||||
environment:
|
||||
MYSQL_ROOT_PASSWORD: $MYSQL_ROOT_PWD
|
||||
MYSQL_DATABASE: "dolibarr-prod"
|
||||
|
||||
web:
|
||||
container_name: dolibarr-web-dev
|
||||
container_name: dolibarr-web-prod
|
||||
build: .
|
||||
|
||||
volumes:
|
||||
|
|
@ -27,12 +17,12 @@ services:
|
|||
- ../../documents:/var/www/html/documents
|
||||
|
||||
depends_on:
|
||||
- mariadb
|
||||
- mariadb-prod
|
||||
environment:
|
||||
WWW_USER_ID: 1000
|
||||
WWW_GROUP_ID: 1000
|
||||
HOST_USER_ID: $HOST_USER_ID
|
||||
HOST_GROUP_ID: $HOST_GROUP_ID
|
||||
DOLI_ROOT_PASSWORD: $MYSQL_ROOT_PWD
|
||||
DOLI_DATABASE: "dolibarr-prod"
|
||||
DOLI_DB_SERVER: "mariadb"
|
||||
DOLI_DB_SERVER: "mariadb-prod"
|
||||
ports:
|
||||
- "8080:80"
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
# See README.md to know how to create a Dolibarr env with docker
|
||||
|
||||
usermod -u "${HOST_USER_ID}" www-data
|
||||
groupmod -g "${HOST_USER_ID}" www-data
|
||||
groupmod -g "${HOST_GROUP_ID}" www-data
|
||||
|
||||
chgrp -hR www-data /var/www/html
|
||||
chmod g+rwx /var/www/html/conf
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ dolibarr_install_syslog("- fileconf: entering fileconf.php page");
|
|||
// installer like DoliWamp, DoliMamp or DoliBuntu).
|
||||
// We first init "forced values" to nothing.
|
||||
if (!isset($force_install_noedit)) {
|
||||
$force_install_noedit = ''; // 1=To block vars specific to distrib, 2 to block all technical parameters
|
||||
$force_install_noedit = ''; // 1=To block vars specific to distrib, 2 to block all technical parameters, 3 to block all technical parameters excepted main_url
|
||||
}
|
||||
if (!isset($force_install_type)) {
|
||||
$force_install_type = '';
|
||||
|
|
@ -220,7 +220,7 @@ if (!empty($force_install_noedit)) {
|
|||
id="main_url"
|
||||
name="main_url"
|
||||
value="<?php print $dolibarr_main_url_root; ?> "
|
||||
<?php if (!empty($force_install_noedit)) {
|
||||
<?php if (!empty($force_install_noedit) && $force_install_noedit != 3) {
|
||||
print ' disabled';
|
||||
}
|
||||
?>
|
||||
|
|
@ -247,7 +247,7 @@ if (!empty($force_install_noedit)) {
|
|||
<?php if (!empty($force_install_mainforcehttps)) {
|
||||
print ' checked';
|
||||
} ?>
|
||||
<?php if ($force_install_noedit == 2 && $force_install_mainforcehttps !== null) {
|
||||
<?php if (($force_install_noedit == 2 || $force_install_noedit == 3) && $force_install_mainforcehttps !== null) {
|
||||
print ' disabled';
|
||||
} ?>
|
||||
>
|
||||
|
|
@ -275,7 +275,7 @@ if (!empty($force_install_noedit)) {
|
|||
id="db_name"
|
||||
name="db_name"
|
||||
value="<?php echo (!empty($dolibarr_main_db_name)) ? $dolibarr_main_db_name : ($force_install_database ? $force_install_database : 'dolibarr'); ?>"
|
||||
<?php if ($force_install_noedit == 2 && $force_install_database !== null) {
|
||||
<?php if (($force_install_noedit == 2 || $force_install_noedit == 3) && $force_install_database !== null) {
|
||||
print ' disabled';
|
||||
} ?>
|
||||
>
|
||||
|
|
@ -387,7 +387,7 @@ if (!empty($force_install_noedit)) {
|
|||
?>
|
||||
<select id="db_type"
|
||||
name="db_type"
|
||||
<?php if ($force_install_noedit == 2 && $force_install_type !== null) {
|
||||
<?php if (($force_install_noedit == 2 || $force_install_noedit == 3) && $force_install_type !== null) {
|
||||
print ' disabled';
|
||||
} ?>
|
||||
>
|
||||
|
|
@ -406,7 +406,7 @@ if (!empty($force_install_noedit)) {
|
|||
id="db_host"
|
||||
name="db_host"
|
||||
value="<?php print(!empty($force_install_dbserver) ? $force_install_dbserver : (!empty($dolibarr_main_db_host) ? $dolibarr_main_db_host : 'localhost')); ?>"
|
||||
<?php if ($force_install_noedit == 2 && $force_install_dbserver !== null) {
|
||||
<?php if (($force_install_noedit == 2 || $force_install_noedit == 3) && $force_install_dbserver !== null) {
|
||||
print ' disabled';
|
||||
} ?>
|
||||
>
|
||||
|
|
@ -423,7 +423,7 @@ if (!empty($force_install_noedit)) {
|
|||
name="db_port"
|
||||
id="db_port"
|
||||
value="<?php print (!empty($force_install_port)) ? $force_install_port : $dolibarr_main_db_port; ?>"
|
||||
<?php if ($force_install_noedit == 2 && $force_install_port !== null) {
|
||||
<?php if (($force_install_noedit == 2 || $force_install_noedit == 3) && $force_install_port !== null) {
|
||||
print ' disabled';
|
||||
} ?>
|
||||
>
|
||||
|
|
@ -440,7 +440,7 @@ if (!empty($force_install_noedit)) {
|
|||
id="db_prefix"
|
||||
name="db_prefix"
|
||||
value="<?php echo(!empty($force_install_prefix) ? $force_install_prefix : (!empty($dolibarr_main_db_prefix) ? $dolibarr_main_db_prefix : 'llx_')); ?>"
|
||||
<?php if ($force_install_noedit == 2 && $force_install_prefix !== null) {
|
||||
<?php if (($force_install_noedit == 2 || $force_install_noedit == 3) && $force_install_prefix !== null) {
|
||||
print ' disabled';
|
||||
} ?>
|
||||
>
|
||||
|
|
@ -461,7 +461,7 @@ if (!empty($force_install_noedit)) {
|
|||
$checked = 1;
|
||||
print ' checked';
|
||||
} ?>
|
||||
<?php if ($force_install_noedit == 2 && $force_install_createdatabase !== null) {
|
||||
<?php if (($force_install_noedit == 2 || $force_install_noedit == 3) && $force_install_createdatabase !== null) {
|
||||
print ' disabled';
|
||||
} ?>
|
||||
>
|
||||
|
|
@ -478,7 +478,7 @@ if (!empty($force_install_noedit)) {
|
|||
id="db_user"
|
||||
name="db_user"
|
||||
value="<?php print (!empty($force_install_databaselogin)) ? $force_install_databaselogin : $dolibarr_main_db_user; ?>"
|
||||
<?php if ($force_install_noedit == 2 && $force_install_databaselogin !== null) {
|
||||
<?php if (($force_install_noedit == 2 || $force_install_noedit == 3) && $force_install_databaselogin !== null) {
|
||||
print ' disabled';
|
||||
} ?>
|
||||
>
|
||||
|
|
@ -501,7 +501,7 @@ if (!empty($force_install_noedit)) {
|
|||
}
|
||||
print dol_escape_htmltag($autofill);
|
||||
?>"
|
||||
<?php if ($force_install_noedit == 2 && $force_install_databasepass !== null) {
|
||||
<?php if (($force_install_noedit == 2 || $force_install_noedit == 3) && $force_install_databasepass !== null) {
|
||||
print ' disabled';
|
||||
} ?>
|
||||
>
|
||||
|
|
@ -522,7 +522,7 @@ if (!empty($force_install_noedit)) {
|
|||
$checked = 1;
|
||||
print ' checked';
|
||||
} ?>
|
||||
<?php if ($force_install_noedit == 2 && $force_install_createuser !== null) {
|
||||
<?php if (($force_install_noedit == 2 || $force_install_noedit == 3) && $force_install_createuser !== null) {
|
||||
print ' disabled';
|
||||
} ?>
|
||||
>
|
||||
|
|
@ -723,7 +723,7 @@ jQuery(document).ready(function() { // TODO Test $( window ).load(function() to
|
|||
console.log("click on db_create_user");
|
||||
init_needroot();
|
||||
});
|
||||
<?php if ($force_install_noedit == 2 && empty($force_install_databasepass)) { ?>
|
||||
<?php if (($force_install_noedit == 2 || $force_install_noedit == 3) && empty($force_install_databasepass)) { ?>
|
||||
jQuery("#db_pass").focus();
|
||||
<?php } ?>
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
$force_install_nophpinfo = true;
|
||||
|
||||
/** @var int $force_install_noedit 1 = Lock and hide environment variables, 2 = Lock all set variables */
|
||||
$force_install_noedit = 2;
|
||||
$force_install_noedit = 3;
|
||||
|
||||
/** @var string $force_install_message Information message */
|
||||
$force_install_message = 'Welcome to your Dolibarr Docker install';
|
||||
|
|
@ -71,4 +71,4 @@ $force_install_dolibarrlogin = 'admin';
|
|||
$force_install_lockinstall = true;
|
||||
|
||||
/** @var string $force_install_module Enable module(s) (Comma separated class names list) */
|
||||
$force_install_module = 'modSociete,modFournisseur,modFacture';
|
||||
$force_install_module = '';
|
||||
|
|
|
|||
|
|
@ -96,6 +96,8 @@ if (@file_exists($forcedfile)) {
|
|||
if (!empty($argv[4])) {
|
||||
$main_data_dir = $argv[4]; // override when executing the script in command line
|
||||
}
|
||||
// In mode 3 the main_url is custom
|
||||
if ($force_install_noedit != 3)
|
||||
$main_url = detect_dolibarr_main_url_root();
|
||||
if (!empty($argv[5])) {
|
||||
$main_url = $argv[5]; // override when executing the script in command line
|
||||
|
|
@ -114,7 +116,7 @@ if (@file_exists($forcedfile)) {
|
|||
$passroot = $argv[7]; // override when executing the script in command line
|
||||
}
|
||||
}
|
||||
if ($force_install_noedit == 2) {
|
||||
if (($force_install_noedit == 2) || ($force_install_noedit == 3)) {
|
||||
if (!empty($force_install_type)) {
|
||||
$db_type = $force_install_type;
|
||||
}
|
||||
|
|
@ -872,7 +874,6 @@ function write_conf_file($conffile)
|
|||
fwrite($fp, '// Take a look at conf.php.example file for an example of '.$conffiletoshowshort.' file'."\n");
|
||||
fwrite($fp, '// and explanations for all possibles parameters.'."\n");
|
||||
fwrite($fp, '//'."\n");
|
||||
|
||||
fwrite($fp, '$dolibarr_main_url_root=\''.dol_escape_php(trim($main_url), 1).'\';');
|
||||
fwrite($fp, "\n");
|
||||
|
||||
|
|
|
|||
|
|
@ -522,6 +522,7 @@ if (!empty($conf->file->main_force_https) && !isHTTPS() && !defined('NOHTTPSREDI
|
|||
$newurl = preg_replace('/^http:/i', 'https:', $_SERVER["SCRIPT_URI"]);
|
||||
}
|
||||
} else {
|
||||
// If HTTPS is not defined in DOL_MAIN_URL_ROOT,
|
||||
// Check HTTPS environment variable (Apache/mod_ssl only)
|
||||
$newurl = preg_replace('/^http:/i', 'https:', DOL_MAIN_URL_ROOT).$_SERVER["REQUEST_URI"];
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user