[OJS] Native XML plugin fails due to missing files


Using Native XML import/export plugin to export issues, I’m getting this error on a few cases:

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

Running the export on the CLI, I see that this is caused by missing files, for instance:

PHP Warning:  DOMElement::setAttribute() expects parameter 2 to be string, array given in /ojs_dir/lib/pkp/plugins/importexport/native/filter/PKPPublicationNativeXmlFilter.inc.php on line 89
PHP Warning:  filesize(): stat failed for /files_dir/journals/18/articles/1942/submission/1942-72-5998-2-2-20200313.docx in ojs_dir/lib/pkp/plugins/importexport/native/filter/SubmissionFileNativeXmlFilter.inc.php on line 142
PHP Warning:  file_get_contents(/files_dir/journals/18/articles/1942/submission/1942-72-5998-2-2-20200313.docx): failed to open stream: No such file or directory in /ojs_dir/lib/pkp/plugins/importexport/native/filter/SubmissionFileNativeXmlFilter.inc.php on line 164

I’ve checked that:

  • those files are actually missing at files_dir
  • those paths are linked to these submissions at the DB (submission_files.file_id > files.path)
  • this happens for already published submissions only, and all the missing files are at [submission_id]/submission root folder (submission/final is always ok)

Looking at the workflow for these submissions, I don’t see any link to the missing files. I guess they were deleted at some point but, for some reason, the reference was kept at the DB.

So, would it be safe to just update the database deleting those rows pointing at the missing files?

OJS version:

Thanks in advance!

Hi all,
any hint with this one? :slight_smile:

Hi @gonzalognzl,

I think the best solution would actually be to put placeholder files there (e.g. a .docx file containing a note that this file is not available and providing a contact address, in case the missing file later is downloaded through some part of the interface you haven’t explored yet).

Alec Smecher
Public Knowledge Project Team

Thank you @asmecher, that’s actually a safer way

1 Like