function checkOpenOffice()
 {
     $diagnose = SearchHelper::checkOpenOfficeAvailablity();
     if (!is_null($diagnose)) {
         $this->addIssue('Open Office Server', $diagnose);
     }
 }
 /**
  * Check that open office is running
  *
  * @return boolean
  */
 private function checkOO()
 {
     $available = SearchHelper::checkOpenOfficeAvailablity();
     if (is_null($available)) {
         return true;
     }
     return false;
 }
$sGiveOutput = isset($argv[1]) && $argv[1] == 'output' ? true : false;
// Check indexed document count
// If the number of indexed documents is greater than the set amount, restart open office
// this clears open office's memory usage
$resetPoint = 50;
// todo: put in config
$count = Indexer::getIndexedDocumentCount();
$restartOO = false;
if ($count > $resetPoint) {
    $restartOO = true;
    // reset the count
    Indexer::updateIndexedDocumentCount(0);
    $default->log->debug('Check Open Office Task: Restarting open office.');
}
// First we check the host:port to see if open office is running
$sCheckOO = SearchHelper::checkOpenOfficeAvailablity();
if (empty($sCheckOO) && !$restartOO) {
    // If the check returns empty then it is available on that port so we exit
    if ($sGiveOutput) {
        echo 1;
    }
    exit;
}
// Open office appears not to be running or requires a restart
if (OS_WINDOWS) {
    $OOService = 'ktopenoffice';
    $default->log->debug('Check Open Office Task: ' . get_current_user());
    if ($restartOO) {
        // If Open office needs to be restarted - stop it here
        $result_stop = win32_stop_service($OOService);
        // Wait for the service to stop fully before trying to restart it
 public function diagnose()
 {
     if (!$this->useOO) {
         return true;
     }
     if (false === $this->python) {
         return _kt('Cannot locate python');
     }
     if (false === $this->documentConverter) {
         return _kt('Cannot locate DocumentConverter.py');
     }
     return SearchHelper::checkOpenOfficeAvailablity();
 }