Commit 327b80ed1fafb4c7d68a4ef87f9044123db17806
1 parent
88d6505c
Merged in from DEV trunk...
KTS-1594
"Support for Office 2007 Documents"
Fixed.
Committed By: Conrad Vermeulen
Reviewed By: Megan Watson
KTS-2861
"KTUtil::arrayGet see "0" as an empty string"
Fixed. Using isset($aArray{0}) now. Evaluates to false if $aArray is not set or if it has zero length (ie. it's first character is not set).
Committed By: Kevin Fourie
Reviewed By: Conrad Vermeulen
git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/STABLE/trunk@8144 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
4 changed files
with
18 additions
and
13 deletions
lib/util/ktutil.inc
| ... | ... | @@ -229,7 +229,9 @@ class KTUtil { |
| 229 | 229 | if (!is_array($aArray)) { |
| 230 | 230 | $aArray = (array) $aArray; |
| 231 | 231 | } |
| 232 | - if (empty($aArray)) { | |
| 232 | + | |
| 233 | + // Evaluates to false if $aArray is not set or if it has zero length (ie. it's first character is not set). | |
| 234 | + if (!isset($aArray{0})) { | |
| 233 | 235 | return $mDefault; |
| 234 | 236 | } |
| 235 | 237 | if (array_key_exists($sKey, $aArray)) { | ... | ... |
search2/indexing/extractorCore.inc.php
| ... | ... | @@ -360,7 +360,9 @@ abstract class ExternalDocumentExtractor extends DocumentExtractor |
| 360 | 360 | $temp_dir = $config->get('urls/tmpDirectory'); |
| 361 | 361 | $res = 0; |
| 362 | 362 | |
| 363 | - $script_prefix = $temp_dir . '/' . time(); | |
| 363 | + $docid = $this->document->getId(); | |
| 364 | + | |
| 365 | + $script_prefix = $temp_dir . '/' . time() . '-' . $docid; | |
| 364 | 366 | $script_out = $script_prefix . '.out'; |
| 365 | 367 | |
| 366 | 368 | // define the scripts that we want |
| ... | ... | @@ -380,7 +382,7 @@ abstract class ExternalDocumentExtractor extends DocumentExtractor |
| 380 | 382 | |
| 381 | 383 | $script = "#!/bin/sh\n"; |
| 382 | 384 | $script .= "# This is an auto generated file. \n"; |
| 383 | - $script .= $cmd . ' 2>>"' . $script_out . '" >>"' . $script_out . "\"\n"; | |
| 385 | + $script .= $cmd . ' 2>>"' . $script_out . "\"\n"; | |
| 384 | 386 | $script .= "exit $?\n"; |
| 385 | 387 | } |
| 386 | 388 | ... | ... |
search2/indexing/extractors/OpenXmlTextExtractor.inc.php
| ... | ... | @@ -144,16 +144,10 @@ class OpenXmlTextExtractor extends ExternalDocumentExtractor |
| 144 | 144 | $config = KTConfig::getSingleton(); |
| 145 | 145 | $temp_dir = $config->get('urls/tmpDirectory'); |
| 146 | 146 | |
| 147 | - $time = 'openxml_'. time(); | |
| 147 | + $docid = $this->document->getId(); | |
| 148 | + $time = 'openxml_'. time() . '-' . $docid; | |
| 148 | 149 | $this->openxml_dir = $temp_dir . '/' . $time; |
| 149 | 150 | |
| 150 | - if (!mkdir($this->openxml_dir)) | |
| 151 | - { | |
| 152 | - $this->output = _kt('Could not create folder: ') . $this->openxml_dir; | |
| 153 | - return false; | |
| 154 | - } | |
| 155 | - | |
| 156 | - | |
| 157 | 151 | $cmd = $this->unzip . ' ' . str_replace( |
| 158 | 152 | array('{source}','{part}', '{target_dir}'), |
| 159 | 153 | array($this->sourcefile, '\[Content_Types\].xml',$this->openxml_dir), $this->unzip_params); |
| ... | ... | @@ -282,13 +276,15 @@ class OpenXmlTextExtractor extends ExternalDocumentExtractor |
| 282 | 276 | if ($result === false) |
| 283 | 277 | { |
| 284 | 278 | $this->output = _kt('Could not save content to file: ') . $this->targetfile; |
| 285 | - @rmdir($this->openxml_dir); | |
| 279 | + KTUtil::deleteDirectory($this->openxml_dir); | |
| 286 | 280 | return false; |
| 287 | 281 | } |
| 288 | 282 | } |
| 289 | - @rmdir($this->openxml_dir); | |
| 283 | + KTUtil::deleteDirectory($this->openxml_dir); | |
| 284 | + | |
| 290 | 285 | return true; |
| 291 | 286 | } |
| 287 | + KTUtil::deleteDirectory($this->openxml_dir); | |
| 292 | 288 | |
| 293 | 289 | return false; |
| 294 | 290 | ... | ... |
search2/indexing/indexerCore.inc.php
| ... | ... | @@ -795,6 +795,11 @@ abstract class Indexer |
| 795 | 795 | |
| 796 | 796 | public function getExtractor($extractorClass) |
| 797 | 797 | { |
| 798 | + if (empty($extractorClass)) | |
| 799 | + { | |
| 800 | + return null; | |
| 801 | + } | |
| 802 | + | |
| 798 | 803 | $includeFile = SEARCH2_INDEXER_DIR . 'extractors/' . $extractorClass . '.inc.php'; |
| 799 | 804 | if (!file_exists($includeFile)) |
| 800 | 805 | { | ... | ... |