pkp / pkp-lib

The library used by PKP's applications OJS, OMP and OPS, open source software for scholarly publishing.
https://pkp.sfu.ca
GNU General Public License v3.0
307 stars 447 forks source link

Upgrade from 3.0.2 to 3.3 can fail if submission files are missing #7643

Open jnugent opened 2 years ago

jnugent commented 2 years ago

Describe the bug During the upgrade from 3.0.2 to 3.3, Installer Installer::fixGenreIdInFileNames runs and this can fail with:

PHP Fatal error: Uncaught League\Flysystem\FileNotFoundException: File not found at path: journals/1/...... in /var/www/html/www-33/lib/pkp/lib/vendor/league/flysystem/src/Filesystem.php:390

This may or may not be a bug, but I know that there's been work done to make the upgrade process to 3.3 more robust and during original OJS 3.3 testing there was an bug filed when an issue's table of contents would error out if a file was missing. In a similar vein, ould this method skip files entirely if they are no longer present?

Steps to reproduce:

  1. Remove a valid file on disk from a 3.0.2 installation while keeping it in the database
  2. Attempt an upgrade to 3.3
jnugent commented 2 years ago

I'll also mention that this same block of code runs when upgrading from 3.0.2 to 3.2.1, and it does not generate fatal errors. Warnings galore, but it gets through.

NamitaBi commented 2 years ago

Guys fix it asap. I am unable to update because of it.

NamitaBi commented 2 years ago

@jnugent Which version of the 3.2.1? 3.2.1-1, 3.2.1-2, 3.2.1-3, 3.2.1-4 or the 3.2.1 itself?

I'll also mention that this same block of code runs when upgrading from 3.0.2 to 3.2.1, and it does not generate fatal errors. Warnings galore, but it gets through.

jnugent commented 2 years ago

@NamitaBi we always use the tip of the stable-3_2_1 Github branch to make sure we have all commits. There have been a number of improvements to the upgrade process since 3.2.1-4.

NamitaBi commented 2 years ago

@NamitaBi we always use the tip of the stable-3_2_1 Github branch to make sure we have all commits. There have been a number of improvements to the upgrade process since 3.2.1-4.

@jnugent You are saying in 3.2.1-4 this error doesn't happen and we wold be able to upgrade from 3.0.2 to 3.2.1-4. Right!?

jnugent commented 2 years ago

@NamitaBi I'm saying that when I upgraded from 3.0.2 to stable-3_2_1, it worked. You may have other issues that prevent the upgrade from working, but feel free to try that path way on a test installation and see.

jnugent commented 2 years ago

@NamitaBi also please understand that if you use the download package for 3.2.1-4, that's not the same thing as stable-3_2_1. It's important that you build a stable-3_2_1 installation using Git if you want to try this.

NamitaBi commented 2 years ago

@NamitaBi also please understand that if you use the download package for 3.2.1-4, that's not the same thing as stable-3_2_1. It's important that you build a stable-3_2_1 installation using Git if you want to try this.

@jnugent Got it. Trying in test environment and will post back here if it works for me too or not. Thanks for the quick replies.

mylootvault commented 1 year ago

@jnugent hey can you explain more about how to do "Remove a valid file on disk from a 3.0.2 installation while keeping it in the database", i am trying to upgrade my ojs from 3.02 - 3.1.2 okay no problem, then 3.2.1, and now to 3.3.0 i get this error [Sun Jul 30 20:53:42.684678 2023] [php7:error] [pid 13496:tid 1976] [client 127.0.0.1:62654] PHP Fatal error: Uncaught League\\Flysystem\\FileNotFoundException: File not found at path: journals/1/articles/60/submission/productionReady/60-1-162-1-11-20190228.do in D:\\xampp\\htdocs\\ojs3\\lib\\pkp\\lib\\vendor\\league\\flysystem\\src\\Filesystem.php:389\nStack trace:\n#0 D:\\xampp\\htdocs\\ojs3\\lib\\pkp\\lib\\vendor\\league\\flysystem\\src\\Filesystem.php(210): League\\Flysystem\\Filesystem->assertPresent('journals/1/arti...')\n#1 D:\\xampp\\htdocs\\ojs3\\classes\\install\\Upgrade.inc.php(664): League\\Flysystem\\Filesystem->rename('journals/1/arti...', 'journals/1/arti...')\n#2 D:\\xampp\\htdocs\\ojs3\\lib\\pkp\\classes\\install\\Installer.inc.php(445): Upgrade->fixGenreIdInFileNames(Object(Upgrade), Array)\n#3 D:\\xampp\\htdocs\\ojs3\\lib\\pkp\\classes\\install\\Installer.inc.php(252): Installer->executeAction(Array)\n#4 D:\\xampp\\htdocs\\ojs3\\lib\\pkp\\classes\\install\\Installer.inc.php(175): Installer->executeInstaller()\n#5 D:\\xampp\\htdocs\\ojs3\\lib\\pkp\\classes\\install\\form\\UpgradeForm.inc.php(43): Installer->execute()\n#6 D:\\xampp\\htdocs\\ojs3\\lib\\pkp\\pages\\install\\InstallHa in D:\\xampp\\htdocs\\ojs3\\lib\\pkp\\lib\\vendor\\league\\flysystem\\src\\Filesystem.php on line 389, referer: http://localhost/ojs3/index.php/index/install/upgrade