diff --git a/bin/checkopenoffice.php b/bin/checkopenoffice.php new file mode 100644 index 0000000..c3e6ba7 --- /dev/null +++ b/bin/checkopenoffice.php @@ -0,0 +1,85 @@ +. + * + * You can contact The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place, + * Blake Street, Observatory, 7925 South Africa. or email info@knowledgetree.com. + * + * The interactive user interfaces in modified source and object code versions + * of this program must display Appropriate Legal Notices, as required under + * Section 5 of the GNU General Public License version 3. + * + * In accordance with Section 7(b) of the GNU General Public License version 3, + * these Appropriate Legal Notices must retain the display of the "Powered by + * KnowledgeTree" logo and retain the original copyright notice. If the display of the + * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices + * must display the words "Powered by KnowledgeTree" and retain the original + * copyright notice. + * Contributor( s): ______________________________________ + */ + +chdir(realpath(dirname(__FILE__))); +require_once('../config/dmsDefaults.php'); + +// Check if open office is running +$sCheckOO = SearchHelper::checkOpenOfficeAvailablity(); + + +// If it is running - exit, we don't need to do anything otherwise start it +if(!empty($sCheckOO)){ + + $default->log->debug('Check Open Office Task: Open office service is not running... trying to start it.'); + + if(OS_WINDOWS){ + + // Check the path first + $sPath = realpath('../../winserv.exe'); + + if(file_exists($sPath)){ + $sCmd = "\"$sPath\" start kt_openoffice"; + KTUtil::pexec($sCmd); + exit; + } + // If that doesn't work, check for the all start + $sPath = realpath('../../bin/allctl.bat'); + if(file_exists($sPath)){ + $sCmd = "\"$sPath\" start"; + KTUtil::pexec($sCmd); + exit; + } + // Might be a source install ... ??? + $default->log->debug('Check Open Office Task: Can\'t start Open office, this may be a source install.'); + exit; + }else{ + $sPath = realpath('../../dmsctl.sh'); + if(file_exists($sPath)){ + $sCmd = "\"$sPath\" start"; + KTUtil::pexec($sCmd); + exit; + } + // might be a source install + $default->log->debug('Check Open Office Task: Can\'t start Open office, this may be a source install.'); + exit; + } +} + +exit; +?> \ No newline at end of file diff --git a/sql/mysql/install/data.sql b/sql/mysql/install/data.sql index 345aee1..a5e257e 100644 --- a/sql/mysql/install/data.sql +++ b/sql/mysql/install/data.sql @@ -808,7 +808,8 @@ INSERT INTO `scheduler_tasks` VALUES (2,'Index Migration','search2/indexing/bin/cronMigration.php','',0,'5mins','2007-10-01',NULL,0,'system'), (3,'Index Optimisation','search2/indexing/bin/optimise.php','',0,'weekly','2007-10-01',NULL,0,'system'), (4,'Periodic Document Expunge','bin/expungeall.php','',0,'weekly','2007-10-01',NULL,0,'disabled'), -(5,'Database Maintenance','bin/dbmaint.php','optimize',0,'monthly','2007-10-01',NULL,0,'disabled'); +(5,'Database Maintenance','bin/dbmaint.php','optimize',0,'monthly','2007-10-01',NULL,0,'disabled'), +(6,'Open Office test','bin/checkopenoffice.php','',0,'1min','2007-10-01',NULL,0,'enabled'); /*!40000 ALTER TABLE `scheduler_tasks` ENABLE KEYS */; UNLOCK TABLES; @@ -1720,7 +1721,7 @@ UNLOCK TABLES; LOCK TABLES `zseq_scheduler_tasks` WRITE; /*!40000 ALTER TABLE `zseq_scheduler_tasks` DISABLE KEYS */; -INSERT INTO `zseq_scheduler_tasks` VALUES (5); +INSERT INTO `zseq_scheduler_tasks` VALUES (6); /*!40000 ALTER TABLE `zseq_scheduler_tasks` ENABLE KEYS */; UNLOCK TABLES; diff --git a/sql/mysql/upgrade/3.5.2/scheduler_tasks.sql b/sql/mysql/upgrade/3.5.2/scheduler_tasks.sql index acc64a1..b64c275 100644 --- a/sql/mysql/upgrade/3.5.2/scheduler_tasks.sql +++ b/sql/mysql/upgrade/3.5.2/scheduler_tasks.sql @@ -8,4 +8,7 @@ INSERT INTO `scheduler_tasks` VALUES (@id,'Periodic Document Expunge','bin/expun select @id:=max(id)+1 from scheduler_tasks; INSERT INTO `scheduler_tasks` VALUES (@id,'Database Maintenance','bin/dbmaint.php','optimize',0,'monthly','2007-10-01',NULL,0,'disabled'); +select @id:=max(id)+1 from scheduler_tasks; +INSERT INTO `scheduler_tasks` VALUES (@id,'Open Office Test','bin/checkopenoffice.php','',0,'1min','2007-10-01',NULL,0,'enabled'); + UPDATE zseq_scheduler_tasks set id=@id; \ No newline at end of file