Upgrade to 3.1.1-2 from 2.4.8 PHP Fatal error: Call to a member function getStatus()

Hello there. Looks like I’m facing the same failure when upgrading as other users. There seems to be something wrong when upgrading from 2.X to 3.X

PHP 5.6

Can someone help me? Here is the log from the upgrade.

Code version: 3.1.1.2
Database version: 2.4.8.0
Latest version: 3.1.1.2
Database version is older than code version
Run “tools/upgrade.php upgrade” to update
root@server:/dir/where/ojs/is/installed# php tools/upgrade.php upgrade
[pre-install]
[load: upgrade.xml]
[version: 3.1.1.2]

[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]
[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/notes.xml]
[schema: lib/pkp/xml/schema/views.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::concatenateIntoAbout]
PHP Warning: Invalid argument supplied for foreach() in /dir/where/ojs/is/installed/classes/install/Upgrade.inc.php on line 2096
PHP Warning: Invalid argument supplied for foreach() in /dir/where/ojs/is/installed/classes/install/Upgrade.inc.php on line 2096

[code: Installer Installer::concatenateIntoMasthead]
PHP Warning: Invalid argument supplied for foreach() in /dir/where/ojs/is/installed/classes/install/Upgrade.inc.php on line 2255
PHP Warning: Invalid argument supplied for foreach() in /dir/where/ojs/is/installed/classes/install/Upgrade.inc.php on line 2255

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

[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 (skipped)]
[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]
WARNING: Unable to find a match for “31350-35163-10-PB.html” in “/dir/where/ojs/is/installed/files/journals/3//articles/31350/”. Skipping this file.
WARNING: Unable to find a match for “34186-45541-1-SM.pHp” in “/dir/where/ojs/is/installed/files/journals/3//articles/34186/”. Skipping this file.
WARNING: Unable to find a match for “34250-45685-1-RV.doc” in “/dir/where/ojs/is/installed/files/journals/3//articles/34250/”. Skipping this file.
WARNING: Unable to find a match for “34251-45684-1-SM.doc” in “/dir/where/ojs/is/installed/files/journals/3//articles/34251/”. Skipping this file.
WARNING: Unable to find a match for “34251-45686-1-RV.doc” in “/dir/where/ojs/is/installed/files/journals/3//articles/34251/”. Skipping this file.
WARNING: Unable to find a match for “34302-45865-1-RV.docx” in “/dir/where/ojs/is/installed/files/journals/3//articles/34302/”. Skipping this file.
WARNING: Unable to find a match for “34325-45947-1-RV.doc” in “/dir/where/ojs/is/installed/files/journals/3//articles/34325/”. Skipping this file.
WARNING: Unable to find a match for “34347-46038-1-RV.doc” in “/dir/where/ojs/is/installed/files/journals/3//articles/34347/”. Skipping this file.
PHP Notice: Undefined offset: 1 in /dir/where/ojs/is/installed/classes/install/Upgrade.inc.php on line 958
WARNING: Duplicate potential files for “” in “/dir/where/ojs/is/installed/files/journals/3//articles/34499/”. Taking the first.
PHP Notice: Undefined offset: 1 in /dir/where/ojs/is/installed/classes/install/Upgrade.inc.php on line 958
WARNING: Duplicate potential files for “” in “/dir/where/ojs/is/installed/files/journals/3//articles/34500/”. Taking the first.
PHP Notice: Undefined offset: 1 in /dir/where/ojs/is/installed/classes/install/Upgrade.inc.php on line 958
WARNING: Duplicate potential files for “” in “/dir/where/ojs/is/installed/files/journals/3//articles/34500/”. Taking the first.
PHP Notice: Undefined offset: 1 in /dir/where/ojs/is/installed/classes/install/Upgrade.inc.php on line 958
WARNING: Duplicate potential files for “” in “/dir/where/ojs/is/installed/files/journals/3//articles/34502/”. Taking the first.
PHP Notice: Undefined offset: 1 in /dir/where/ojs/is/installed/classes/install/Upgrade.inc.php on line 958
WARNING: Duplicate potential files for “” in “/dir/where/ojs/is/installed/files/journals/3//articles/34503/”. Taking the first.
PHP Notice: Undefined offset: 1 in /dir/where/ojs/is/installed/classes/install/Upgrade.inc.php on line 958
WARNING: Duplicate potential files for “” in “/dir/where/ojs/is/installed/files/journals/3//articles/34504/”. Taking the first.
PHP Notice: Undefined offset: 1 in /dir/where/ojs/is/installed/classes/install/Upgrade.inc.php on line 958
WARNING: Duplicate potential files for “” in “/dir/where/ojs/is/installed/files/journals/3//articles/34505/”. Taking the first.
PHP Notice: Undefined offset: 1 in /dir/where/ojs/is/installed/classes/install/Upgrade.inc.php on line 958
WARNING: Duplicate potential files for “” in “/dir/where/ojs/is/installed/files/journals/3//articles/34506/”. Taking the first.
PHP Notice: Undefined offset: 1 in /dir/where/ojs/is/installed/classes/install/Upgrade.inc.php on line 958
WARNING: Duplicate potential files for “” in “/dir/where/ojs/is/installed/files/journals/3//articles/34507/”. Taking the first.
PHP Notice: Undefined offset: 1 in /dir/where/ojs/is/installed/classes/install/Upgrade.inc.php on line 958
WARNING: Duplicate potential files for “” in “/dir/where/ojs/is/installed/files/journals/3//articles/34508/”. Taking the first.
PHP Notice: Undefined offset: 1 in /dir/where/ojs/is/installed/classes/install/Upgrade.inc.php on line 958
WARNING: Duplicate potential files for “” in “/dir/where/ojs/is/installed/files/journals/3//articles/34509/”. Taking the first.
PHP Notice: Undefined offset: 1 in /dir/where/ojs/is/installed/classes/install/Upgrade.inc.php on line 958
WARNING: Duplicate potential files for “” in “/dir/where/ojs/is/installed/files/journals/3//articles/34510/”. Taking the first.
PHP Notice: Undefined offset: 1 in /dir/where/ojs/is/installed/classes/install/Upgrade.inc.php on line 958
WARNING: Duplicate potential files for “” in “/dir/where/ojs/is/installed/files/journals/3//articles/34513/”. Taking the first.
WARNING: Unable to find a match for “33653-43722-1-RV.pdf” in “/dir/where/ojs/is/installed/files/journals/2//articles/33653/”. Skipping this file.
WARNING: Unable to find a match for “33843-44335-1-PB.pdf” in “/dir/where/ojs/is/installed/files/journals/2//articles/33843/”. Skipping this file.

[code: Installer Installer::convertSupplementaryFiles]
PHP Fatal error: Call to a member function getStatus() on null in /dir/where/ojs/is/installed/classes/install/Upgrade.inc.php on line 1369
root@server:/dir/where/ojs/is/installed#

Anyone able to lend a hand here?
I’m really stuck after trying almost everything that I saw in other posts.

Have you read this: Upgrade to 3.1.1-1: Call to a member function getStatus() on null

I have. I’m running an update now after deleting all articles with null values in section_id. I’ve also applied the patch pkp/pkp#3783 consider supp files without file id in the migration by bozana · Pull Request #2009 · pkp/ojs · GitHub. But every upgrade on the DB takes 6-8 hours so it is a very tedious process and it fails usually at the end. I will report back after it finishes.

Yeah I know :smiley:
It’s the changes to the metrics table that take time. So if you want to fast forward during a test, you could empty the metrics table before an upgrade test.

(I have one installation I am preparing to upgrade to OJS3 that has over 100 journals and there is a single SQL in the upgrade script that takes around 30 hours to complete because the metrics table is so large)

What exactly the metrics table contains?

the upgrade now finished with an different error (which is good!)

[code: Installer Installer::migrateFiles]
WARNING: Unable to find a match for “31350-35163-10-PB.html” in “dir/where/files/are/storedjournals/3//articles/31350/”. Skipping this file.
WARNING: Unable to find a match for “34186-45541-1-SM.pHp” in “dir/where/files/are/storedjournals/3//articles/34186/”. Skipping this file.
WARNING: Unable to find a match for “34250-45685-1-RV.doc” in “dir/where/files/are/storedjournals/3//articles/34250/”. Skipping this file.
WARNING: Unable to find a match for “34251-45684-1-SM.doc” in “dir/where/files/are/storedjournals/3//articles/34251/”. Skipping this file.
WARNING: Unable to find a match for “34251-45686-1-RV.doc” in “dir/where/files/are/storedjournals/3//articles/34251/”. Skipping this file.
WARNING: Unable to find a match for “34302-45865-1-RV.docx” in “dir/where/files/are/storedjournals/3//articles/34302/”. Skipping this file.
WARNING: Unable to find a match for “34325-45947-1-RV.doc” in “dir/where/files/are/storedjournals/3//articles/34325/”. Skipping this file.
WARNING: Unable to find a match for “34347-46038-1-RV.doc” in “dir/where/files/are/storedjournals/3//articles/34347/”. Skipping this file.
PHP Notice: Undefined offset: 1 in /var/www/projetos/buscalegis/revistas/classes/install/Upgrade.inc.php on line 958
WARNING: Duplicate potential files for “” in “dir/where/files/are/storedjournals/3//articles/34499/”. Taking the first.
PHP Notice: Undefined offset: 1 in /var/www/projetos/buscalegis/revistas/classes/install/Upgrade.inc.php on line 958
WARNING: Duplicate potential files for “” in “dir/where/files/are/storedjournals/3//articles/34500/”. Taking the first.
PHP Notice: Undefined offset: 1 in /var/www/projetos/buscalegis/revistas/classes/install/Upgrade.inc.php on line 958
WARNING: Duplicate potential files for “” in “dir/where/files/are/storedjournals/3//articles/34500/”. Taking the first.
PHP Notice: Undefined offset: 1 in /var/www/projetos/buscalegis/revistas/classes/install/Upgrade.inc.php on line 958
WARNING: Duplicate potential files for “” in “dir/where/files/are/storedjournals/3//articles/34502/”. Taking the first.
PHP Notice: Undefined offset: 1 in /var/www/projetos/buscalegis/revistas/classes/install/Upgrade.inc.php on line 958
WARNING: Duplicate potential files for “” in “dir/where/files/are/storedjournals/3//articles/34503/”. Taking the first.
PHP Notice: Undefined offset: 1 in /var/www/projetos/buscalegis/revistas/classes/install/Upgrade.inc.php on line 958
WARNING: Duplicate potential files for “” in “dir/where/files/are/storedjournals/3//articles/34504/”. Taking the first.
PHP Notice: Undefined offset: 1 in /var/www/projetos/buscalegis/revistas/classes/install/Upgrade.inc.php on line 958
WARNING: Duplicate potential files for “” in “dir/where/files/are/storedjournals/3//articles/34505/”. Taking the first.
PHP Notice: Undefined offset: 1 in /var/www/projetos/buscalegis/revistas/classes/install/Upgrade.inc.php on line 958
WARNING: Duplicate potential files for “” in “dir/where/files/are/storedjournals/3//articles/34506/”. Taking the first.
PHP Notice: Undefined offset: 1 in /var/www/projetos/buscalegis/revistas/classes/install/Upgrade.inc.php on line 958
WARNING: Duplicate potential files for “” in “dir/where/files/are/storedjournals/3//articles/34507/”. Taking the first.
PHP Notice: Undefined offset: 1 in /var/www/projetos/buscalegis/revistas/classes/install/Upgrade.inc.php on line 958
WARNING: Duplicate potential files for “” in “dir/where/files/are/storedjournals/3//articles/34508/”. Taking the first.
PHP Notice: Undefined offset: 1 in /var/www/projetos/buscalegis/revistas/classes/install/Upgrade.inc.php on line 958
WARNING: Duplicate potential files for “” in “dir/where/files/are/storedjournals/3//articles/34509/”. Taking the first.
PHP Notice: Undefined offset: 1 in /var/www/projetos/buscalegis/revistas/classes/install/Upgrade.inc.php on line 958
WARNING: Duplicate potential files for “” in “dir/where/files/are/storedjournals/3//articles/34510/”. Taking the first.
PHP Notice: Undefined offset: 1 in /var/www/projetos/buscalegis/revistas/classes/install/Upgrade.inc.php on line 958
WARNING: Duplicate potential files for “” in “dir/where/files/are/storedjournals/3//articles/34513/”. Taking the first.
WARNING: Unable to find a match for “33653-43722-1-RV.pdf” in “dir/where/files/are/storedjournals/2//articles/33653/”. Skipping this file.
WARNING: Unable to find a match for “33843-44335-1-PB.pdf” in “dir/where/files/are/storedjournals/2//articles/33843/”. Skipping this file.

[code: Installer Installer::convertSupplementaryFiles]

[code: Installer Installer::provideSupplementaryFilesForReview]

DB Error: Duplicate entry '2147483647-1' for key 'PRIMARY'

ojs2: DB Error: Duplicate entry '2147483647-1' for key 'PRIMARY'

The metrics table has the journal statistics. Download count etc. Of course you want to have those in the final upgrade, but emptying that table during tests will make it a lot faster.

The duplicate key errors are quite common. Check the tables that were processed during provideSupplementaryFilesForReview and search for that value. There is a duplicate value for that value somewhere.

That’s what I got, but thanks to the sql debug mode I can actually see what is duplicated :slight_smile:

(mysql): INSERT INTO submission_supplementary_files
(file_id, revision)
VALUES
(2147483647, 1)

-----



1062: Duplicate entry ‘2147483647-1’ for key ‘PRIMARY’

                                                    PKPSubmissionFileDAO.insertObject(Object:SupplementaryFile, /////journals/3//articles/34007/submission/review/34007-24--1-4-20100927.doc)% line  185, file: /var/www/projetos/buscalegis/revistas/lib/pkp/classes/file/SubmissionFileManager.inc.php

DB Error: Duplicate entry '2147483647-1' for key 'PRIMARY'

ojs2: DB Error: Duplicate entry '2147483647-1' for key 'PRIMARY'

I’ve started upgrading without looking much into the actual OJS installation. I’ve decied to track down the duplicated entry and I found that we have maybe 1800 SPAM users with spammy submissions. Is there any practical way to delete the users and their submissions? I will most likely have to go one by one to see who is good or not, but I would like to be able to delete all their submissions as they are most likely the ones causing issues (and I don’t want to keep them in the upgraded version)

see the faq section, there is an issue about that.

Nice, doing that right now. Will removal of the users remove the submissions or I need to clean up manually?

OJS handles that by merging accounts. So when you want to delete an account, you will actually merge it to another account. In our installation I have one account just for this purpose and I merge all spam accounts to that account. The merge will move all user actions (submissions etc.) to the other user and remove the merged account.

Does 2.X have a mapping table from roles_id to role names? I’ve beeing tryingto find everyone that has not published anything and is not a reviewer, but I don’t know the reviewer role ID
Edit:

Found it in the code directly
define(‘ROLE_ID_SITE_ADMIN’, 0x00000001);
define(‘ROLE_ID_JOURNAL_MANAGER’, 0x00000010);
define(‘ROLE_ID_EDITOR’, 0x00000100);
define(‘ROLE_ID_SECTION_EDITOR’, 0x00000200);
define(‘ROLE_ID_LAYOUT_EDITOR’, 0x00000300);
define(‘ROLE_ID_REVIEWER’, 0x00001000);
define(‘ROLE_ID_COPYEDITOR’, 0x00002000);
define(‘ROLE_ID_PROOFREADER’, 0x00003000);
define(‘ROLE_ID_AUTHOR’, 0x00010000);
define(‘ROLE_ID_READER’, 0x00100000);
define(‘ROLE_ID_SUBSCRIPTION_MANAGER’, 0x00200000);

see https://github.com/pkp/ojs/blob/master/plugins/importexport/users/sample.xml

Thanks. What do you do with the user that you merged all other with? I’m assuming I can delete that user and delete all bogus submissions as well, just not sure how

EDIT:
Just found your other topic @ajnyga
for i in {INSERTIDHERE..INSERIDHERE}; do php tools/deleteSubmissions.php $i; done

After a round of cleaning, I’m still getting duplicates with the same submission_file_id

[code: Installer Installer::provideSupplementaryFilesForReview]

DB Error: Duplicate entry '2147483647-1' for key 'PRIMARY'

ojs2: DB Error: Duplicate entry '2147483647-1' for key 'PRIMARY'

Searching on my database dump I can see 8 article_id with the same submission_file_id. Does that make sense? What’s the best aproach to clean duplicates like this?

There are also 27k articles with submission id = null. Will that be a problem?

There is no delete option in OJS. You can only merge users. You can of course delete users straight from the database and try to clean everything attached to them, but it is probably a lot of work. Individual submissions you can delete from the OJS UI.

where exactly are the duplicates? In what table?

do you mean that in the database table submissions (or articles) you have submissions with submission_id null?

I’m still not a 100% sure where they are. From the logs, the duplicate is when it tries to insert into submission_supplementary_files

(mysql): INSERT INTO submission_supplementary_files
(file_id, revision)
VALUES
(2147483647, 1)
1062: Duplicate entry ‘2147483647-1’ for key ‘PRIMARY’

I’m now doing a full sql dump with “mysqldump -p --skip-extended-insert | grep -i 2147483647” and finding EVERYTHING with that id. I don’t know why multiple articles in the 2.x database would have several entries in articles table with submission_file_id = 2147483647.

The nulls, yeah I see on the “articles” table on the 2.X database 27k entries with null in the submission_file_id.

I’m still struggling to understand all of what the upgrade from 2.X to 3.X does but I feel that the code is not lenient enough to bypass/skip some errors. I would prefer to have the system upgraded and have some duplicates removed or orphaned (and then manually fixed) then dying simply.

remember to check the revision number as well. Depending where the duplicates are, you could have a submission file with id “2147483647” and there could be several of these files in the database. However, it is only a problem if they also have the same revision number.