Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

resolve executable path tests removing properly command line options …

…when focussing the executable.
  • Loading branch information...
commit 74e12d57543a24756c65737a8b1255be8d92eb5e 1 parent 1f619d3
diml authored
View
8 search/documents/physical_doc.php
@@ -27,10 +27,12 @@ function get_text_for_indexing_doc(&$resource, $directfile = ''){
$moodleroot = (@$CFG->block_search_usemoodleroot) ? "{$CFG->dirroot}/" : '' ;
- // just call pdftotext over stdout and capture the output
+ // just call antiword over stdout and capture the output
if (!empty($CFG->block_search_word_to_text_cmd)){
- if (!file_exists("{$moodleroot}{$CFG->block_search_word_to_text_cmd}")){
- mtrace('Error with MSWord to text converter command : exectutable not found at '.$moodleroot.$CFG->block_search_word_to_text_cmd);
+ // we need to remove any line command options...
+ preg_match("/^\S+/", $CFG->block_search_word_to_text_cmd, $matches);
+ if (!file_exists("{$moodleroot}{$matches[0]}")){
+ mtrace('Error with MSWord to text converter command : executable not found at '.$moodleroot.$CFG->block_search_word_to_text_cmd);
} else {
if ($directfile == ''){
$file = escapeshellarg("{$CFG->dataroot}/{$resource->course}/{$resource->reference}");
View
6 search/documents/physical_odt.php
@@ -29,8 +29,10 @@ function get_text_for_indexing_odt(&$resource, $directfile = ''){
// just call pdftotext over stdout and capture the output
if (!empty($CFG->block_search_odt_to_text_cmd)){
- if (!file_exists("{$moodleroot}{$CFG->block_search_odt_to_text_cmd}")){
- mtrace('Error with OpenOffice ODT to text converter command : executable not found at'.$moodleroot.$CFG->block_search_odt_to_text_cmd);
+ // we need to remove any line command options...
+ preg_match("/^\S+/", $CFG->block_search_odt_to_text_cmd, $matches);
+ if (!file_exists("{$moodleroot}{$matches[0]}")){
+ mtrace('Error with OpenOffice ODT to text converter command : executable not found at '.$moodleroot.$CFG->block_search_odt_to_text_cmd);
} else {
if ($directfile == ''){
$file = escapeshellarg("{$CFG->dataroot}/{$resource->course}/{$resource->reference}");
View
1  search/documents/physical_pdf.php
@@ -32,6 +32,7 @@ function get_text_for_indexing_pdf(&$resource, $directfile = ''){
// just call pdftotext over stdout and capture the output
if (!empty($CFG->block_search_pdf_to_text_cmd)){
+ // we need to remove any line command options...
preg_match("/^\S+/", $CFG->block_search_pdf_to_text_cmd, $matches);
if (!file_exists("{$moodleroot}{$matches[0]}")){
mtrace('Error with pdf to text converter command : executable not found at '.$moodleroot.$matches[0]);
Please sign in to comment.
Something went wrong with that request. Please try again.