Fixed Error while upgrading to RC1 (CLI add-on command issue)

Sim

Well-known member
Affected version
2.0.0 RC1
Error while upgrading my dev server to XFMG 2.0.0 RC1

Bash:
$ xf xf:addon-upgrade XFMG
Upgrading XenForo Media Gallery from 2.0.0 Beta 3 to 2.0.0 Release Candidate 1...
Confirm upgrade? (y/n)y
Upgrading . . . . . .
Complete.

... {details removed}

Running clean up tasks...
Rebuilding... Albums (1)

PHP Fatal error:  Call to undefined method XF\Entity\User::rebuildMediaQuota() in /srv/www/xenforo2/src/addons/XFMG/Job/UserMediaQuota.php on line 58

Fatal error: Call to undefined method XF\Entity\User::rebuildMediaQuota() in /srv/www/xenforo2/src/addons/XFMG/Job/UserMediaQuota.php on line 58

I do note that I think I had upgraded the base XF to 2.0.0 Beta 5 and then to RC1, but the XFMG was still at Beta 3 when I attempted to upgrade it to RC1 - in case that has any bearing on things.
 
BTW, if you still haven't completed the upgrade, then just do it through the Admin CP. That should still work.
 
Yes, I just got a notification when I logged in to the admin area that there were rebuilds pending and it completed successfully.

However, I then went to add a new media comment to test out some functionality and received the following error: InvalidArgumentException: No news feed handler for 'xfmg_comment' in src/XF/Repository/NewsFeed.php at line 104

I'll post a new bug report about it (see: https://xenforo.com/community/threa...for-xfmg_comment-after-upgrade-to-rc1.136991/).
 
This should be fixed for RC2 now. It's roughly a disadvantage of the CLI-based add-on commands and thus requires a pretty big shift in how these are run internally.

Ultimately, this is caused by the fact that the listeners and class extensions that apply need to change over time. This is easy enough to do via the web as the upgrade steps, the rebuild and the post-upgrade actions all happen in fresh requests. In the CLI, they all happen in the same "request" and thus can lead to unpredictable behavior.

We now trigger fresh PHP "sub processes" for various parts of add-on related actions, to ensure that the listeners and class extensions are correct as of the current state. This should mean that when this post-upgrade job is triggered, the extensions and listeners reflect the active version of the add-on with the latest data in place.
 
Back
Top Bottom