OJS 2.4 to 3.1 upgrade

I upgraded from OJS 2.3.3-1 to 2.4.8-5 successfully and then ran into problems going to version 3.1.2-1. I deleted everything in the web folder but the config.inc.php and public folder. I pasted all the 3.1.2-1 files into the folder and ran the command line php tools/upgrade.php script. The machine is using php7.3 but it can be downgraded to php7.1 or 7.2.

I’m attaching the log terminal readout and another log of upgrade steps.

[pre-install]

[load: upgrade.xml]
[version: 3.1.2.1]

[code: Installer Installer::checkPhpVersion]

[code: Installer Installer::syncSeriesAssocType]
[data: dbscripts/xml/upgrade/2.4.0_preupdate_usageStatistics.xml (skipped)]
[data: dbscripts/xml/upgrade/2.4.0_preupdate_usageStatistics2.xml (skipped)]

[code: Installer Installer::removeReviewEntries]
[data: dbscripts/xml/upgrade/3.0.0_preupdate.xml]
[data: dbscripts/xml/upgrade/3.0.0_adaptTimedViews.xml (skipped)]
[data: dbscripts/xml/upgrade/3.0.0_adaptReferrals.xml]
[data: dbscripts/xml/upgrade/3.0.0_adaptBooksForReview.xml]
[data: dbscripts/xml/upgrade/remove_timed_views_bots.xml (skipped)]
[data: dbscripts/xml/upgrade/3.0.0_preupdate_commentsToEditor.xml]
[data: dbscripts/xml/upgrade/3.1.0_preupdate_review_assignments.xml]
[data: dbscripts/xml/upgrade/3.1.0_preupdate_notes.xml]
[data: dbscripts/xml/upgrade/3.1.0_preupdate_payments.xml]
[data: dbscripts/xml/upgrade/3.1.1_preupdate_citations.xml]
[data: dbscripts/xml/upgrade/3.1.2_preupdate_user_author_names.xml]
[schema: lib/pkp/xml/schema/common.xml]
[schema: lib/pkp/xml/schema/log.xml]
[schema: lib/pkp/xml/schema/announcements.xml]
[schema: lib/pkp/xml/schema/scheduledTasks.xml]
[schema: lib/pkp/xml/schema/temporaryFiles.xml]
[schema: lib/pkp/xml/schema/metadata.xml]
[schema: lib/pkp/xml/schema/reviews.xml]
[schema: lib/pkp/xml/schema/reviewForms.xml]
[schema: lib/pkp/xml/schema/controlledVocab.xml]
[schema: lib/pkp/xml/schema/submissions.xml]
[schema: lib/pkp/xml/schema/submissionFiles.xml]
[schema: lib/pkp/xml/schema/categories.xml]
[schema: lib/pkp/xml/schema/notes.xml]
[schema: lib/pkp/xml/schema/genres.xml]
[schema: lib/pkp/xml/schema/tombstone.xml]
[schema: lib/pkp/xml/schema/rolesAndUserGroups.xml]
[schema: lib/pkp/xml/schema/metrics.xml]
[schema: lib/pkp/xml/schema/views.xml]
[schema: lib/pkp/xml/schema/libraryFiles.xml]
[schema: lib/pkp/xml/schema/navigationMenus.xml]
[schema: dbscripts/xml/ojs_schema.xml]
[data: dbscripts/xml/indexes.xml]

[code: Installer Installer::installDefaultNavigationMenus]

[code: Installer Installer::migrateStaticPagesToNavigationMenuItems]

[code: Installer Installer::migrateSRLocale]

[code: Installer Installer::migrateUserAndAuthorNames]

[code: Installer Installer::concatenateIntoAbout]

[code: Installer Installer::concatenateIntoMasthead]

[code: Installer Installer::migrateCounterPluginUsageStatistics]

[code: Installer Installer::migrateTimedViewsUsageStatistics (skipped)]

[code: Installer Installer::migrateDefaultUsageStatistics (skipped)]
[data: dbscripts/xml/upgrade/2.4.0_postUsageStatsMigration.xml (skipped)]
[data: dbscripts/xml/upgrade/2.4.0_postUsageStatsMigration2.xml (skipped)]
[data: dbscripts/xml/upgrade/2.4.0_postCounterMigration.xml]
[data: dbscripts/xml/upgrade/2.4.0_postTimedViewsMigration.xml (skipped)]
[data: dbscripts/xml/upgrade/3.0.0_change_assoc_type.xml]
[data: dbscripts/xml/upgrade/3.0.0_change_assoc_type_metrics.xml]
[data: dbscripts/xml/upgrade/3.0.0_settings.xml]

[code: Installer Installer::installDefaultGenres]

[code: Installer Installer::migrateArticleMetadata]
[data: dbscripts/xml/upgrade/3.0.0_update.xml]

[code: Installer Installer::clearDataCache]

[code: Installer Installer::migrateUserRoles]

[code: Installer Installer::fixReviewForms]

[code: Installer Installer::htmlifyEmailTemplates]
[note: docs/release-notes/README-BEACON]

[code: Installer Installer::installEmailTemplate]

[code: Installer Installer::installEmailTemplate]

[code: Installer Installer::installEmailTemplate]

[code: Installer Installer::installEmailTemplate]

[code: Installer Installer::installEmailTemplate]

[code: Installer Installer::installEmailTemplate]
[data: dbscripts/xml/upgrade/3.0.0_scheduledTasks.xml]

[code: Installer Installer::localizeCustomBlockSettings]

[code: Installer Installer::convertEditorDecisionNotes]

[code: Installer Installer::convertQueries]

[code: Installer Installer::migrateFiles]

[code: Installer Installer::convertSupplementaryFiles]

sudo php tools/upgrade.php upgrade > ~/edgj-errors.txt
[sudo] password for joyner:
PHP Notice: Only variables should be assigned by reference in /websites/www.edgj.org/Public3/lib/pkp/classes/db/DBDataXMLParser.inc.php on line 122
PHP Notice: Only variables should be assigned by reference in /websites/www.edgj.org/Public3/lib/pkp/classes/db/DBDataXMLParser.inc.php on line 122
PHP Notice: Only variables should be assigned by reference in /websites/www.edgj.org/Public3/lib/pkp/classes/db/DBDataXMLParser.inc.php on line 122
PHP Notice: Only variables should be assigned by reference in /websites/www.edgj.org/Public3/lib/pkp/classes/db/DBDataXMLParser.inc.php on line 122
PHP Notice: Only variables should be assigned by reference in /websites/www.edgj.org/Public3/lib/pkp/classes/db/DBDataXMLParser.inc.php on line 122
PHP Notice: Only variables should be assigned by reference in /websites/www.edgj.org/Public3/lib/pkp/classes/db/DBDataXMLParser.inc.php on line 122
PHP Notice: Only variables should be assigned by reference in /websites/www.edgj.org/Public3/lib/pkp/classes/db/DBDataXMLParser.inc.php on line 122
PHP Notice: Only variables should be assigned by reference in /websites/www.edgj.org/Public3/lib/pkp/classes/db/DBDataXMLParser.inc.php on line 122
PHP Notice: Only variables should be assigned by reference in /websites/www.edgj.org/Public3/lib/pkp/classes/db/DBDataXMLParser.inc.php on line 122
PHP Notice: Only variables should be assigned by reference in /websites/www.edgj.org/Public3/lib/pkp/classes/db/DBDataXMLParser.inc.php on line 122
PHP Notice: Only variables should be assigned by reference in /websites/www.edgj.org/Public3/lib/pkp/classes/db/DBDataXMLParser.inc.php on line 122
PHP Notice: Only variables should be assigned by reference in /websites/www.edgj.org/Public3/lib/pkp/classes/db/DBDataXMLParser.inc.php on line 122
PHP Notice: Only variables should be assigned by reference in /websites/www.edgj.org/Public3/lib/pkp/classes/db/DBDataXMLParser.inc.php on line 122
PHP Notice: Only variables should be assigned by reference in /websites/www.edgj.org/Public3/lib/pkp/classes/db/DBDataXMLParser.inc.php on line 122
PHP Notice: Only variables should be assigned by reference in /websites/www.edgj.org/Public3/lib/pkp/classes/db/DBDataXMLParser.inc.php on line 122
PHP Notice: Only variables should be assigned by reference in /websites/www.edgj.org/Public3/lib/pkp/classes/db/DBDataXMLParser.inc.php on line 122
PHP Notice: Only variables should be assigned by reference in /websites/www.edgj.org/Public3/lib/pkp/classes/db/DBDataXMLParser.inc.php on line 122
PHP Notice: Only variables should be assigned by reference in /websites/www.edgj.org/Public3/lib/pkp/classes/db/DBDataXMLParser.inc.php on line 122
PHP Warning: Invalid argument supplied for foreach() in /websites/www.edgj.org/Public3/classes/install/Upgrade.inc.php on line 2078
PHP Warning: Invalid argument supplied for foreach() in /websites/www.edgj.org/Public3/classes/install/Upgrade.inc.php on line 2238
PHP Warning: Declaration of SubmissionLanguageEntryDAO::getByControlledVocabId($controlledVocabId, $rangeInfo = NULL) should be compatible with ControlledVocabEntryDAO::getByControlledVocabId($controlledVocabId, $rangeInfo = NULL, $filter = NULL) in /websites/www.edgj.org/Public3/lib/pkp/classes/submission/SubmissionLanguageEntryDAO.inc.php on line 20
PHP Warning: Declaration of SubmissionAgencyEntryDAO::getByControlledVocabId($controlledVocabId, $rangeInfo = NULL) should be compatible with ControlledVocabEntryDAO::getByControlledVocabId($controlledVocabId, $rangeInfo = NULL, $filter = NULL) in /websites/www.edgj.org/Public3/lib/pkp/classes/submission/SubmissionAgencyEntryDAO.inc.php on line 44

PHP Fatal error: Uncaught Error: Call to a member function getStatus() on null in /websites/www.edgj.org/Public3/classes/install/Upgrade.inc.php:1351
Stack trace:
#0 /websites/www.edgj.org/Public3/lib/pkp/classes/install/Installer.inc.php(421): Upgrade->convertSupplementaryFiles(Object(Upgrade), Array)
#1 /websites/www.edgj.org/Public3/lib/pkp/classes/install/Installer.inc.php(265): Installer->executeAction(Array)
#2 /websites/www.edgj.org/Public3/lib/pkp/classes/install/Installer.inc.php(186): Installer->executeInstaller()
#3 /websites/www.edgj.org/Public3/lib/pkp/classes/cliTool/UpgradeTool.inc.php(88): Installer->execute()
#4 /websites/www.edgj.org/Public3/lib/pkp/classes/cliTool/UpgradeTool.inc.php(64): UpgradeTool->upgrade()
#5 /websites/www.edgj.org/Public3/tools/upgrade.php(34): UpgradeTool->execute()
#6 {main}
thrown in /websites/www.edgj.org/Public3/classes/install/Upgrade.inc.php on line 1351

Hi @criminal,

I haven’t seen this one before, but it looks to me like it might be a database inconsistency. That area of the code (classes/install/Upgrade.inc.php around line 1351) is responsible for converting supplementary files, and it looks like it’s having trouble finding an article entry for a given supplementary file. All supplementary files should have associated articles or you’ve got a data integrity problem.

Try running this database query:

SELECT sf.article_id FROM article_supplementary_files sf LEFT JOIN articles a ON (sf.article_id = a.article_id) WHERE a.article_id IS NULL;

If you get any results here, it means you’ve got orphan entries inarticle_supplementary_files that refer to nonexistent articles by article_id. I’d suggest cleaning those up before running the upgrade.

Regards,
Alec Smecher
Public Knowledge Project Team

Thank you Alec. I deleted a few rows from the article table that do not have folders in the file system. The upgrade script gets to the following query
SELECT DISTINCT
sf.file_id AS submission_file_id, sf.revision AS submission_revision,
af.file_id AS artwork_file_id, af.revision AS artwork_revision,
suf.file_id AS supplementary_file_id, suf.revision AS supplementary_revision,
s.locale AS submission_locale,
sf., af., suf.*
FROM submission_files sf
LEFT JOIN submission_artwork_files af ON sf.file_id = af.file_id AND sf.revision = af.revision
LEFT JOIN submission_supplementary_files suf ON sf.file_id = suf.file_id AND sf.revision = suf.revision
LEFT JOIN submissions s ON s.submission_id = sf.submission_id WHERE sf.file_id = 706 ORDER BY sf.submission_id ASC, sf.file_stage ASC, sf.file_id ASC, sf.revision DESC

SELECT * FROM submission_file_settings WHERE file_id = ‘706’

The submission_file_settings table is empty.

Hi @criminal,

Do you get an error message?

Regards,
Alec Smecher
Public Knowledge Project Team

Yes, I ran the script with the debug option and it displays:

(mysqli): SELECT * FROM submission_file_settings WHERE file_id = ‘706’

-----



PHP Fatal error: Uncaught Error: Call to a member function getStatus() on null in /websites/www.edgj.org/Public3/classes/install/Upgrade.inc.php:1351
Stack trace:
#0 /websites/www.edgj.org/Public3/lib/pkp/classes/install/Installer.inc.php(421): Upgrade->convertSupplementaryFiles(Object(Upgrade), Array)
#1 /websites/www.edgj.org/Public3/lib/pkp/classes/install/Installer.inc.php(265): Installer->executeAction(Array)
#2 /websites/www.edgj.org/Public3/lib/pkp/classes/install/Installer.inc.php(186): Installer->executeInstaller()
#3 /websites/www.edgj.org/Public3/lib/pkp/classes/cliTool/UpgradeTool.inc.php(88): Installer->execute()
#4 /websites/www.edgj.org/Public3/lib/pkp/classes/cliTool/UpgradeTool.inc.php(64): UpgradeTool->upgrade()
#5 /websites/www.edgj.org/Public3/tools/upgrade.php(34): UpgradeTool->execute()
#6 {main}
thrown in /websites/www.edgj.org/Public3/classes/install/Upgrade.inc.php on line 1351

Hi @criminal,

You still seem to have a database inconsistency. I’ve added a check for this that’ll result in a warning and skip migrating the affected supplementary file (you can patch your install by applying Add warning for unresolvable article · pkp/ojs@bbd4d16 · GitHub before running the upgrade) but I’d suggest instead checking to see if there is something wrong with the article. The most common cause for this will be an article that’s missing a section; you can check for this by executing the following query in your OJS 2.x database:

SELECT a.section_id FROM articles a LEFT JOIN sections s ON (s.section_id = a.section_id);

Every article’s section_id should resolve to an existing entry in sections.

Regards,
Alec Smecher
Public Knowledge Project Team

Thank you Alec. The query above discovered almost half of the 558 articles were missing a section. I deleted all the rows that were missing a section. That was probably a mistake.

It created a new error that might be a result of deleting all the rows.
PHP Fatal error: Uncaught Error: Call to a member function getContextId() on null in /websites/www.edgj.org/Public3/lib/pkp/classes/submission/reviewAssignment/ReviewAssignment.inc.php:526
Stack trace:
#0 /websites/www.edgj.org/Public3/lib/pkp/classes/submission/reviewAssignment/ReviewAssignment.inc.php(502): ReviewAssignment->isRead()
#1 /websites/www.edgj.org/Public3/lib/pkp/classes/submission/reviewRound/ReviewRound.inc.php(213): ReviewAssignment->getStatus()
#2 /websites/www.edgj.org/Public3/lib/pkp/classes/submission/reviewRound/ReviewRoundDAO.inc.php(260): ReviewRound->determineStatus()
#3 /websites/www.edgj.org/Public3/lib/pkp/classes/submission/reviewAssignment/ReviewAssignmentDAO.inc.php(462): ReviewRoundDAO->updateStatus(Object(ReviewRound))
#4 /websites/www.edgj.org/Public3/lib/pkp/classes/submission/reviewAssignment/ReviewAssignmentDAO.inc.php(538): ReviewAssignmentDAO->updateReviewRoundStatus(Object(ReviewAssignment))
#5 /websites/www.edgj.org/Public3/classes/install/Upgrade.inc.php(2024): ReviewAssignmentDAO->de in /websites/www.edgj.org/Public3/lib/pkp/classes/submission/reviewAssignment/ReviewAssignment.inc.php on line 526

Hi @criminal,

I would definitely recommend updating the article’s section_id (thus assigning it to an existing section) rather than deleting the entry from articles. As you’ve discovered, the missing entry in articles will cause trouble further down the line with other tables that refer to it.

Regards,
Alec Smecher
Public Knowledge Project Team

Thank you Alec. Assigning the orphaned articles a section_id helped complete the upgrade successfully.

Thank you.