Commit cbb79ea7d7eaf7a7f9a7c702d59232d32312906e

Authored by Megan Watson
1 parent 716f10db

KTS-3056

"Create a script to check if Open Office is running (SUP-614)"
Fixed. Added the script to the scheduled tasks.

Committed by: Megan Watson
Reviewed by: Conrad Vermeulen



git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@8136 c91229c3-7414-0410-bfa2-8a42b809f60b
bin/checkopenoffice.php 0 → 100644
  1 +<?php
  2 +
  3 +/**
  4 + *
  5 + * $Id:
  6 + *
  7 + * KnowledgeTree Open Source Edition
  8 + * Document Management Made Simple
  9 + * Copyright (C) 2004 - 2008 The Jam Warehouse Software (Pty) Limited
  10 + *
  11 + * This program is free software; you can redistribute it and/or modify it under
  12 + * the terms of the GNU General Public License version 3 as published by the
  13 + * Free Software Foundation.
  14 + *
  15 + * This program is distributed in the hope that it will be useful, but WITHOUT
  16 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  17 + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  18 + * details.
  19 + *
  20 + * You should have received a copy of the GNU General Public License
  21 + * along with this program. If not, see <http://www.gnu.org/licenses/>.
  22 + *
  23 + * You can contact The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place,
  24 + * Blake Street, Observatory, 7925 South Africa. or email info@knowledgetree.com.
  25 + *
  26 + * The interactive user interfaces in modified source and object code versions
  27 + * of this program must display Appropriate Legal Notices, as required under
  28 + * Section 5 of the GNU General Public License version 3.
  29 + *
  30 + * In accordance with Section 7(b) of the GNU General Public License version 3,
  31 + * these Appropriate Legal Notices must retain the display of the "Powered by
  32 + * KnowledgeTree" logo and retain the original copyright notice. If the display of the
  33 + * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
  34 + * must display the words "Powered by KnowledgeTree" and retain the original
  35 + * copyright notice.
  36 + * Contributor( s): ______________________________________
  37 + */
  38 +
  39 +chdir(realpath(dirname(__FILE__)));
  40 +require_once('../config/dmsDefaults.php');
  41 +
  42 +// Check if open office is running
  43 +$sCheckOO = SearchHelper::checkOpenOfficeAvailablity();
  44 +
  45 +
  46 +// If it is running - exit, we don't need to do anything otherwise start it
  47 +if(!empty($sCheckOO)){
  48 +
  49 + $default->log->debug('Check Open Office Task: Open office service is not running... trying to start it.');
  50 +
  51 + if(OS_WINDOWS){
  52 +
  53 + // Check the path first
  54 + $sPath = realpath('../../winserv.exe');
  55 +
  56 + if(file_exists($sPath)){
  57 + $sCmd = "\"$sPath\" start kt_openoffice";
  58 + KTUtil::pexec($sCmd);
  59 + exit;
  60 + }
  61 + // If that doesn't work, check for the all start
  62 + $sPath = realpath('../../bin/allctl.bat');
  63 + if(file_exists($sPath)){
  64 + $sCmd = "\"$sPath\" start";
  65 + KTUtil::pexec($sCmd);
  66 + exit;
  67 + }
  68 + // Might be a source install ... ???
  69 + $default->log->debug('Check Open Office Task: Can\'t start Open office, this may be a source install.');
  70 + exit;
  71 + }else{
  72 + $sPath = realpath('../../dmsctl.sh');
  73 + if(file_exists($sPath)){
  74 + $sCmd = "\"$sPath\" start";
  75 + KTUtil::pexec($sCmd);
  76 + exit;
  77 + }
  78 + // might be a source install
  79 + $default->log->debug('Check Open Office Task: Can\'t start Open office, this may be a source install.');
  80 + exit;
  81 + }
  82 +}
  83 +
  84 +exit;
  85 +?>
0 86 \ No newline at end of file
... ...
sql/mysql/install/data.sql
... ... @@ -808,7 +808,8 @@ INSERT INTO `scheduler_tasks` VALUES
808 808 (2,'Index Migration','search2/indexing/bin/cronMigration.php','',0,'5mins','2007-10-01',NULL,0,'system'),
809 809 (3,'Index Optimisation','search2/indexing/bin/optimise.php','',0,'weekly','2007-10-01',NULL,0,'system'),
810 810 (4,'Periodic Document Expunge','bin/expungeall.php','',0,'weekly','2007-10-01',NULL,0,'disabled'),
811   -(5,'Database Maintenance','bin/dbmaint.php','optimize',0,'monthly','2007-10-01',NULL,0,'disabled');
  811 +(5,'Database Maintenance','bin/dbmaint.php','optimize',0,'monthly','2007-10-01',NULL,0,'disabled'),
  812 +(6,'Open Office test','bin/checkopenoffice.php','',0,'1min','2007-10-01',NULL,0,'enabled');
812 813 /*!40000 ALTER TABLE `scheduler_tasks` ENABLE KEYS */;
813 814 UNLOCK TABLES;
814 815  
... ... @@ -1720,7 +1721,7 @@ UNLOCK TABLES;
1720 1721  
1721 1722 LOCK TABLES `zseq_scheduler_tasks` WRITE;
1722 1723 /*!40000 ALTER TABLE `zseq_scheduler_tasks` DISABLE KEYS */;
1723   -INSERT INTO `zseq_scheduler_tasks` VALUES (5);
  1724 +INSERT INTO `zseq_scheduler_tasks` VALUES (6);
1724 1725 /*!40000 ALTER TABLE `zseq_scheduler_tasks` ENABLE KEYS */;
1725 1726 UNLOCK TABLES;
1726 1727  
... ...
sql/mysql/upgrade/3.5.2/scheduler_tasks.sql
... ... @@ -8,4 +8,7 @@ INSERT INTO `scheduler_tasks` VALUES (@id,&#39;Periodic Document Expunge&#39;,&#39;bin/expun
8 8 select @id:=max(id)+1 from scheduler_tasks;
9 9 INSERT INTO `scheduler_tasks` VALUES (@id,'Database Maintenance','bin/dbmaint.php','optimize',0,'monthly','2007-10-01',NULL,0,'disabled');
10 10  
  11 +select @id:=max(id)+1 from scheduler_tasks;
  12 +INSERT INTO `scheduler_tasks` VALUES (@id,'Open Office Test','bin/checkopenoffice.php','',0,'1min','2007-10-01',NULL,0,'enabled');
  13 +
11 14 UPDATE zseq_scheduler_tasks set id=@id;
12 15 \ No newline at end of file
... ...