Commit 1d436fbf authored by Ilya Rassadin's avatar Ilya Rassadin
Browse files

make settings_extra compatible with php8.5

memcache module seems to be obsolete and poorly maintained. Modern bitrix finally supports memcached. Though it supports it only for a file cache, not for sessions. So let's use redis in that scenario
parent 8433586e
Loading
Loading
Loading
Loading
+34 −6
Original line number Diff line number Diff line
@@ -3,21 +3,22 @@ $settings = [
    'cache' => [
        'value' => [
            'sid' => $_SERVER['DOCUMENT_ROOT'] . '#01',
            'type' => 'memcache',
            'memcache' => [
            'type' => 'memcached',
            'servers' => [
                [
                        'host' => '127.0.0.1',
                        'port' => '11211',
                ],
            ],
        ],
        'readonly' => false,
    ],
    'session' => [
        'value' => [
            'handlers' => [
                'general' => [
                    'type' => 'memcache',
                    'type' => 'redis',
                    'host' => '127.0.0.1',
                    'port' => '11211',
                    'keyPrefix' => $_SERVER['DOCUMENT_ROOT'] . '#02',
                ],
            ],
@@ -46,6 +47,33 @@ $settings = [
    ],
];

if (version_compare(PHP_VERSION, '8.5', '<')) {
    $settings['cache'] = [
        'value' => [
            'sid' => $_SERVER['DOCUMENT_ROOT'] . '#01',
            'type' => 'memcache',
            'memcache' => [
                'host' => '127.0.0.1',
                'port' => '11211',
            ],
        ],
        'readonly' => false,
    ];
    $settings['session'] = [
        'value' => [
            'handlers' => [
                'general' => [
                    'type' => 'memcache',
                    'host' => '127.0.0.1',
                    'port' => '11211',
                    'keyPrefix' => $_SERVER['DOCUMENT_ROOT'] . '#02',
                ],
            ],
        ],
        'readonly' => false,
    ];
}

$mainSettings = include(".settings.php");

if (isset($mainSettings['session'])) {