Commit b51506b19d968e8ee54e57e6e42cb35d7c5b828d
1 parent
99e1d42f
Merged in from DEV trunk...
KTS-3350 "When installing stack as root, OpenOffice stores files as root in the KT temp folder. The indexing scripts cannot clean these up." Fixed. Committed By: Conrad Vermeulen Reviewed By: Kevin Fourie git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/STABLE/branches/3.5.2c-Release-Branch@8450 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
6 changed files
with
98 additions
and
4 deletions
search2/bin/cronCleanup.php
0 → 100644
| 1 | +<?php | |
| 2 | + | |
| 3 | +/** | |
| 4 | + * $Id:$ | |
| 5 | + * | |
| 6 | + * KnowledgeTree Community Edition | |
| 7 | + * Document Management Made Simple | |
| 8 | + * Copyright (C) 2008 KnowledgeTree Inc. | |
| 9 | + * Portions copyright 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 KnowledgeTree Inc., PO Box 7775 #87847, San Francisco, | |
| 24 | + * California 94120-7775, 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 | + | |
| 40 | +chdir(dirname(__FILE__)); | |
| 41 | +require_once(realpath('../../config/dmsDefaults.php')); | |
| 42 | + | |
| 43 | +$config = KTConfig::getSingleton(); | |
| 44 | +$temp_dir =$config->get("urls/tmpDirectory"); | |
| 45 | + | |
| 46 | + | |
| 47 | +cleanupTempDirectory($temp_dir); | |
| 48 | + | |
| 49 | +function cleanupTempDirectory($dir) | |
| 50 | +{ | |
| 51 | + if (!is_dir($dir)) | |
| 52 | + { | |
| 53 | + return; | |
| 54 | + } | |
| 55 | + $dir = str_replace('\\','/', $dir); | |
| 56 | + | |
| 57 | + $dh = opendir($dir); | |
| 58 | + while (($name = readdir($dh)) !== false) | |
| 59 | + { | |
| 60 | + if (substr($name, 0, 9) != 'ktindexer') | |
| 61 | + { | |
| 62 | + continue; | |
| 63 | + } | |
| 64 | + unlink($dir . '/' . $name); | |
| 65 | + } | |
| 66 | + closedir($dh); | |
| 67 | +} | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | +?> | |
| 0 | 72 | \ No newline at end of file | ... | ... |
search2/indexing/extractorCore.inc.php
search2/indexing/extractors/OOTextExtractor.inc.php
| ... | ... | @@ -132,6 +132,9 @@ class OOTextExtractor extends ExternalDocumentExtractor |
| 132 | 132 | return true; |
| 133 | 133 | } |
| 134 | 134 | $content = file_get_contents($this->targetfile); |
| 135 | + | |
| 136 | + $this->setTargetFile($this->targetfile . '.txt'); | |
| 137 | + | |
| 135 | 138 | return file_put_contents($this->targetfile, $this->filter($content)); |
| 136 | 139 | |
| 137 | 140 | } | ... | ... |
search2/indexing/extractors/PDFExtractor.inc.php
| ... | ... | @@ -73,6 +73,18 @@ class PDFExtractor extends ApplicationExtractor |
| 73 | 73 | return true; |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | + if (false === $res && (strpos($this->output, 'font') !== false)) | |
| 77 | + { | |
| 78 | + $this->output = ''; | |
| 79 | + return true; | |
| 80 | + } | |
| 81 | + | |
| 82 | + if (filesize($this->targetfile) > 0) | |
| 83 | + { | |
| 84 | + $this->output = ''; | |
| 85 | + return true; | |
| 86 | + } | |
| 87 | + | |
| 76 | 88 | return $res; |
| 77 | 89 | |
| 78 | 90 | } | ... | ... |
sql/mysql/install/data.sql
| ... | ... | @@ -809,7 +809,9 @@ INSERT INTO `scheduler_tasks` VALUES |
| 809 | 809 | (3,'Index Optimisation','search2/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 | 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 | +(6,'Open Office test','bin/checkopenoffice.php','',0,'1min','2007-10-01',NULL,0,'enabled'), | |
| 813 | +(7,'Cleanup Temporary Directory','search2/bin/cronCleanup.php','',0,'1min','2007-10-01',NULL,0,'enabled'); | |
| 814 | + | |
| 813 | 815 | /*!40000 ALTER TABLE `scheduler_tasks` ENABLE KEYS */; |
| 814 | 816 | UNLOCK TABLES; |
| 815 | 817 | |
| ... | ... | @@ -984,7 +986,8 @@ INSERT INTO `upgrades` VALUES (1,'sql*2.0.6*0*2.0.6/create_upgrade_table.sql','D |
| 984 | 986 | (176,'sql*3.5.2*0*3.5.2/clean_plugin_helper.sql','Clean out the plugin helper table.','2007-11-21 00:00:00',1,'upgrade*3.5.2*99*upgrade3.5.2'), |
| 985 | 987 | (177,'sql*3.5.2*0*3.5.2/openxml_mime_types.sql','Add the OpenXML mimetypes.','2007-11-21 00:00:00',1,'upgrade*3.5.2*99*upgrade3.5.2'), |
| 986 | 988 | (178,'sql*3.5.2*0*3.5.2/rss_plugin_title.sql','Increase size of RSS Title.','2007-11-21 00:00:00',1,'upgrade*3.5.2*99*upgrade3.5.2'), |
| 987 | -(179,'upgrade*3.5.2*99*upgrade3.5.2','Upgrade from version 3.5.1 to 3.5.2','2007-11-21 00:00:00',1,'upgrade*3.5.2*99*upgrade3.5.2'); | |
| 989 | +(179,'sql*3.5.2*0*3.5.2/temp_cleanup.sql','Adds background script to clean up temporary index files.','2007-11-21 00:00:00',1,'upgrade*3.5.2*99*upgrade3.5.2'), | |
| 990 | +(180,'upgrade*3.5.2*99*upgrade3.5.2','Upgrade from version 3.5.1 to 3.5.2','2007-11-21 00:00:00',1,'upgrade*3.5.2*99*upgrade3.5.2'); | |
| 988 | 991 | /*!40000 ALTER TABLE `upgrades` ENABLE KEYS */; |
| 989 | 992 | UNLOCK TABLES; |
| 990 | 993 | |
| ... | ... | @@ -1722,7 +1725,7 @@ UNLOCK TABLES; |
| 1722 | 1725 | |
| 1723 | 1726 | LOCK TABLES `zseq_scheduler_tasks` WRITE; |
| 1724 | 1727 | /*!40000 ALTER TABLE `zseq_scheduler_tasks` DISABLE KEYS */; |
| 1725 | -INSERT INTO `zseq_scheduler_tasks` VALUES (6); | |
| 1728 | +INSERT INTO `zseq_scheduler_tasks` VALUES (7); | |
| 1726 | 1729 | /*!40000 ALTER TABLE `zseq_scheduler_tasks` ENABLE KEYS */; |
| 1727 | 1730 | UNLOCK TABLES; |
| 1728 | 1731 | |
| ... | ... | @@ -1811,7 +1814,7 @@ UNLOCK TABLES; |
| 1811 | 1814 | |
| 1812 | 1815 | LOCK TABLES `zseq_upgrades` WRITE; |
| 1813 | 1816 | /*!40000 ALTER TABLE `zseq_upgrades` DISABLE KEYS */; |
| 1814 | -INSERT INTO `zseq_upgrades` VALUES (179); | |
| 1817 | +INSERT INTO `zseq_upgrades` VALUES (180); | |
| 1815 | 1818 | /*!40000 ALTER TABLE `zseq_upgrades` ENABLE KEYS */; |
| 1816 | 1819 | UNLOCK TABLES; |
| 1817 | 1820 | ... | ... |
sql/mysql/upgrade/3.5.2/temp_cleanup.sql
0 → 100644