Having a Fatal Error while migrating User Roles from OJS 2.4 to 3.0.2

The error happens while migrating the User Roles using the tools/upgrade.php script.

[pre-install]
[load: upgrade.xml]
[version: 3.0.2.0]

[code: Installer Installer::syncSeriesAssocType]
[data: dbscripts/xml/upgrade/2.4.0_preupdate_usageStatistics.xml (skipped)]
[data: dbscripts/xml/upgrade/2.4.0_preupdate_usageStatistics2.xml]
[data: dbscripts/xml/upgrade/3.0.0_preupdate.xml]
[data: dbscripts/xml/upgrade/3.0.0_adaptTimedViews.xml (skipped)]
[data: dbscripts/xml/upgrade/3.0.0_adaptReferrals.xml]
[data: dbscripts/xml/upgrade/3.0.0_adaptBooksForReview.xml]
[data: dbscripts/xml/upgrade/remove_timed_views_bots.xml (skipped)]

[code: Installer Installer::migrateCounterPluginUsageStatistics (skipped)]

[code: Installer Installer::migrateTimedViewsUsageStatistics (skipped)]

[code: Installer Installer::migrateDefaultUsageStatistics (skipped)]
[data: dbscripts/xml/upgrade/2.4.0_postUsageStatsMigration.xml (skipped)]
[data: dbscripts/xml/upgrade/2.4.0_postUsageStatsMigration2.xml]
[data: dbscripts/xml/upgrade/2.4.0_postCounterMigration.xml (skipped)]
[data: dbscripts/xml/upgrade/2.4.0_postTimedViewsMigration.xml (skipped)]
[data: dbscripts/xml/upgrade/3.0.0_preupdate_commentsToEditor.xml]
[schema: lib/pkp/xml/schema/common.xml]
[schema: lib/pkp/xml/schema/log.xml]
[schema: lib/pkp/xml/schema/announcements.xml]
[schema: lib/pkp/xml/schema/scheduledTasks.xml]
[schema: lib/pkp/xml/schema/temporaryFiles.xml]
[schema: lib/pkp/xml/schema/metadata.xml]
[schema: lib/pkp/xml/schema/reviews.xml]
[schema: lib/pkp/xml/schema/reviewForms.xml]
[schema: lib/pkp/xml/schema/controlledVocab.xml]
[schema: lib/pkp/xml/schema/submissions.xml]
[schema: lib/pkp/xml/schema/submissionFiles.xml]
[schema: lib/pkp/xml/schema/notes.xml]
[schema: lib/pkp/xml/schema/views.xml]
[schema: lib/pkp/xml/schema/genres.xml]
[schema: lib/pkp/xml/schema/gifts.xml]
[schema: lib/pkp/xml/schema/mutex.xml]
[schema: lib/pkp/xml/schema/tombstone.xml]
[schema: lib/pkp/xml/schema/rolesAndUserGroups.xml]
[schema: lib/pkp/xml/schema/metrics.xml]
[schema: lib/pkp/xml/schema/views.xml]
[schema: lib/pkp/xml/schema/libraryFiles.xml]
[schema: dbscripts/xml/ojs_schema.xml]
[data: dbscripts/xml/indexes.xml]
[data: dbscripts/xml/upgrade/3.0.0_change_assoc_type.xml]
[data: dbscripts/xml/upgrade/3.0.0_change_assoc_type_metrics.xml]
[data: dbscripts/xml/upgrade/3.0.0_settings.xml]

[code: Installer Installer::migrateArticleMetadata]
[data: dbscripts/xml/upgrade/3.0.0_update.xml]

[code: Installer Installer::clearDataCache]

[code: Installer Installer::migrateUserRoles]
PHP Notice: Use of undefined constant ROLE_ID_SUBSCRIPTION_MANAGER - assumed ‘ROLE_ID_SUBSCRIPTION_MANAGER’ in /var/www/submission_scielo_br/ojs/classes/install/Upgrade.inc.php on line 239

Notice: Use of undefined constant ROLE_ID_SUBSCRIPTION_MANAGER - assumed ‘ROLE_ID_SUBSCRIPTION_MANAGER’ in /var/www/submission_scielo_br/ojs/classes/install/Upgrade.inc.php on line 239
PHP Notice: Use of undefined constant ROLE_ID_SUBSCRIPTION_MANAGER - assumed ‘ROLE_ID_SUBSCRIPTION_MANAGER’ in /var/www/submission_scielo_br/ojs/classes/install/Upgrade.inc.php on line 240

Notice: Use of undefined constant ROLE_ID_SUBSCRIPTION_MANAGER - assumed ‘ROLE_ID_SUBSCRIPTION_MANAGER’ in /var/www/submission_scielo_br/ojs/classes/install/Upgrade.inc.php on line 240
PHP Notice: Use of undefined constant ROLE_ID_SECTION_EDITOR - assumed ‘ROLE_ID_SECTION_EDITOR’ in /var/www/submission_scielo_br/ojs/classes/install/Upgrade.inc.php on line 305

Notice: Use of undefined constant ROLE_ID_SECTION_EDITOR - assumed ‘ROLE_ID_SECTION_EDITOR’ in /var/www/submission_scielo_br/ojs/classes/install/Upgrade.inc.php on line 305
PHP Notice: Use of undefined constant ROLE_ID_SUBSCRIPTION_MANAGER - assumed ‘ROLE_ID_SUBSCRIPTION_MANAGER’ in /var/www/submission_scielo_br/ojs/classes/install/Upgrade.inc.php on line 239

Notice: Use of undefined constant ROLE_ID_SUBSCRIPTION_MANAGER - assumed ‘ROLE_ID_SUBSCRIPTION_MANAGER’ in /var/www/submission_scielo_br/ojs/classes/install/Upgrade.inc.php on line 239
PHP Notice: Use of undefined constant ROLE_ID_SUBSCRIPTION_MANAGER - assumed ‘ROLE_ID_SUBSCRIPTION_MANAGER’ in /var/www/submission_scielo_br/ojs/classes/install/Upgrade.inc.php on line 240

Notice: Use of undefined constant ROLE_ID_SUBSCRIPTION_MANAGER - assumed ‘ROLE_ID_SUBSCRIPTION_MANAGER’ in /var/www/submission_scielo_br/ojs/classes/install/Upgrade.inc.php on line 240
PHP Notice: Use of undefined constant ROLE_ID_SECTION_EDITOR - assumed ‘ROLE_ID_SECTION_EDITOR’ in /var/www/submission_scielo_br/ojs/classes/install/Upgrade.inc.php on line 305

Notice: Use of undefined constant ROLE_ID_SECTION_EDITOR - assumed ‘ROLE_ID_SECTION_EDITOR’ in /var/www/submission_scielo_br/ojs/classes/install/Upgrade.inc.php on line 305
PHP Fatal error: Call to a member function getId() on a non-object in /var/www/submission_scielo_br/ojs/classes/install/Upgrade.inc.php on line 309

Fatal error: Call to a member function getId() on a non-object in /var/www/submission_scielo_br/ojs/classes/install/Upgrade.inc.php on line 309

Hi @fabiobatalha,

Just checking – are you using OJS 3.0.2, or the master branch downloaded e.g. from github?

Regards,
Alec Smecher
Public Knowledge Project Team

Hi @asmecher

Yes I’m using the OJS 3.0.2 from github.

$ git branch -vv
master 121b408 [origin/master] Submodule update
ojs-3_0_0-0 a253def Final commits for 3.0
ojs-3_0_1-0 deec02a Enable minification for stable branch

  • ojs-3_0_2-0 3f4dee9 Enable minification for stable releases

Hi @fabiobatalha,

Do you have the same branch open in the lib/pkp subdirectory?

Regards,
Alec Smecher
Public Knowledge Project Team

Now I have, It was point to master.

Hi @fabiobatalha,

OK, great – let me know if that doesn’t resolve the issue.

Regards,
Alec Smecher
Public Knowledge Project Team

Hey @asmecher and @fabiobatalha,

I had exactly the same problem!

I’ve found getting the git release branch with the submodules and external libraries quite challenging to get working to be honest. I resorted to just downloading the full package and now the upgrade worked!

Clearly I need a lesson in git :stuck_out_tongue:

Hi @ianthe,

Glad to hear you got it working. Git has a heck of a learning curve but it’s useful knowledge if you have the time to invest!

Regards,
Alec Smecher
Public Knowledge Project Team