[Solved] lib/pkp/tools/parseCitations.php in 3.3.0.4 throws an Exception

Running php lib/pkp/tools/parseCitations.php all

Throws the following Exception
PHP Fatal error: Uncaught Error: Call to a member function getConnection() on null in /[]/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Capsule/Manager.php:74
Stack trace:
#0 /[]/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Capsule/Manager.php(200): Illuminate\Database\Capsule\Manager::connection()
#1 /[]/lib/pkp/classes/db/DAO.inc.php(94): Illuminate\Database\Capsule\Manager::__callStatic()
#2 /[]/lib/pkp/classes/context/ContextDAO.inc.php(77): DAO->retrieveRange()
#3 /[]/lib/pkp/tools/parseCitations.php(56): ContextDAO->getAll()
#4 /[]/lib/pkp/tools/parseCitations.php(107): CitationsParsingTool->execute()
#5 {main}
thrown in /[]/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Capsule/Manager.php on line 74

Using the solution at Unable to upgrade 3.3.0.2: Call to a member function getConnection() on null · Issue #6703 · pkp/pkp-lib · GitHub solves the problem by adding
Application::get()->initializeDatabaseConnection(); in the constructor of lib/pkp/tools/parseCitations.php

This need to be added to the codebase in GitHub

Cheers
Nason

Hi @Nason_Bimbe,

The connection initialization should be taken care of here:

Is it possible that you were running the script with installed set to Off in config.inc.php?

Regards,
Alec Smecher
Public Knowledge Project Team

Hi @asmecher,
Just tested it again, you are correct I was running it with installed set to Off in config.inc.php. So I was running it after upgrading after resolving the issue described at Upgrade error: Duplicate entry 'xxx-yyy' for key 'citations_publication_seq' · Issue #5626 · pkp/pkp-lib · GitHub so ran it before reverting installed to On

Thanks
Nason

Hi @Nason_Bimbe,

Great, thanks for the follow-up!

Regards,
Alec Smecher
Public Knowledge Project Team