mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-05 17:18:13 +01:00
Can re-enable a default disabled stream with conf.php
This commit is contained in:
@@ -56,11 +56,13 @@ class DolGeoIP
|
||||
if ($type == 'country') {
|
||||
// geoip may have been already included with PEAR
|
||||
if ($geoipversion == '2' || ($geoipversion != 'php' && !function_exists('geoip_country_code_by_name'))) {
|
||||
stream_wrapper_restore('phar');
|
||||
require_once DOL_DOCUMENT_ROOT.'/includes/geoip2/geoip2.phar';
|
||||
}
|
||||
} elseif ($type == 'city') {
|
||||
// geoip may have been already included with PEAR
|
||||
if ($geoipversion == '2' || ($geoipversion != 'php' && !function_exists('geoip_country_code_by_name'))) {
|
||||
stream_wrapper_restore('phar');
|
||||
require_once DOL_DOCUMENT_ROOT.'/includes/geoip2/geoip2.phar';
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -61,18 +61,6 @@ if (defined('DOL_INC_FOR_VERSION_ERROR')) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Disable some not used PHP stream
|
||||
$listofwrappers = stream_get_wrappers();
|
||||
// We need '.phar' for geoip2. TODO Replace phar with explode files so we can disable phar.
|
||||
$arrayofstreamtodisable = array('compress.zlib', 'ftps', 'glob', 'data', 'expect', 'ftp', 'ogg', 'rar', 'zip', 'zlib');
|
||||
foreach ($arrayofstreamtodisable as $streamtodisable) {
|
||||
if (!empty($listofwrappers) && in_array($streamtodisable, $listofwrappers)) {
|
||||
stream_wrapper_unregister($streamtodisable);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Define vars
|
||||
$conffiletoshowshort = "conf.php";
|
||||
// Define localization of conf file
|
||||
@@ -87,10 +75,22 @@ $conffiletoshow = "htdocs/conf/conf.php";
|
||||
// Include configuration
|
||||
// --- End of part replaced by Dolibarr packager makepack-dolibarr
|
||||
|
||||
|
||||
// Include configuration
|
||||
$result = @include_once $conffile; // Keep @ because with some error reporting this break the redirect done when file not found
|
||||
|
||||
// Disable some not used PHP stream
|
||||
$listofwrappers = stream_get_wrappers();
|
||||
// We need '.phar' for geoip2. TODO Replace phar with explode files so we can disable phar.
|
||||
$arrayofstreamtodisable = array('compress.zlib', 'compress.bzip2', 'ftps', 'glob', 'data', 'expect', 'ftp', 'ogg', 'rar', 'zip', 'zlib');
|
||||
foreach ($arrayofstreamtodisable as $streamtodisable) {
|
||||
if (!empty($listofwrappers) && in_array($streamtodisable, $listofwrappers)) {
|
||||
if (!empty($dolibarr_main_stream_enabled) && is_array($dolibarr_main_stream_enabled) && in_array($streamtodisable, $dolibarr_main_stream_enabled)) {
|
||||
continue; // We do not disable this stream
|
||||
}
|
||||
stream_wrapper_unregister($streamtodisable);
|
||||
}
|
||||
}
|
||||
|
||||
if (!$result && !empty($_SERVER["GATEWAY_INTERFACE"])) { // If install not done and we are in a web session
|
||||
if (!empty($_SERVER["CONTEXT_PREFIX"])) { // CONTEXT_PREFIX and CONTEXT_DOCUMENT_ROOT are not defined on all apache versions
|
||||
$path = $_SERVER["CONTEXT_PREFIX"]; // example '/dolibarr/' when using an apache alias.
|
||||
|
||||
Reference in New Issue
Block a user