osulp / ojs

Open Journal Systems (OJS)
1 stars 0 forks source link

OLAQ Article PDF errors on OJS-Test #4

Closed carakey closed 2 years ago

carakey commented 3 years ago

For OLAQ journal issues migrated from Bepress (all issues prior to 25(4)), in the current 3.3 instance at ojs-test:

Example: https://ojs-test.library.oregonstate.edu/olaq/article/view/vol25_iss2_2/1982

The reported XML validation errors when attempting to export an issue are:

Element '{http://pkp.sfu.ca}submission_file', attribute 'stage': [facet 'enumeration'] The value '' is not an element of the set {'public', 'submission', 'note', 'review_file', 'review_attachment', 'final', 'fair_copy', 'editor', 'copyedit', 'proof', 'production_ready', 'attachment', 'query', 'review_revision', 'dependent'}.

Element '{http://pkp.sfu.ca}file', attribute 'filesize': '' is not a valid value of the atomic type 'xs:int'.

(The above pair errors seem to occur twice for each submission item in the issue)

Element '{http://pkp.sfu.ca}issue': Missing child element(s). Expected is ( {http://pkp.sfu.ca}articles ).

FWIW:

wickr commented 2 years ago

OLAQ Article PDFs imported came in with a file_stage ID set to 1 but it turns out that value is not used by OJS anymore. https://github.com/pkp/pkp-lib/blob/d55b811f5ac8a68b729a70288d35c4148411b49c/classes/submission/SubmissionFile.inc.php#L24

Since that was set incorrectly, the migration script for v3.3 failed moving PDF files to the correct path, and the DB table with file paths had an invalid path set: journals/1/articles/9//9-1-9-1-1-20200131.pdf

This was fixed manually, by moving the PDF files to the expected paths, and updating the DB tables that have the paths included. Updating DB file paths:

# single path update
UPDATE files SET path = 'journals/1/articles/994/submission/proof/994-1-994-1-1-20200131.pdf' WHERE file_id = 866;
# all paths update
UPDATE files SET path = REPLACE(path, '//', '/submission/proof/') WHERE file_id < 10;

Moving the PDF files ended up being a multi-step process, getting a list of all the article folder paths with public saved to a file, and then ultimately iterating over that list, and running

find . -name '*public' -exec sh -c 'mkdir -p submission; mv "$@" submission/proof' find-sh {} +

That made all of the PDFs display correctly, but the admin UI still wouldn't show more than 1 page of the submissions archive. Setting the file_stage values to 10 instead of 1 in the DB fixed the admin UI issue.

Updating DB submission_files table:

UPDATE submission_files SET file_stage = 10 WHERE submission_file_id < 1006;

Doing this before the v3.3 migration would almost certainly solve the above file path issues, since the migration code would recognize the file stage values.

v3.3 Migration error log messages:

PHP Notice:  Undefined offset: 1 in .../ojs-3.3.0-8/lib/pkp/classes/migration/upgrade/PKPv3_3_0UpgradeMigration.inc.php on line 609
A submission file was expected but not found at journals/1/articles/970//970-1-970-1-1-20200131.pdf.
A file assigned to the file stage 1 could not be migrated.
carakey commented 2 years ago

I spot checked several issues' PDFs and verified that exporting with Native plugin is working.

I found a discrepancy between the XSLT for original OLAQ files from Bepress (whose PDFs were broken in 3.3) versus XSLT for 2.x to 3.x (whose PDFs were working) - the submission_file stage attribute in the former being 'public' and latter being 'proof'.