Files
dolibarr-docker-fork/images/22.0.2_wavyzz-php8.2/docker-init.php
estebanthi 2e9c5ffb60
All checks were successful
test / check-update (push) Successful in 4s
test / check-build (push) Successful in 6s
build / build-docker-images (22.0.2_wavyzz) (push) Successful in 32m4s
build / build-docker-images (develop) (push) Successful in 32m29s
Push right reg
2025-10-09 13:10:04 +02:00

50 lines
1.7 KiB
PHP

#!/usr/bin/env php
<?php
# This script is called by the docker-run.sh script to enabled modules during Dolibarr first installation.
# It is embedded into the Docker image of dolibarr/dolibarr.
require_once '../htdocs/master.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
printf("Activating module User... ");
activateModule('modUser');
printf("OK\n");
if (!empty(getenv('DOLI_COMPANY_COUNTRYCODE'))) {
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/ccountry.class.php';
$countryCode = getenv('DOLI_COMPANY_COUNTRYCODE');
$country = new Ccountry($db);
$res = $country->fetch(0,$countryCode);
if ($res > 0 ) {
$s = $country->id.':'.$country->code.':'.$country->label;
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_COUNTRY", $s, 'chaine', 0, '', $conf->entity);
printf('Configuring for country : '.$s."\n");
activateModulesRequiredByCountry($country->code);
} else {
printf('Unable to find country '.$countryCode."\n");
}
}
if (!empty(getenv('DOLI_COMPANY_NAME'))) {
$compname = getenv('DOLI_COMPANY_NAME');
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_NOM", $compname, 'chaine', 0, '', $conf->entity);
}
if (!empty(getenv('DOLI_ENABLE_MODULES'))) {
$mods = explode(',', getenv('DOLI_ENABLE_MODULES'));
foreach ($mods as $mod) {
printf("Activating module ".$mod." ...");
try {
$res = activateModule('mod' . $mod);
if ($res < 0) {
print(" FAILED. Unable to load module. Be sure to check the case\n");
} else {
printf(" OK\n");
}
} catch (Throwable $t) {
print(" FAILED. Unable to load module. Be sure to check the case\n");
}
}
}