protected function configureCluster(InputInterface $input, OutputInterface $output, array $cluster)
    {
        global $APPLICATION;

        if (!Loader::includeModule('cluster')) {
            throw new \Exception('Failed to load module "cluster"');
        }

        $memcache = new \CClusterMemcache;

        if (isset($cluster['memcache'])) {
            $output->writeln('   <comment>memcache</comment>');

            if (!is_array($cluster['memcache'])) {
                throw new \Exception('Server info must be an array');
            }

            $rsServers = $memcache->GetList();

            while ($server = $rsServers->Fetch()) {
                $memcache->Delete($server['ID']);
            }

            foreach ($cluster['memcache'] as $index => $server) {
                $serverId = $memcache->Add($server);

                if ($serverId && !$input->getOption('memcache-cold-start')) {
                    $memcache->Resume($serverId);
                } else {
                    $exception = $APPLICATION->GetException();
                    $message = 'Invalid memcache config with index ' . $index;

                    if ($exception->GetString()) {
                        $message = str_replace('<br>', "\n", $exception->GetString());
                    }

                    $output->writeln('<error>' . $message . '</error>');
                }
            }
        }
    }
protected function configureCluster(InputInterface $input, OutputInterface $output, array $cluster)
    {
        global $APPLICATION;

        if (!Loader::includeModule('cluster')) {
            throw new \Exception('Failed to load module "cluster"');
        }

        $memcache = new \CClusterMemcache;

        if (isset($cluster['memcache'])) {
            $output->writeln('   <comment>memcache</comment>');

            if (!is_array($cluster['memcache'])) {
                throw new \Exception('Server info must be an array');
            }

            $rsServers = $memcache->GetList();

            while ($server = $rsServers->Fetch()) {
                $memcache->Delete($server['ID']);
            }

            foreach ($cluster['memcache'] as $index => $server) {
                $serverId = $memcache->Add($server);

                if ($serverId && !$input->getOption('memcache-cold-start')) {
                    $memcache->Resume($serverId);
                } else {
                    $exception = $APPLICATION->GetException();
                    $message = 'Invalid memcache config with index ' . $index;

                    if ($exception->GetString()) {
                        $message = str_replace('<br>', "\n", $exception->GetString());
                    }

                    $output->writeln('<error>' . $message . '</error>');
                }
            }
        }
    }
protected function configureCluster ( InputInterface $ input , OutputInterface $ output , array $ cluster ) { global $ APPLICATION ; if ( ! Loader :: includeModule ( 'cluster' ) ) { throw new \ Exception ( 'Failed to load module "cluster"' ) ; } $ memcache = new \ CClusterMemcache ; if ( isset ( $ cluster [ 'memcache' ] ) ) { $ output -> writeln ( '   <comment>memcache</comment>' ) ; if ( ! is_array ( $ cluster [ 'memcache' ] ) ) { throw new \ Exception ( 'Server info must be an array' ) ; } $ rsServers = $ memcache -> GetList ( ) ; while ( $ server = $ rsServers -> Fetch ( ) ) { $ memcache -> Delete ( $ server [ 'ID' ] ) ; } foreach ( $ cluster [ 'memcache' ] as $ index => $ server ) { $ serverId = $ memcache -> Add ( $ server ) ; if ( $ serverId && ! $ input -> getOption ( 'memcache-cold-start' ) ) { $ memcache -> Resume ( $ serverId ) ; } else { $ exception = $ APPLICATION -> GetException ( ) ; $ message = 'Invalid memcache config with index ' . $ index ; if ( $ exception -> GetString ( ) ) { $ message = str_replace ( '<br>' , "\n" , $ exception -> GetString ( ) ) ; } $ output -> writeln ( '<error>' . $ message . '</error>' ) ; } } } }
Installation config to module "cluster".

@param InputInterface $input
@param OutputInterface $output
@param array $cluster

@throws \Bitrix\Main\LoaderException
@throws \Exception
Installation config to module cluster .