OJS OCS OMP OHS

You are viewing the PKP Support Forum | PKP Home Wiki



Full text Search -> article_files and application/x-downl

Are you responsible for making OJS work -- installing, upgrading, migrating or troubleshooting? Do you think you've found a bug? Post in this forum.

Moderators: jmacgreg, btbell, michael, bdgregg, barbarah, asmecher

Forum rules
What to do if you have a technical problem with OJS:

1. Search the forum. You can do this from the Advanced Search Page or from our Google Custom Search, which will search the entire PKP site. If you are encountering an error, we especially recommend searching the forum for said error.

2. Check the FAQ to see if your question or error has already been resolved.

3. Post a question, but please, only after trying the above two solutions. If it's a workflow or usability question you should probably post to the OJS Editorial Support and Discussion subforum; if you have a development question, try the OJS Development subforum.

Full text Search -> article_files and application/x-downl

Postby bdgregg » Thu Feb 01, 2007 11:24 am

We were having a problem with Full Text searching.

We noticed that the file_type field in the article_files table were not all 'application/pdf' but some/most of them were 'application/x-download' but the files were definately pdf files.

We added 'index[application/x-download] = "/usr/local/bin/pdftotext" to our config.inc.php file and the Full Text searching now works.

Have I stumbled onto a bug, or what causes the file_type field to be filled in? I'm looking into why this happened and is this ok to do?

We are new site so I'm looking for a bit of guidance here.

Also xpdf supports pdf version 1.5 and it complained about some of the PDF's being version 1.6 but it indexed them anyway. <shrug>

Thanks,
Brian Gregg.
bdgregg
 
Posts: 117
Joined: Wed Sep 15, 2004 8:21 am
Location: University of Pittsburgh

Postby asmecher » Thu Feb 01, 2007 12:18 pm

Hi Brian,

OJS uses PHP's mime_content_type function to determine file types; if that function doesn't exist, it calls the external UNIX standard "file" utility. Either way, it determines file types based on a file called magic.mime. I'd suggest making sure that PHP's mime_content_type function is properly configured. See http://www.php.net/manual/en/function.mime-content-type.php for information.

Regards,
Alec Smecher
Open Journal Systems Team
---
Don't miss the First International PKP Scholarly Publishing Conference
July 11 - 13, 2007, Vancouver, BC, Canada
http://ocs.sfu.ca/pkp2007/
asmecher
 
Posts: 7717
Joined: Wed Aug 10, 2005 12:56 pm

Postby bdgregg » Mon Feb 05, 2007 9:39 am

Alec,

Since that particular function in PHP is deprecated (online php docs), and since I can not find any information particular to configuring the magic.mime file can you give me an example of configuring the mime_content_type setting needed.

I've looked in my php.ini and found no mention of the magic.mime file. Am I missing something in the compilation of PHP or Apache?

Thanks,
Brian.
bdgregg
 
Posts: 117
Joined: Wed Sep 15, 2004 8:21 am
Location: University of Pittsburgh

Postby bdgregg » Mon Feb 05, 2007 10:22 am

Alec,

More investigation...

The 'file' command on Solaris is completely different than other 'file' commands.

Here is my hosts uname -a:
Code: Select all
SunOS grissom 5.10 Generic_118833-24 sun4u sparc SUNW,Sun-Fire-V250


Thus the 'file -bi $file' returns the following:
Code: Select all
file: illegal option -- b
usage: file [-dh] [-M mfile] [-m mfile] [-f ffile] file ...
       file [-dh] [-M mfile] [-m mfile] -f ffile
       file -i [-h] [-f ffile] file ...
       file -i [-h] -f ffile
       file -c [-d] [-M mfile] [-m mfile]


And since the function mime_content_type doesn't seem to exist it fails over to using the 'file -bi' way of determining the file type.

This is my test script:
Code: Select all
<?php
if (!function_exists('mime_content_type')) {
        echo "function does not exist.\n";
}
?>


Which results in:
Code: Select all
php /tmp/test2.php
function does not exist.


Thoughts?

Thanks,
Brian Gregg.
bdgregg
 
Posts: 117
Joined: Wed Sep 15, 2004 8:21 am
Location: University of Pittsburgh

Postby bdgregg » Mon Feb 05, 2007 10:42 am

Alec,

I was able to find the Ian Darwin file command that other Unix's (other than Solaris) use at http://www.darwinsys.com/file/ which does give the expected information when the parameters are passed from your code. This may be an option that needs specified in the config.inc.php (where is the 'file' command).

This can be a possible work around unless you have a better idea at this point.

Thanks,
Brian Gregg.
bdgregg
 
Posts: 117
Joined: Wed Sep 15, 2004 8:21 am
Location: University of Pittsburgh

Postby asmecher » Mon Feb 05, 2007 11:01 am

Hi Brian,

Ah, Solaris -- you'll find that the "patch" tool also behaves far outside of what you'll be used to if you're familiar with the GNU tools. Once again, an external and better-behaved patch tool is available.

If possible, I'd suggest enabling the mime_content_type function in PHP; running the external "file" command is something of a kludge. However, your work-around will be OK too. I'll consider moving it into config.inc.php; I believe it's the only hard-coded command line in the system at the moment.

Regards,
Alec Smecher
Open Journal Systems Team
---
Don't miss the First International PKP Scholarly Publishing Conference
July 11 - 13, 2007, Vancouver, BC, Canada
http://ocs.sfu.ca/pkp2007/
asmecher
 
Posts: 7717
Joined: Wed Aug 10, 2005 12:56 pm

Postby bdgregg » Mon Feb 05, 2007 12:21 pm

Alec,

Thought I'd mention it here in the forum that to enable the mime_content_function in php you need to pass --with-mime-magic to the php configure command to make sure you have the function included (I don't recall it being in the documentation similar to the --enable-mbstring that is included in the documentation,).

I have done so and all seems to be working well.

PS. Yes I trapped the patch issue before as I saw that gnu patch was required for any patches here as mentioned in the forum.

Thanks again,
Brian Gregg.
bdgregg
 
Posts: 117
Joined: Wed Sep 15, 2004 8:21 am
Location: University of Pittsburgh


Return to OJS Technical Support

Who is online

Users browsing this forum: Bing [Bot] and 3 guests