Bug 8404 - XML Galleys broken in upgrade from OJS 2.3.6 to 2.4.2
XML Galleys broken in upgrade from OJS 2.3.6 to 2.4.2
Status: RESOLVED FIXED
Product: OJS
Classification: Unclassified
Component: Plug-ins
2.4.4
All All
: P3 major
Assigned To: PKP Support
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-08-22 13:35 PDT by Charles Parker
Modified: 2014-01-22 08:15 PST (History)
1 user (show)

See Also:
Version Reported In:
Also Affects:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Charles Parker 2013-08-22 13:35:21 PDT
The XMLGalleyPluginDAO produces incorrect filenames to XML files.

OJS 2.4.2 produces:
/var/www/ojs_files/code/journals/1/articles/3/submission/original/3-37-1-PB.XML

The previous OJS version produced:

/var/www/ojs_files/code/journals/1/articles/3/public/3-37-1-PB.XML

Checking the database to be certain of the file_stage:
mysql> SELECT file_stage FROM article_files WHERE article_id=3;
file_stage
7

Adding some debugging in function fileStageToPath($fileStage) led me to find:
echo $fileStage;
'public'
echo ARTICLE_FILE_PUBLIC;
7

Since these don't match, the default case is triggered:

default: return 'submission/original';


It turns out that there is a line missing from the following file:

plugins/generic/xmlGalley/XMLGalleyPlugin.inc.php

In function _returnXMLGalleyFromArticleGalley(&$galley):

After the following line (important):
                $articleXMLGalley->setType('public');
Add this line:
                $articleXMLGalley->setFileStage($galley->getFileStage());

Without it, the fileStage is always hard-coded to 'public', when it should actually be an integer (7, in this case) inherited from the parent object type. This, in turn, causes fileStageToPath($fileStage) to produce an incorrect file path.

I might further suggest that the default case in fileStageToPath($fileStage) should produce an error, rather than happily creating a non-existent path.
Comment 1 Alec Smecher 2014-01-22 08:13:45 PST
Committed. Thanks for tracking this down, Charles; this plugin is not often used and suffers less than ideal maintenance.
Comment 2 Alec Smecher 2014-01-22 08:15:03 PST
Set file stage when fetching XML galley
https://github.com/pkp/ojs/commit/48685e6c16d14ba3bba38424efea3f3fa9847615