public function rotateSphinxIndex()
    {
        $content = '';

        // check if Sphinx is enabled
        // in this case we have to update sphinx index, too.
        if ($this->extConfPremium['enableSphinxSearch']) {
            $this->logger->info('Sphinx index rotation started');
            if (!$this->extConfPremium['sphinxIndexerName']) {
                $this->extConfPremium['sphinxIndexerConf'] = '--all';
            }
            if (is_file($this->extConfPremium['sphinxIndexerPath'])
                && is_executable($this->extConfPremium['sphinxIndexerPath'])
                && file_exists($this->extConfPremium['sphinxSearchdPath'])
                && is_executable($this->extConfPremium['sphinxIndexerPath'])) {
                if (function_exists('exec')) {
                    // check if daemon is running
                    $content .= '<p>';
                    $retArr = array();
                    exec($this->extConfPremium['sphinxSearchdPath'] . ' --status', $retArr);
                    $content .= '<b>Checking status of Sphinx daemon:</b> ';
                    $sphinxFailedToConnect = false;
                    foreach ($retArr as $retRow) {
                        if (strpos($retRow, 'WARNING') !== false) {
                            $this->logger->warning('Sphinx: ' .$retRow);
                            $content .= '<div class="error">SPHINX ' . $retRow . '</div>' . "\n";
                            $sphinxFailedToConnect = true;
                        }
                    }

                    // try to start the sphinx daemon
                    if ($sphinxFailedToConnect) {
                        $retArr = array();
                        exec($this->extConfPremium['sphinxSearchdPath'], $retArr);
                        $this->logger->info('Sphinx: Trying to start deamon');
                        $content .= '<p><b>Trying to start Sphinx daemon.</b><br />'
                            . implode('<br />', $retArr)
                            . '</p>'
                            . "\n";
                    } else {
                        $content .= 'OK';
                    }
                    $content .= '</p>' . "\n";

                    // update the index
                    $retArr = array();
                    exec(
                        $this->extConfPremium['sphinxIndexerPath']
                        . ' --rotate '
                        . $this->extConfPremium['sphinxIndexerName'],
                        $retArr
                    );
                    $this->logger->warning('Sphinx: Creating new index (rotating)');
                    $content .= '<p><b>Creating new Sphinx index (rotating).</b><br />'
                        . "\n"
                        . implode('<br />' . "\n", $retArr)
                        . '</p>'
                        . "\n\n";
                    foreach ($retArr as $retRow) {
                        if (strpos($retRow, 'WARNING') !== false) {
                            $this->logger->error('Sphinx: ' .$retRow);
                            $content .= '<div class="error">SPHINX ' . $retRow . '</div>' . "\n";
                        }
                    }
                } else {
                    $this->logger->error('Sphinx: "exec" call is not allowed. '
                        . 'Check your disable_functions setting in php.ini');
                    $content .= '<div class="error">SPHINX ERROR: "exec" call is not allowed. '
                        . 'Check your disable_functions setting in php.ini.</div>';
                }
            } else {
                $this->logger->error('Sphinx: Executables not found or execution permission missing.');
                $content .= '<div class="error">SPHINX ERROR: Sphinx executables '
                    . 'not found or execution permission is missing.</div>';
            }
        }

        return $content;
    }
public function rotateSphinxIndex()
    {
        $content = '';

        // check if Sphinx is enabled
        // in this case we have to update sphinx index, too.
        if ($this->extConfPremium['enableSphinxSearch']) {
            $this->logger->info('Sphinx index rotation started');
            if (!$this->extConfPremium['sphinxIndexerName']) {
                $this->extConfPremium['sphinxIndexerConf'] = '--all';
            }
            if (is_file($this->extConfPremium['sphinxIndexerPath'])
                && is_executable($this->extConfPremium['sphinxIndexerPath'])
                && file_exists($this->extConfPremium['sphinxSearchdPath'])
                && is_executable($this->extConfPremium['sphinxIndexerPath'])) {
                if (function_exists('exec')) {
                    // check if daemon is running
                    $content .= '<p>';
                    $retArr = array();
                    exec($this->extConfPremium['sphinxSearchdPath'] . ' --status', $retArr);
                    $content .= '<b>Checking status of Sphinx daemon:</b> ';
                    $sphinxFailedToConnect = false;
                    foreach ($retArr as $retRow) {
                        if (strpos($retRow, 'WARNING') !== false) {
                            $this->logger->warning('Sphinx: ' .$retRow);
                            $content .= '<div class="error">SPHINX ' . $retRow . '</div>' . "\n";
                            $sphinxFailedToConnect = true;
                        }
                    }

                    // try to start the sphinx daemon
                    if ($sphinxFailedToConnect) {
                        $retArr = array();
                        exec($this->extConfPremium['sphinxSearchdPath'], $retArr);
                        $this->logger->info('Sphinx: Trying to start deamon');
                        $content .= '<p><b>Trying to start Sphinx daemon.</b><br />'
                            . implode('<br />', $retArr)
                            . '</p>'
                            . "\n";
                    } else {
                        $content .= 'OK';
                    }
                    $content .= '</p>' . "\n";

                    // update the index
                    $retArr = array();
                    exec(
                        $this->extConfPremium['sphinxIndexerPath']
                        . ' --rotate '
                        . $this->extConfPremium['sphinxIndexerName'],
                        $retArr
                    );
                    $this->logger->warning('Sphinx: Creating new index (rotating)');
                    $content .= '<p><b>Creating new Sphinx index (rotating).</b><br />'
                        . "\n"
                        . implode('<br />' . "\n", $retArr)
                        . '</p>'
                        . "\n\n";
                    foreach ($retArr as $retRow) {
                        if (strpos($retRow, 'WARNING') !== false) {
                            $this->logger->error('Sphinx: ' .$retRow);
                            $content .= '<div class="error">SPHINX ' . $retRow . '</div>' . "\n";
                        }
                    }
                } else {
                    $this->logger->error('Sphinx: "exec" call is not allowed. '
                        . 'Check your disable_functions setting in php.ini');
                    $content .= '<div class="error">SPHINX ERROR: "exec" call is not allowed. '
                        . 'Check your disable_functions setting in php.ini.</div>';
                }
            } else {
                $this->logger->error('Sphinx: Executables not found or execution permission missing.');
                $content .= '<div class="error">SPHINX ERROR: Sphinx executables '
                    . 'not found or execution permission is missing.</div>';
            }
        }

        return $content;
    }
public function rotateSphinxIndex ( ) { $ content = '' ; // check if Sphinx is enabled // in this case we have to update sphinx index, too. if ( $ this -> extConfPremium [ 'enableSphinxSearch' ] ) { $ this -> logger -> info ( 'Sphinx index rotation started' ) ; if ( ! $ this -> extConfPremium [ 'sphinxIndexerName' ] ) { $ this -> extConfPremium [ 'sphinxIndexerConf' ] = '--all' ; } if ( is_file ( $ this -> extConfPremium [ 'sphinxIndexerPath' ] ) && is_executable ( $ this -> extConfPremium [ 'sphinxIndexerPath' ] ) && file_exists ( $ this -> extConfPremium [ 'sphinxSearchdPath' ] ) && is_executable ( $ this -> extConfPremium [ 'sphinxIndexerPath' ] ) ) { if ( function_exists ( 'exec' ) ) { // check if daemon is running $ content .= '<p>' ; $ retArr = array ( ) ; exec ( $ this -> extConfPremium [ 'sphinxSearchdPath' ] . ' --status' , $ retArr ) ; $ content .= '<b>Checking status of Sphinx daemon:</b> ' ; $ sphinxFailedToConnect = false ; foreach ( $ retArr as $ retRow ) { if ( strpos ( $ retRow , 'WARNING' ) !== false ) { $ this -> logger -> warning ( 'Sphinx: ' . $ retRow ) ; $ content .= '<div class="error">SPHINX ' . $ retRow . '</div>' . "\n" ; $ sphinxFailedToConnect = true ; } } // try to start the sphinx daemon if ( $ sphinxFailedToConnect ) { $ retArr = array ( ) ; exec ( $ this -> extConfPremium [ 'sphinxSearchdPath' ] , $ retArr ) ; $ this -> logger -> info ( 'Sphinx: Trying to start deamon' ) ; $ content .= '<p><b>Trying to start Sphinx daemon.</b><br />' . implode ( '<br />' , $ retArr ) . '</p>' . "\n" ; } else { $ content .= 'OK' ; } $ content .= '</p>' . "\n" ; // update the index $ retArr = array ( ) ; exec ( $ this -> extConfPremium [ 'sphinxIndexerPath' ] . ' --rotate ' . $ this -> extConfPremium [ 'sphinxIndexerName' ] , $ retArr ) ; $ this -> logger -> warning ( 'Sphinx: Creating new index (rotating)' ) ; $ content .= '<p><b>Creating new Sphinx index (rotating).</b><br />' . "\n" . implode ( '<br />' . "\n" , $ retArr ) . '</p>' . "\n\n" ; foreach ( $ retArr as $ retRow ) { if ( strpos ( $ retRow , 'WARNING' ) !== false ) { $ this -> logger -> error ( 'Sphinx: ' . $ retRow ) ; $ content .= '<div class="error">SPHINX ' . $ retRow . '</div>' . "\n" ; } } } else { $ this -> logger -> error ( 'Sphinx: "exec" call is not allowed. ' . 'Check your disable_functions setting in php.ini' ) ; $ content .= '<div class="error">SPHINX ERROR: "exec" call is not allowed. ' . 'Check your disable_functions setting in php.ini.</div>' ; } } else { $ this -> logger -> error ( 'Sphinx: Executables not found or execution permission missing.' ) ; $ content .= '<div class="error">SPHINX ERROR: Sphinx executables ' . 'not found or execution permission is missing.</div>' ; } } return $ content ; }
updates the sphinx index
@return string
updates the sphinx index