• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Not a bug Error during 1.1.2 upgrade

JoshyPHP

Well-known member
#1
Quick heads-up: I've just upgraded XFMG from 1.1.0 to 1.1.2 after upgrading XenForo from 1.5.1 to 1.5.2, and I encountered an error during the deferred maintenance.

Code:
Error Info
    ErrorException: Fatal Error: Call to undefined method XenForo_Model_User::getUserIdsWithMediaInRange() - library/XenGallery/Deferred/UserMediaQuota.php:20
    Generated By: admin, 5 minutes ago

Stack Trace
    #0 [internal function]: XenForo_Application::handleFatalError()
    #1 {main}

Request State
    array(3) {
      ["url"] => string(48) "http://****/admin.php?tools/run-deferred"
      ["_GET"] => array(1) {
        ["tools/run-deferred"] => string(0) ""
      }
      ["_POST"] => array(3) {
        ["redirect"] => string(50) "http://****/admin.php?add-ons/#_XenGallery"
        ["execute"] => string(1) "1"
        ["_xfToken"] => string(8) "********"
      }
    }
I didn't have time to investigate so I just replaced the call to getUserIdsWithMediaInRange() with an empty array to finish the upgrade. As far as I'm concerned, it fixed that issue but it may affect other users.

This was on PHP 5.6.

Edit: could it be that line 18 instantiates the wrong class? It says XenForo_Model_User and it looks like it should be XenGallery_Model_User.
 

Chris D

XenForo developer
Staff member
#2
The only way this would happen is if there's files missing, or if you're attempting to upgrade while the add-on is disabled. For the most part, upgrading add-ons while they are disabled should work fine, though in this particular case there is some code we run which does rely on the add-on being enabled.

My recommended course of action is to enable the add-on, upgrade it again, and run the User Media Quota rebuild on the Gallery Rebuilds page.
 

JoshyPHP

Well-known member
#3
The add-on was disabled at the time I upgraded it. I enabled it before upgrading again and I didn't get the error so I guess you can mark this one as fixed.
 
#4
Thank you for your reply @Chris D ! I think this is something that should be addressed, addons shouldn't have any problem being upgraded as deactivated because it forces admins to reactive an addon that isn't.
 

Chris D

XenForo developer
Staff member
#5
Incidentally, this issue is resolved in the next release - it uses a method in the XF user model therefore there are no dependencies on the add-on being enabled when the upgrade takes place.