Call to a member function getFileId() on null upgrading to 3.1.2

Hello,

I’ve been trying to upgrade our OJS from 2.4.7-1 to 3 for some time now, and every time I get some error that stops the upgrade.

Some weeks ago I was able to finish the upgrade going from 2.4.7-1 to 3.0.2 and then to 3.1.1-4, because trying to go from 2.4.7-1 to 3.1.1-4 in one step gave me an “Call to a member function getFileId() on null” error with no more information.

Now I’m trying again, in a new server with PHP 7 and OJS 3.1.2. This time the error is a bit different:

\[code: Installer Installer::provideSupplementaryFilesForReview]
PHP Warning:  copy(/home/ojs/rc-3.1.2_files/journals/5//articles/2037/submission/2037-48-8681-1-2-20081201.jpg): failed to open stream: No such file or directory in /home/ojs/rc-3.1.2/lib/pkp/classes/file/FileManager.inc.php on line 162
PHP Fatal error:  Uncaught Error: Call to a member function getFileId() on null in /home/ojs/rc-3.1.2/lib/pkp/classes/file/SubmissionFileManager.inc.php:184
Stack trace:
#0 /home/ojs/rc-3.1.2/classes/install/Upgrade.inc.php(1476): SubmissionFileManager->copyFileToFileStage('8681', 1, 4, NULL, true)
#1 /home/ojs/rc-3.1.2/lib/pkp/classes/install/Installer.inc.php(421): Upgrade->provideSupplementaryFilesForReview(Object(Upgrade), Array)
#2 /home/ojs/rc-3.1.2/lib/pkp/classes/install/Installer.inc.php(265): Installer->executeAction(Array)
#3 /home/ojs/rc-3.1.2/lib/pkp/classes/install/Installer.inc.php(186): Installer->executeInstaller()
#4 /home/ojs/rc-3.1.2/lib/pkp/classes/cliTool/UpgradeTool.inc.php(88): Installer->execute()
#5 /home/ojs/rc-3.1.2/lib/pkp/classes/cliTool/UpgradeTool.inc.php(64): UpgradeTool->upgrade()
#6 /home/ojs/rc-3.1.2/tools/upgrade.php(34): UpgradeTool->execute()
#7 {main}
  thrown in /home/ojs/rc-3.1.2/lib/pkp/classes/file/SubmissionFileManager.inc.php on line 184

Does anybody know what may be wrong?

Regards,

Oberdan

Hi @Oberdan

If you’re running 2.4.7, can you try going to 2.4.8 first and let us know how that goes? Then you can go from 2.4.8 to 3. I’d probably go to 3.1.1-4 first, and then from 3.1.1-4 to 3.1.2. That last one is straight forward if you’ve got a clean installation.

Cheers,
Jason

Hello @jnugent,

From my previous tests I know that going from 2.4.7 to 3.0.2 and then to 3.1.1-4 works. I was just trying to avoid a 2 step upgrade, but it seems to be the best solution.

Regards,

Oberdan

1 Like

Hello @jnugent,

There where some references in article_supplementary_files and article_files to files that no longer exist. Using the file_id mentioned in the error message it was easy to find them. Removing the missing files from the submissions solved the problem.

Regards,

Oberdan

1 Like

Could anybody give a clue… given file_id , how to remove the missing files? It is direct access to database? or just remove the files on the folder?

thanking you

Hi @gudangpaper

The file_id corresponds to various columns in a few tables in the database, usually article_files and article_supplementary_files.

Regards
Jason

hi @Oberdan I got the same error can you tell how you solved it please

I was migrating from ojs 2 to ojs 3 when this error occur previously I made the migration and works but now that i am doing again i got this error

Hi @Carlos_Alberto_Rivad,

I believe this generally happened when a file was missing in the files_dir, though the error message is pretty cryptic. I believe the error is now clearer since https://github.com/pkp/pkp-lib/issues/5689, which is included in the latest OJS 3.2.x release rather than e.g. 3.1.2. You might consider upgrading to a newer release; we’re currently planning on releasing OJS 3.2.1 this Friday, incidentally.

Regards,
Alec Smecher
Public Knowledge Project Team