protected function execute(InputInterface $input, OutputInterface $output)
    {
        $io = new SymfonyStyle($input, $output);
        $io->title('Start ke_search indexer process');
        $indexerRunner = GeneralUtility::makeInstance(IndexerRunner::class);
        $indexerRunner->logger->log('notice', 'Indexer process started by command controller.');
        $indexerResponse = $indexerRunner->startIndexing(
            true, [], 'CLI'
        );

        if (strstr($indexerResponse, 'You can\'t start the indexer twice')) {
            $io->warning(
                'Indexing lock is set. You can\'t start the indexer process twice.' . chr(10) . chr(10)
                . 'If lock was not reset because of indexer errors you can use ke_search:removelock command.'
            );
        } else {

            // set custom style
            $titleStyle = new OutputFormatterStyle('blue', 'black', array('bold'));
            $output->getFormatter()->setStyle('title', $titleStyle);
            $warning = false;

            foreach (explode(chr(10), $indexerResponse) as $line) {

                // skip empty lines
                if (empty(strip_tags($line))) {
                    continue;
                }

                // format lines and catch warnings
                if (strstr($line, 'There were errors')) {
                    $warning = strip_tags(str_replace('[DANGER] ', '', $line));
                } else if (strstr($line, 'Index contains')) {
                    $io->writeln('<info>' . strip_tags($line) . '</info>');
                } else if (strstr($line, '<p><b>')) {
                    $io->writeln(chr(10) . '<title>' . strip_tags($line) . '</>');
                } else {
                    $io->writeln(strip_tags($line));
                }
            }

            if ($warning !== false) {
                $io->warning($warning);
            }

            $io->success('Indexer process completed.');
        }
    }
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $io = new SymfonyStyle($input, $output);
        $io->title('Start ke_search indexer process');
        $indexerRunner = GeneralUtility::makeInstance(IndexerRunner::class);
        $indexerRunner->logger->log('notice', 'Indexer process started by command controller.');
        $indexerResponse = $indexerRunner->startIndexing(
            true, [], 'CLI'
        );

        if (strstr($indexerResponse, 'You can\'t start the indexer twice')) {
            $io->warning(
                'Indexing lock is set. You can\'t start the indexer process twice.' . chr(10) . chr(10)
                . 'If lock was not reset because of indexer errors you can use ke_search:removelock command.'
            );
        } else {

            // set custom style
            $titleStyle = new OutputFormatterStyle('blue', 'black', array('bold'));
            $output->getFormatter()->setStyle('title', $titleStyle);
            $warning = false;

            foreach (explode(chr(10), $indexerResponse) as $line) {

                // skip empty lines
                if (empty(strip_tags($line))) {
                    continue;
                }

                // format lines and catch warnings
                if (strstr($line, 'There were errors')) {
                    $warning = strip_tags(str_replace('[DANGER] ', '', $line));
                } else if (strstr($line, 'Index contains')) {
                    $io->writeln('<info>' . strip_tags($line) . '</info>');
                } else if (strstr($line, '<p><b>')) {
                    $io->writeln(chr(10) . '<title>' . strip_tags($line) . '</>');
                } else {
                    $io->writeln(strip_tags($line));
                }
            }

            if ($warning !== false) {
                $io->warning($warning);
            }

            $io->success('Indexer process completed.');
        }
    }
protected function execute ( InputInterface $ input , OutputInterface $ output ) { $ io = new SymfonyStyle ( $ input , $ output ) ; $ io -> title ( 'Start ke_search indexer process' ) ; $ indexerRunner = GeneralUtility :: makeInstance ( IndexerRunner :: class ) ; $ indexerRunner -> logger -> log ( 'notice' , 'Indexer process started by command controller.' ) ; $ indexerResponse = $ indexerRunner -> startIndexing ( true , [ ] , 'CLI' ) ; if ( strstr ( $ indexerResponse , 'You can\'t start the indexer twice' ) ) { $ io -> warning ( 'Indexing lock is set. You can\'t start the indexer process twice.' . chr ( 10 ) . chr ( 10 ) . 'If lock was not reset because of indexer errors you can use ke_search:removelock command.' ) ; } else { // set custom style $ titleStyle = new OutputFormatterStyle ( 'blue' , 'black' , array ( 'bold' ) ) ; $ output -> getFormatter ( ) -> setStyle ( 'title' , $ titleStyle ) ; $ warning = false ; foreach ( explode ( chr ( 10 ) , $ indexerResponse ) as $ line ) { // skip empty lines if ( empty ( strip_tags ( $ line ) ) ) { continue ; } // format lines and catch warnings if ( strstr ( $ line , 'There were errors' ) ) { $ warning = strip_tags ( str_replace ( '[DANGER] ' , '' , $ line ) ) ; } else if ( strstr ( $ line , 'Index contains' ) ) { $ io -> writeln ( '<info>' . strip_tags ( $ line ) . '</info>' ) ; } else if ( strstr ( $ line , '<p><b>' ) ) { $ io -> writeln ( chr ( 10 ) . '<title>' . strip_tags ( $ line ) . '</>' ) ; } else { $ io -> writeln ( strip_tags ( $ line ) ) ; } } if ( $ warning !== false ) { $ io -> warning ( $ warning ) ; } $ io -> success ( 'Indexer process completed.' ) ; } }
Runs the index process for ke_search
Runs the index process for ke_search