Hi
Running Apache/2.2.11 (Win32) PHP/5.2.9-1 on Server 2003 SP2.
When cron runs, the Recent log entries window is filled with "Could not extract any indexable text from" followed by the file name & path to the attached file.
It would seem that "escapeshellcmd" is misbehaving, though I'm not sure how to fix it (or describe it). If, at line 323 (or thereabouts) I remove that function call, the files get read and indexed.
Capturing the value of $cmd, with the function call in place I see:
java -cp D: websites drupal6 sites all modules apachesolr_attachments tika -jar D: websites drupal6 sites all modules apachesolr_attachments tika/tika-0.3.jar -t D: websites drupal6 sites wiki.cfertech.com files CS4 Design Premium Read Me.pdf
With the function call removed:
java -cp D:\websites\drupal6\sites\all\modules\apachesolr_attachments\tika -jar D:\websites\drupal6\sites\all\modules\apachesolr_attachments\tika/tika-0.3.jar -t "D:\websites\drupal6\sites\wiki.cfertech.com\files\CS4 Design Premium Read Me.pdf"
Comments
Comment #1
dgarciad commentedHi
I think the problem is related to using "\" instead of "/" as it happens in windows.
I have also commented the escapeshellcmd:
// $cmd = escapeshellcmd($java .' -cp '. $tika_path .' -jar '. $tika .' -t "'. $filepath .'"');
$cmd = $java .' -cp '. $tika_path .' -jar '. $tika .' -t "'. $filepath .'"';
Maybe relacing every "\" with "/" will avoid troubles:
$cmd_tmp = $java .' -cp '. $tika_path .' -jar '. $tika .' -t "'. $filepath .'"';
$cmd = str_replace('\\', '/', $cmd_tmp);
Regards
Comment #2
cyberguyen commentedAs dgarciad suggest:
// $cmd = escapeshellcmd($java .' -cp '. $tika_path .' -jar '. $tika .' -t "'. $filepath .'"');
$cmd_tmp = $java .' -cp '. $tika_path .' -jar '. $tika .' -t "'. $filepath .'"';
$cmd = str_replace('\\', '/', $cmd_tmp);
This works very well on my windows installation of drupal so I would like the developer to implement something like it in the next release of Apache Solr Attachments.
Comment #3
pwolanin commented@cyberguyen - patch?
Comment #4
pwolanin commentedWhy don't you just put your file paths in with forward slashes?
Comment #5
pwolanin commentedah:
On windows realpath() will change unix style paths to windows style.
Comment #6
pwolanin commentedsomething like this maybe?
Comment #7
pwolanin commentedActually - is that right? we want to maybe just escape the cmd and not the paths if they passed through realpath()?
Is there a danger with filename containing an &? At least in may case seems ok if the filename is in "" marks.
Comment #8
pwolanin commentedAny feedback on this patch? I don't have java set up on windows ATM.
Comment #9
pwolanin commentedupdated patch to match changes in CVS.
Comment #10
pwolanin commentedHeine pointed me to http://www.php.net/manual/en/function.escapeshellarg.php so let's try with that.
Comment #11
pwolanin commentedCommitted to HEAD