OJS OCS OMP OHS

You are viewing the PKP Support Forum | PKP Home Wiki



Looking for practical methods for creating galley files

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.

Postby shimrah » Tue Apr 24, 2007 8:08 am

Okay... I haven't had a chance to work on this for a few days, and now the white screen is back. I'm not sure why it worked a couple of times there, but there we have it.

This is the log output I'm getting:

Code: Select all
[24-Apr-2007 10:53:15] **ENTERED SubmissionEditHandler.inc.php 1**...
[24-Apr-2007 10:53:15] **ENTERED validate FUNCTION**...
[24-Apr-2007 10:53:15] **validate FUNCTION 3**...
[24-Apr-2007 10:53:15] **validate FUNCTION 4**...
[24-Apr-2007 10:53:15] **REACHED END OF validate FUNCTION**...
[24-Apr-2007 10:53:15] !! **ENTERED execute FUNCTION**...
[24-Apr-2007 10:53:15] !! **execute FUNCTION 1**...
[24-Apr-2007 10:53:15] !! **execute FUNCTION 3**...
[24-Apr-2007 10:53:16] !! **execute FUNCTION 4**...


Which seems to indicate that the execute funtion goes as far as trying to run

Code: Select all
error_log("!! **execute FUNCTION 4**...", 0);
            // Update file search index
            import('search.ArticleSearchIndex');
            ArticleSearchIndex::updateFileIndex($this->articleId, ARTICLE_SEARCH_GALLEY_FILE, $galley->getFileId());
         }


but no further. I can't explain why it went further last time I was working on this (I wish I could!) but let's start here.

Thanks again, Alec, and sorry that this is turning out to be such a hunt...
shimrah
 
Posts: 45
Joined: Thu Apr 05, 2007 10:01 am

Postby shimrah » Thu Apr 26, 2007 10:44 am

Okay. I've been working out other issues, but I'm back to focusing on the galley upload problem. Here's where I'm at.

It looks like fileinfo is working fine. When I run mime_content_type with debugging output, I get the following output

$filename = C:\PHP\uploadtemp\php2C0A.tmp
finfo_open = Resource id #196
and finfo_file = text/html


However, I am still getting the white screen and no uploaded content showing up on the editing screen.

In the excute function, it's only getting as far as

Code: Select all
ArticleSearchIndex::updateFileIndex($this->articleId, ARTICLE_SEARCH_GALLEY_FILE, $fileId);


And variables being passed are echoed as:

this->articleId:7
ARTICLE_SEARCH_GALLEY_FILE:128
fileId=92



which all seem like reasonable values to me, but you may have more insight...

(And no error messages in the error_log.)

Thanks again... I feel like we're homing in on the trouble spot here...
shimrah
 
Posts: 45
Joined: Thu Apr 05, 2007 10:01 am

Postby asmecher » Thu Apr 26, 2007 11:09 am

Hi Shimrah,

These sorts of errors really should be generating something in an error log somewhere on your system; double-check your php.ini to see where it's sending errors. This will save you a lot of time tracking down errors with output logging.

In any case, you'll need to step into classes/search/ArticleSearchIndex.inc.php. Are you saving your HTML in UTF-8, or is it Latin1 or ISO8859-1? If it's the latter, it could be a database character set problem. Make sure you're using UTF-8 for your HTML galleys before you continue debugging.

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: 9212
Joined: Wed Aug 10, 2005 12:56 pm

Postby shimrah » Thu Apr 26, 2007 1:27 pm

Hi Alec,

My error log is up and running, and I have all errors set to report to it. I've gotten errors there for other functions (and sites), but that's what makes this problem so hard to diagnose: there don't seem to be any errors thrown (at least, nothing that PHP is recognizing).

...

So I've stepped through updateFileIndex() ... and it seems to break after looping through this loop 45 times:

Code: Select all
while(($text = $parser->read()) !== false) {
ArticleSearchIndex::indexObjectKeywords($objectId, $text, $position);
            }


And, digging a bit more, indexObjectKeywords breaks in this loop after 28 iterations:

Code: Select all
      for ($i = 0, $count = count($keywords); $i < $count; $i++) {

         $searchDao->insertObjectKeyword($objectId, $keywords[$i], $position);
         $position += 1;
      }


And when it breaks, indexObjectKeyword is passing:


$objectId = 115
$keywords = patients
$position = 656


You mentioned that a blank screen could be the result of an overflow somewhere. Could this break be due to such an overflow? If so, where would you suggest I look?

Thanks...
shimrah
 
Posts: 45
Joined: Thu Apr 05, 2007 10:01 am

Postby asmecher » Thu Apr 26, 2007 1:35 pm

Hi Shimrah,

This still sounds to me like a PHP memory or execution time limit is being hit. Anyway, you'll have to follow indexObjectKeyword through to the gory end in classes/search/ArticleSearchDAO.inc.php.

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: 9212
Joined: Wed Aug 10, 2005 12:56 pm

Postby shimrah » Thu Apr 26, 2007 2:31 pm

Hey Alec,

Okay, you're right. That file was too big to be playing with. I increased the timeout for php.ini and in IIS, and managed to upload a galley...

But I get the following warning:

PHP Warning: Cannot modify header information - headers already sent by (output started at C:\OJS\classes\core\String.inc.php:228) in C:\OJS\classes\core\Request.inc.php on line 33


and have to hit [back] then refresh to see the new galley file, which is labeled as "unknown"...

On the positive front, the file type, when I click on "edit" for the galley file, is text/html

A good sign, I hope?
shimrah
 
Posts: 45
Joined: Thu Apr 05, 2007 10:01 am

Postby asmecher » Thu Apr 26, 2007 2:57 pm

Hi Shimrah,

Did you leave any debugging "echo" statements in String.inc.php? That would explain the error.

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: 9212
Joined: Wed Aug 10, 2005 12:56 pm

Postby shimrah » Fri Apr 27, 2007 8:52 am

Yes, it was the echo statements causing that problem... thanks...

---

And victory!

It seems that OJS was looking for the type 'html', while fileinfo was returning 'text/html' (is this a Windows server peculiarity?) ... a small change to mime_content_type, coupled with larger php and IIS/CGI buffers solved my problems.

Thanks again, Alec, for your help!

Code: Select all
function mime_content_type($filename) {
   if (function_exists('mime_content_type')) {
         return mime_content_type($filename);
   } elseif (function_exists('finfo_open')) {
         static $fi;
         if (!isset($fi)) {
               $fi = finfo_open(FILEINFO_MIME, 'C:\PHP\extras\magic');
         }
         if ($fi !== false) {
//               return finfo_file($fi, $filename);
//added the following:
               $result=finfo_file($fi, $filename);
               if ($result="text/html") {
                  $result="html";
               }
               return $result;
         }
   }


   // Fall back on an external "file" tool
   $f = escapeshellarg($filename);
   $result = trim(`C:\PHP\GnuWin32\bin\file -bi $f`);
   if ($result="text/html") {
      $result="html";
   }
   // Make sure we just return the mime type.
   if (($i = strpos($result, ';')) !== false) {
         $result = trim(substr($result, 0, $i));
   }
   return $result;
}



My only problem now is a CGI timeout with one of my longer files, but I think I'll be able to figure that out... :lol:
shimrah
 
Posts: 45
Joined: Thu Apr 05, 2007 10:01 am

Postby asmecher » Fri Apr 27, 2007 9:30 am

Hi Shimrah,

Glad to hear it's working. FYI, you shouldn't have to change the return value; the type detection code simply looks for an occurrence of "html" in the returned MIME type, so text/html should work. (...and, in fact, only "html" shouldn't -- did you change the conditional statements in classes/submission/form/ArticleGalleyForm.inc.php near line 151 that check the type?)

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: 9212
Joined: Wed Aug 10, 2005 12:56 pm

Postby shimrah » Fri Apr 27, 2007 10:40 am

Hmm... no, I didn't end up changing anything in that file...
shimrah
 
Posts: 45
Joined: Thu Apr 05, 2007 10:01 am

Postby asmecher » Fri Apr 27, 2007 10:52 am

Hi Shimrah,

OK, I'd suggest that you try reverting the change to return "html" instead of "text/html" in the mime_content_type function. The test for whether or not a galley is HTML occurs in classes/submission/form/ArticleGalleyForm.inc.php near line 151, and I'd suggest checking there to see if OJS is detecting HTML vs. non-HTML.

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: 9212
Joined: Wed Aug 10, 2005 12:56 pm

Postby shimrah » Mon Apr 30, 2007 7:42 am

Hey Alec,

I reverted the change and everything still works. A mystery...

After this worked the first time, I re-activated the php_mime_magic.dll extension in php.ini (after we'd installed fileinfo, I got deactivated it) because uploaded jpegs (as images in the HTML galley) weren't being recognized by fileinfo.

... :)
shimrah
 
Posts: 45
Joined: Thu Apr 05, 2007 10:01 am

Previous

Return to OJS Technical Support

Who is online

Users browsing this forum: Yahoo [Bot] and 2 guests