Problem upgrading to 3.3.0-16 from 3.2.1-5

While upgrading a multi journal OJS installation from 3.2.1-5 to 3.3.0-16 I receive
a lot of warnings like the following:

PHP Notice: Undefined offset: 1 in …/lib/pkp/classes/migration/upgrade/PKPv3_3_0UpgradeMigration.inc.php on line 611
A submission file was expected but not found at journals/39/articles/4791//4791-421-14873-1-1-20200706.pdf.
A file assigned to the file stage 1 could not be migrated.
PHP Notice: Undefined offset: 1 in …/lib/pkp/classes/migration/upgrade/PKPv3_3_0UpgradeMigration.inc.php on line 611
A submission file was expected but not found at journals/39/articles/4792//4792-421-14874-1-1-20200706.pdf.
A file assigned to the file stage 1 could not be migrated.
PHP Notice: Undefined offset: 1 in …/lib/pkp/classes/migration/upgrade/PKPv3_3_0UpgradeMigration.inc.php on line 611
A submission file was expected but not found at journals/39/articles/4793//4793-421-14875-1-1-20200706.pdf.
A file assigned to the file stage 1 could not be migrated.

All error reports are related the journal with id 39.

The OJS update finishes successfully but when I try to access the PDF files of the article published on journal with id 39, I get an error (error 500).
Also, if I try to access the submissions view of the same journal from the OJS backend, I again receive error: the pop-up windows is empty and never stops loading.

Steps I took leading up to the issue

  • Execute upgrade script: php tools/upgrade.php upgrade
  • Go to the frontend page of the Journal with id=39
  • Go to an issue table of the journal
  • Go to an article detail
  • Click on PDF button
  • A white page or “error 500” message is shown
  • In the Php error log file I see the following message:

[16-Oct-2024 14:15:57 Europe/Rome] PHP Fatal error: Uncaught Exception: Could not determine the workflow stage id from submission file 14957 with file stage 1 in /…//lib/pkp/classes/services/PKPSubmissionFileService.inc.php:782
Stack trace:
#0 /…//lib/pkp/classes/services/PKPSubmissionFileService.inc.php(190): PKP\Services\PKPSubmissionFileService->getWorkflowStageId()
#1 /…//lib/pkp/classes/services/PKPSubmissionFileService.inc.php(224): PKP\Services\PKPSubmissionFileService->getProperties()
#2 /…/classes/services/GalleyService.inc.php(154): PKP\Services\PKPSubmissionFileService->getFullProperties()
#3 /…/classes/services/GalleyService.inc.php(179): APP\Services\GalleyService->getProperties()
#4 /…/lib/pkp/classes/services/PKPPublicationService.inc.php(208): APP\Services\GalleyService->getSummaryProperties()
#5 [internal function]: PKP\Services\PKPPublicationService->PKP\Services{closure}()
#6 /…/lib/pkp/classes/services/PKPPublic in /…/lib/pkp/classes/services/PKPSubmissionFileService.inc.php on line 782

What application are you using?
OJS 3.3.0-16 and OJS 3.2.1-5

Additional information
OS: Linux Ubuntu
PHP: 7.4
Web server : Apache
DBMS: MariaDB

UPDATES:

1) About the frontend issue
For the frontend issue (links to PDF file of the article giving “error 500”) it came out that the path to access those files on the filesystem, stored in the field ‘path’ of the ‘files’ table, were wrong.
This is an example of wrong path:
journals/39/articles/6578//name-of-the-file.pdf
where the “public” directory is missing betwin the 2 slashes.
This is the fixed path:
journals/39/articles/6578**/public/**name-of-the-file.pdf
Most likely the wrong path for the files of that journal come from an issue with the previous update. In fact, before updating the OJS instance from 3.2 to 3.3 I had previously updated it from 3.1 to 3.2.
Anyway, this is the query that I’ve used to fix this issue:

UPDATE files
SET path = REPLACE (path, '//', '/public/')
WHERE path LIKE '%//%' and path LIKE 'journals/39/articles%'

Where “39” is the ID of the journal affected from the problem.

2) About the backend issue
For the backend issue (unable to access the ‘submission’ form) it came out that the problem was a wrong value in the field “file_stage” of the table “submission_files”.
For all the submissions affected from the issue, the value in that field was “1” instead of “10”.
Most probably, once again, this was due to an error in a previous update process.
I saw in the SubmissionFile.inc.php of OJS 3.3.0-16 (pkp-lib/classes/submission/SubmissionFile.inc.php at 3_3_0-16 · pkp/pkp-lib · GitHub) that the value “1” is not admitted as it was in OJS 3.2 and previous (pkp-lib/classes/submission/SubmissionFile.inc.php at 3_2_1-5 · pkp/pkp-lib · GitHub)

Anyway, this is the query that I’ve used to fix this issue:

UPDATE `submission_files` SET file_stage = 10 
WHERE file_stage = 1