OJS3 XML Import Errors

I am trying to import XML using the following command

php tools/importExport.php NativeImportExportPlugin import xml/[journal]/issue.xml [journal_path] admin

The output for this command is:

PHP Warning:  Declaration of PKPUsageEventPlugin::getEnabled() should be compatible with LazyLoadPlugin::getEnabled($contextId = NULL) in /var/www/html/lib/pkp/plugins/generic/usageEvent/PKPUsageEventPlugin.inc.php on line 386
PHP Warning:  Declaration of SubmissionKeywordEntryDAO::getByControlledVocabId($controlledVocabId, $rangeInfo = NULL) should be compatible with ControlledVocabEntryDAO::getByControlledVocabId($controlledVocabId, $rangeInfo = NULL, $filter = NULL) in /var/www/html/lib/pkp/classes/submission/SubmissionKeywordEntryDAO.inc.php on line 20
PHP Warning:  Declaration of SubmissionFileDAO::fromRow($row) should be compatible with PKPSubmissionFileDAO::fromRow($row, $fileImplementation) in /var/www/html/classes/article/SubmissionFileDAO.inc.php on line 23
PHP Warning:  Declaration of TemporaryFileManager::downloadFile($fileId, $userId, $inline = false) should be compatible with FileManager::downloadFile($filePath, $mediaType = NULL, $inline = false, $fileName = NULL) in /var/www/html/lib/pkp/classes/file/TemporaryFileManager.inc.php on line 19
PHP Warning:  Declaration of TemporaryFileManager::deleteFile($fileId, $userId) should be compatible with FileManager::deleteFile($filePath) in /var/www/html/lib/pkp/classes/file/TemporaryFileManager.inc.php on line 19
PHP Notice:  tempnam(): file created in the system's temporary directory in /var/www/html/lib/pkp/plugins/importexport/native/filter/NativeXmlSubmissionFileFilter.inc.php on line 267
PHP Notice:  tempnam(): file created in the system's temporary directory in /var/www/html/lib/pkp/plugins/importexport/native/filter/NativeXmlSubmissionFileFilter.inc.php on line 267
PHP Notice:  tempnam(): file created in the system's temporary directory in /var/www/html/lib/pkp/plugins/importexport/native/filter/NativeXmlSubmissionFileFilter.inc.php on line 267

Warnings encountered:
1.Submission
- The provided filesize "832446" and the actual filesize "" do not match
2.Submission
- The provided filesize "530111" and the actual filesize "" do not match
3.Submission
- The provided filesize "272401" and the actual filesize "" do not match

Errors occured:
1.Submission
- Temporary file /tmp/srcfBDyx5 could not be created from /var/www/html/xml/[journal]/[filename_1].pdf
2.Submission
- Temporary file /tmp/srcW5aZiA could not be created from /var/www/html/xml/[journal]/[filename_2].pdf
3.Submission
- Temporary file /tmp/srcU4w8Y6 could not be created from /var/www/html/xml/[journal]/[filename_3].pdf

PHP Warning:  Declaration of IssueFileManager::downloadFile($fileId, $inline = false) should be compatible with FileManager::downloadFile($filePath, $mediaType = NULL, $inline = false, $fileName = NULL) in /var/www/html/classes/file/IssueFileManager.inc.php on line 189

However, when I trying importing the same XML file online using the web interface, it imports without any issue.

1 Like

Hi @sahmad

Hmmm… What do your XML elements revision contain, an embedded file or a path to the file?

Hmmm…
Best,
Bozana

Hi @bozana,

They contain a path to the file.

Best,
Shaharyar

Hi @sahmad

Hmmm… How many files are you trying to import? It seems like 3 files are problematic… Hmmm… Are all files really there and with correct permissions (for the user executing the script)?

Hmmm… :thinking:
Bozana

Hi @bozana,

There’s only three files in the XML. The files are present and with the permissions 777.

Seems strange that the web portal would import the same files and the command line would fail. Tried to import different files but I get the same result each time.

Hmmm… strange…
And can the user that executes the script write in the /tmp folder?

Yes, I’ve checked the permissions, they’re 777 for tmp folder as well

Hmmm…
I’ve just looked at the code, and actually a temp/ folder in your files folder should be used as a temporary directory, s. pkp-lib/NativeXmlSubmissionFileFilter.inc.php at omp-3_1_1-2 · pkp/pkp-lib · GitHub.
Thus, could you also double check if you have this folder and the permissions on your files folder for the user executing the script?
Do you have absolute paths to the files in your import XML?
For some reason copying the files into the /tmp does not work…

There is a temp/ folder in the files/directory and the files that I tried to upload are created in the temp folder. It seems as though they’re not being copied from the temp/ folder. The user has access to both the temp/ and tmp/ folders.

I’m using absolute paths for the files. Could that have anything to do with the issue? The permissions seem to be all around.

Hi @bozana,

I just removed the absolute paths and it just worked. Spent so many days trying to figure this one out.

Thanks for the help.

Best,

Shaharyar