Failed upgrade from 2.3.6 -> 2.4.8.5 -> 3.1.1

I have a database upgrade from 2 -> 3 that is failing. :frowning: Not sure what I should do next.

  • Application Version
    During upgrade from 2.4.8.5 -> 3.1.1.4
  • Description of issue
    Upgrade fails. File restructuring seems to have failed. (?)
  • Steps you took leading up to the issue
    • Used php 5.6
    • Upgraded from 2.3.6 -> 2.4.8.5
    • Upgraded to php 7.3
    • Replaced code base w/ 3.1.1.4 (according to tools/upgrade check) (git branch ojs-stable-3_1_1)
    • Replaced config.inc.php for correct settings
    • Installed composer items
    • Installed npm items
    • ran the upgrade CLI script.
  • What you tried to resolve the issue
    Looked for missing files… they do seem to be ‘missing’ … should they be? If not, how did they go missing? If they cannot be replaced with true files, should they be replaced with touch/empty files? Removed from the database? What’s the best course of action?
  • Screenshots
    Nope. Not sure they’d actually help this issue. If someone can come up with something to screenshot… I’d be happy to do it.
  • Error log messages if applicable

Error Log:

PHP Warning:  copy(files/journals/51//articles/60567/attachment/60567-169-63975-1-13-20171219.doc): failed to open stream: No such file or directory in /var/www/html/lib/pkp/classes/file/FileManager.inc.php on line 159
PHP Fatal error:  Uncaught Error: Call to a member function getStatus() on null in /var/www/html/classes/install/Upgrade.inc.php:1366
Stack trace:
#0 /var/www/html/lib/pkp/classes/install/Installer.inc.php(421): Upgrade->convertSupplementaryFiles(Object(Upgrade), Array)
#1 /var/www/html/lib/pkp/classes/install/Installer.inc.php(265): Installer->executeAction(Array)
#2 /var/www/html/lib/pkp/classes/install/Installer.inc.php(186): Installer->executeInstaller()
#3 /var/www/html/lib/pkp/classes/cliTool/UpgradeTool.inc.php(88): Installer->execute()
#4 /var/www/html/lib/pkp/classes/cliTool/UpgradeTool.inc.php(64): UpgradeTool->upgrade()
#5 /var/www/html/tools/upgrade.php(34): UpgradeTool->execute()
#6 {main}
  thrown in /var/www/html/classes/install/Upgrade.inc.php on line 1366

Any thoughts would be greatly appreciated

Hi @AndrewGearhart,

That error message looks like a database inconsistency to me. Check for articles that have a section_id that doesn’t refer to a valid entry in sections.

Regards,
Alec Smecher
Public Knowledge Project Team

@asmecher, so… I have some articles without sections… All of them seem to have been rejected and archived. looks like we may not be able to actually add the sections due to this… so… does that force me into adding the section via the database? How do I know what section to assign?

Is there a list somewhere of tasks to do to cleanup a database before going through the entire process of doing a database migration and/or an OJS migration? If not, I’m starting to develop one… like truncating the search index, looking for and/or repairing the article sections (jury is still out on the exact way to handle this … any other thoughts would be fantastic.

Hi @AndrewGearhart,

Personally, I’d probably find it quickest to make the change in the database, especially if there was a considerable number of articles without sections. First you need to find which section_id you want to assign – you can do that by querying e.g.:

SELECT j.path, s.section_id, ss.setting_value FROM section_settings ss, sections s, journals j WHERE setting_name='title' AND ss.section_id=s.section_id AND s.journal_id=j.journal_id;

This will generate a list of section titles and their corresponding journal paths and section IDs.

Then you can generate a list of all articles that don’t have assigned sections:

SELECT j.path, a.article_id, a_s.setting_value FROM article_settings a_s, journals j, articles a LEFT JOIN sections s ON (a.section_id = s.section_id) WHERE a_s.article_id = a.article_id AND a.journal_id = j.journal_id AND s.section_id IS NULL AND a_s.setting_name='title';

Then you can go through and correct entries in the second list by looking up what section they should be in for the first list:

UPDATE articles SET section_id = 123 WHERE article_id = 456;

Make sure you don’t accidentally put an article into a section that belongs to a different journal – i.e. the path column must be the same for the article and the section you choose to put it into.

We don’t have a formal list of checks and fixes to make during upgrade, but there are some notes accumulated here:

Regards,
Alec Smecher
Public Knowledge Project Team

This did resolve the issue associated with the article sections. We adjusted the original entries in OJS 2 and the problem was resolved. Will be posting a new issue that I cannot seem to track down now in a new thread.