Fixed Disabling resource manager causing errors

Mr Lucky

Well-known member
I have disable resource manager, and getting some occasional errors:

is this because the attached threads are still there (although no longer have a link to the resource)

Code:
    nvalidArgumentException: Template public:alert_user_resource_move error: Container key 'prefixes.resource' was not found src/XF/Container.php:43

    Generated by: David Roach Aug 29, 2020 at 11:30 AM

Stack trace

#0 src/XF/App.php(3040): XF\Container->offsetGet('prefixes.resour...')
#1 src/XF/Template/Templater.php(2999): XF\App->container('prefixes.resour...')
#2 [internal function]: XF\Template\Templater->fnPrefix(Object(SV\StandardLib\XF\Template\Templater), true, 'resource', 1)
#3 src/XF/Template/Templater.php(936): call_user_func_array(Array, Array)
#4 internal_data/code_cache/templates/l1/s83/public/alert_user_resource_move.php(6): XF\Template\Templater->func('prefix', Array, true)
#5 src/XF/Template/Templater.php(1315): XF\Template\Templater->{closure}(Object(SV\StandardLib\XF\Template\Templater), Array)
#6 src/XF/Alert/AbstractHandler.php(80): XF\Template\Templater->renderTemplate('alert_user_reso...', Array)
#7 src/XF/Entity/UserAlert.php(69): XF\Alert\AbstractHandler->render(Object(XF\Entity\UserAlert))
#8 [internal function]: XF\Entity\UserAlert->render()
#9 src/XF/Template/Templater.php(999): call_user_func_array(Array, Array)
#10 internal_data/code_cache/templates/l1/s83/public/alert_macros.php(42): XF\Template\Templater->method(Object(XF\Entity\UserAlert), 'render', Array)
#11 src/XF/Template/Templater.php(701): XF\Template\Templater->{closure}(Object(SV\StandardLib\XF\Template\Templater), Array, Array)
#12 internal_data/code_cache/templates/l1/s83/public/account_alerts_popup.php(16): XF\Template\Templater->callMacro('alert_macros', 'row', Array, Array)
#13 src/XF/Template/Templater.php(1315): XF\Template\Templater->{closure}(Object(SV\StandardLib\XF\Template\Templater), Array)
#14 src/XF/Template/Template.php(24): XF\Template\Templater->renderTemplate('account_alerts_...', Array)
#15 src/XF/Mvc/Renderer/Json.php(84): XF\Template\Template->render()
#16 src/XF/Mvc/Renderer/Json.php(68): XF\Mvc\Renderer\Json->renderHtmlFallback('XF:Account\\Aler...', 'public:account_...', Array)
#17 src/XF/Mvc/Dispatcher.php(458): XF\Mvc\Renderer\Json->renderView('XF:Account\\Aler...', 'public:account_...', Array)
#18 src/XF/Mvc/Dispatcher.php(440): XF\Mvc\Dispatcher->renderView(Object(XF\Mvc\Renderer\Json), Object(XF\Mvc\Reply\View))
#19 src/XF/Mvc/Dispatcher.php(400): XF\Mvc\Dispatcher->renderReply(Object(XF\Mvc\Renderer\Json), Object(XF\Mvc\Reply\View))
#20 src/XF/Mvc/Dispatcher.php(58): XF\Mvc\Dispatcher->render(Object(XF\Mvc\Reply\View), 'json')
#21 src/XF/App.php(2190): XF\Mvc\Dispatcher->run()
#22 src/XF.php(391): XF\App->run()
#23 index.php(20): XF::runApp('XF\\Pub\\App')
#24 {main}

Request state

array(4) {
  ["url"] => string(154) "/account/alerts-popup?_xfRequestUri=%2Fforums%2F&_xfWithData=1&_xfToken=1598697053%2C5773e45395a7fb501b3a1db81050551d&_xfResponseType=json&_=1598697053682"
  ["referrer"] => string(33) "https://cafesaxophone.com/forums/"
  ["_GET"] => array(5) {
    ["_xfRequestUri"] => string(8) "/forums/"
    ["_xfWithData"] => string(1) "1"
    ["_xfToken"] => string(43) "1598697053,5773e45395a7fb501b3a1db81050551d"
    ["_xfResponseType"] => string(4) "json"
    ["_"] => string(13) "1598697053682"
  }
  ["_POST"] => array(0) {
  }
}
 

Mr Lucky

Well-known member
Ah yes - src/XF/Template/Templater.php(1315): XF\Template\Templater->{closure}(Object(SV\StandardLib\XF\Template\Templater), Array)
 

Xon

Well-known member
Just because an add-on shows up as extending a class doesn't mean it is involved. My add-on isn't doing anything related to prefixes.

This is actually an XFRM bug where the alert alert_user_resource_move isn't being associated with the XFRM add-on (and thus is still rendered when the add-on is disabled), and arguably an XF bug where fnPrefix isn't validating the prefix type exists.
 

Mike

XenForo developer
Staff member
We have the ability (somewhat recently in the grand scheme of things) to force associate alerts with an add-on for scenarios like this so I'll move this to bugs.

In the interim, the errors can generally be ignored.
 

Mr Lucky

Well-known member
Thanks MIke. I presumed these would gradually subside as members stopped getting alerts for moved resources. (I had moved them to a non public category prior while organising prior to disabling the resource manager, however I got one this morning:

In case it is useful for you

This was generated at 10:04 which is the same time that user created a reaction in the thread. I got the alert for that reaction at 10:04 as it was for one of my posts. The user did not get any alerts around that time so seems to have caused by me getting the alert.


Code:
    nvalidArgumentException: Template public:alert_user_resource_move error: Container key 'prefixes.resource' was not found src/XF/Container.php:43

    Generated by: aldevis Sep 1, 2020 at 10:04 AM

Stack trace

#0 src/XF/App.php(3040): XF\Container->offsetGet('prefixes.resour...')
#1 src/XF/Template/Templater.php(2999): XF\App->container('prefixes.resour...')
#2 [internal function]: XF\Template\Templater->fnPrefix(Object(SV\StandardLib\XF\Template\Templater), true, 'resource', 12)
#3 src/XF/Template/Templater.php(936): call_user_func_array(Array, Array)
#4 internal_data/code_cache/templates/l1/s83/public/alert_user_resource_move.php(6): XF\Template\Templater->func('prefix', Array, true)
#5 src/XF/Template/Templater.php(1315): XF\Template\Templater->{closure}(Object(SV\StandardLib\XF\Template\Templater), Array)
#6 src/XF/Alert/AbstractHandler.php(80): XF\Template\Templater->renderTemplate('alert_user_reso...', Array)
#7 src/XF/Entity/UserAlert.php(69): XF\Alert\AbstractHandler->render(Object(XF\Entity\UserAlert))
#8 [internal function]: XF\Entity\UserAlert->render()
#9 src/XF/Template/Templater.php(999): call_user_func_array(Array, Array)
#10 internal_data/code_cache/templates/l1/s83/public/alert_macros.php(42): XF\Template\Templater->method(Object(XF\Entity\UserAlert), 'render', Array)
#11 src/XF/Template/Templater.php(701): XF\Template\Templater->{closure}(Object(SV\StandardLib\XF\Template\Templater), Array, Array)
#12 internal_data/code_cache/templates/l1/s83/public/account_alerts.php(26): XF\Template\Templater->callMacro('alert_macros', 'row', Array, Array)
#13 src/XF/Template/Templater.php(1315): XF\Template\Templater->{closure}(Object(SV\StandardLib\XF\Template\Templater), Array)
#14 src/XF/Template/Template.php(24): XF\Template\Templater->renderTemplate('account_alerts', Array)
#15 src/XF/Mvc/Renderer/Html.php(48): XF\Template\Template->render()
#16 src/XF/Mvc/Dispatcher.php(458): XF\Mvc\Renderer\Html->renderView('XF:Account\\Aler...', 'public:account_...', Array)
#17 src/XF/Mvc/Dispatcher.php(440): XF\Mvc\Dispatcher->renderView(Object(XF\Mvc\Renderer\Html), Object(XF\Mvc\Reply\View))
#18 src/XF/Mvc/Dispatcher.php(400): XF\Mvc\Dispatcher->renderReply(Object(XF\Mvc\Renderer\Html), Object(XF\Mvc\Reply\View))
#19 src/XF/Mvc/Dispatcher.php(58): XF\Mvc\Dispatcher->render(Object(XF\Mvc\Reply\View), 'html')
#20 src/XF/App.php(2190): XF\Mvc\Dispatcher->run()
#21 src/XF.php(391): XF\App->run()
#22 index.php(20): XF::runApp('XF\\Pub\\App')
#23 {main}

Request state

array(4) {
  ["url"] => string(15) "/account/alerts"
  ["referrer"] => string(48) "https://cafesaxophone.com/threads/saxseat.29686/"
  ["_GET"] => array(0) {
  }
  ["_POST"] => array(0) {
  }
}
 

Mike

XenForo developer
Staff member
That was triggered by the user viewing their alerts page (/account/alerts), so roughly it could happen for a little while, while the alert is still active on that page.
 

Xon

Well-known member
This SQL should apply the attribute so these alerts aren't loaded when they view the alerts and XFRM is disabled;
SQL:
update `xf_user_alert`
set `depends_on_addon_id`= 'XFRM'
where `content_type` = 'user' and `action` = 'resource_move'
 

XF Bug Bot

XenForo bug fixer bot
Staff member
Thank you for reporting this issue, it has now been resolved. We are aiming to include any changes that have been made in a future XFRM release (2.2.0 Beta 5).

Change log:
Correctly set `depends_on_addon_id` for XFRM moderator alerts to ensure they're not shown when the add-on is disabled
There may be a delay before changes are rolled out to the XenForo Community.
 
Top