[Solved] Upgrading to unexplained error in occurs in removeCancelled ReviewAssignments function

Hi again @asmecher (and @bozana if you are back)

When running the upgrade script I get this error:

[code: Installer Installer::removeCancelledReviewAssignments]
PHP Fatal error:  Call to a member function getContextId() on null in /var/www/server.fi/public_html/lib/pkp/classes/submission/reviewAssignment/ReviewAssignment.inc.php on line 517

I can not understand how this function ojs/Upgrade.inc.php at ojs-stable-3_1_0 · pkp/ojs · GitHub

Has to do with the code here pkp-lib/ReviewAssignment.inc.php at ojs-stable-3_1_0 · pkp/pkp-lib · GitHub

ok, so I found a way to debug this. I will post the result here.

I am betting my money on corrupted submissions table data. With larger and older installations like ours there always seems to be unexpected things…

… and it was exactly it.

The reviewAssignment (edit: got two of these cases, now solved) was linked to one of the removed submissions I mention here: [Solved] Upgrading 3.0.2 to 3.1.01 moveReviewerFiles fails - #2 by ajnyga

So the issue above is solved, but:

@asmecher do you have handy some sql commands that would search for:

  1. all submissions that are connected to journals that do not exist anymore
  2. and a way to remove review_assignments and other related data connected to those submissions

I am hoping to clean up the database for future updates and similar situations. And maybe such sql’s could even by added to the upgrade script to prevent situations like mine from happening?

Hi @ajnyga,

  1. SELECT s.submission_id FROM submissions s LEFT JOIN journals j ON (s.context_id = j.journal_id) WHERE j.journal_id IS NULL;
  2. You may be able to use tools/deleteSubmissions.php, but I’m not sure whether it makes assumptions about data integrity when running. For example, I suspect it’ll fail to delete submissions if the section the submission refers to doesn’t exist. You might try turning on the debug setting in config.inc.php and inspecting the SQL queries for joins that might miss data.

Alec Smecher
Public Knowledge Project Team

1 Like