public function cleanUpIndex()
    {
        $content = '';
        $startMicrotime = microtime(true);
        $table = 'tx_kesearch_index';

        // select all index records older than the beginning of the indexing process
        $queryBuilder = Db::getQueryBuilder('tx_kesearch_index');
        $where = $queryBuilder->expr()->lt(
            'tstamp',
            $queryBuilder->quote(
                $this->registry->get('tx_kesearch','startTimeOfIndexer'),
                \PDO::PARAM_INT
            )
        );

        // hook for cleanup
        if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['cleanup'])) {
            foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['cleanup'] as $_classRef) {
                $_procObj = &GeneralUtility::makeInstance($_classRef);
                $content .= $_procObj->cleanup($where, $this);
            }
        }

        // count and delete old index records
        $count = $queryBuilder
            ->count('*')
            ->from($table)
            ->where($where)
            ->execute()
            ->fetchColumn(0);

        $queryBuilder
            ->delete($table)
            ->where($where)
            ->execute();

        $content .= '<p><b>Index cleanup:</b><br />' . "\n";
        $content .= $count . ' entries deleted.<br />' . "\n";
        $this->logger->info('CleanUpIndex: ' . $count . ' entries deleted.');

        // rotate Sphinx Index (ke_search_premium function)
        $content .= $this->rotateSphinxIndex();

        // calculate duration of indexing process
        $duration = ceil((microtime(true) - $startMicrotime) * 1000);
        $content .= '<i>Cleanup process took ' . $duration . ' ms.</i></p>' . "\n";

        return $content;
    }
public function cleanUpIndex()
    {
        $content = '';
        $startMicrotime = microtime(true);
        $table = 'tx_kesearch_index';

        // select all index records older than the beginning of the indexing process
        $queryBuilder = Db::getQueryBuilder('tx_kesearch_index');
        $where = $queryBuilder->expr()->lt(
            'tstamp',
            $queryBuilder->quote(
                $this->registry->get('tx_kesearch','startTimeOfIndexer'),
                \PDO::PARAM_INT
            )
        );

        // hook for cleanup
        if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['cleanup'])) {
            foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['cleanup'] as $_classRef) {
                $_procObj = &GeneralUtility::makeInstance($_classRef);
                $content .= $_procObj->cleanup($where, $this);
            }
        }

        // count and delete old index records
        $count = $queryBuilder
            ->count('*')
            ->from($table)
            ->where($where)
            ->execute()
            ->fetchColumn(0);

        $queryBuilder
            ->delete($table)
            ->where($where)
            ->execute();

        $content .= '<p><b>Index cleanup:</b><br />' . "\n";
        $content .= $count . ' entries deleted.<br />' . "\n";
        $this->logger->info('CleanUpIndex: ' . $count . ' entries deleted.');

        // rotate Sphinx Index (ke_search_premium function)
        $content .= $this->rotateSphinxIndex();

        // calculate duration of indexing process
        $duration = ceil((microtime(true) - $startMicrotime) * 1000);
        $content .= '<i>Cleanup process took ' . $duration . ' ms.</i></p>' . "\n";

        return $content;
    }
public function cleanUpIndex ( ) { $ content = '' ; $ startMicrotime = microtime ( true ) ; $ table = 'tx_kesearch_index' ; // select all index records older than the beginning of the indexing process $ queryBuilder = Db :: getQueryBuilder ( 'tx_kesearch_index' ) ; $ where = $ queryBuilder -> expr ( ) -> lt ( 'tstamp' , $ queryBuilder -> quote ( $ this -> registry -> get ( 'tx_kesearch' , 'startTimeOfIndexer' ) , \ PDO :: PARAM_INT ) ) ; // hook for cleanup if ( is_array ( $ GLOBALS [ 'TYPO3_CONF_VARS' ] [ 'EXTCONF' ] [ 'ke_search' ] [ 'cleanup' ] ) ) { foreach ( $ GLOBALS [ 'TYPO3_CONF_VARS' ] [ 'EXTCONF' ] [ 'ke_search' ] [ 'cleanup' ] as $ _classRef ) { $ _procObj = & GeneralUtility :: makeInstance ( $ _classRef ) ; $ content .= $ _procObj -> cleanup ( $ where , $ this ) ; } } // count and delete old index records $ count = $ queryBuilder -> count ( '*' ) -> from ( $ table ) -> where ( $ where ) -> execute ( ) -> fetchColumn ( 0 ) ; $ queryBuilder -> delete ( $ table ) -> where ( $ where ) -> execute ( ) ; $ content .= '<p><b>Index cleanup:</b><br />' . "\n" ; $ content .= $ count . ' entries deleted.<br />' . "\n" ; $ this -> logger -> info ( 'CleanUpIndex: ' . $ count . ' entries deleted.' ) ; // rotate Sphinx Index (ke_search_premium function) $ content .= $ this -> rotateSphinxIndex ( ) ; // calculate duration of indexing process $ duration = ceil ( ( microtime ( true ) - $ startMicrotime ) * 1000 ) ; $ content .= '<i>Cleanup process took ' . $ duration . ' ms.</i></p>' . "\n" ; return $ content ; }
Delete all index elements that are older than starting timestamp in registry
@return string content for BE
Delete all index elements that are older than starting timestamp in registry