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

Not a bug XenForo_ControllerPublic_Page::actionIndex()

Fuhrmann

Well-known member
#1
XenForo_ControllerPublic_Page::actionIndex()

The $nodeModel in the line 13 is not used in the whole action:

PHP:
public function actionIndex()
    {
        $nodeName = $this->_input->filterSingle('node_name', XenForo_Input::STRING);
        $page = $this->_getPageOrError($nodeName);
 
        $this->_canonicalizeRequestUrl($page);
 
        $pageModel = $this->_getPageModel();
        $nodeModel = $this->_getNodeModel();
 
        if ($page['log_visits'])
        {
            $pageModel->logVisit($page, XenForo_Visitor::getInstance()->toArray(), XenForo_Application::$time);
 
            $page['view_count']++;
        }
 
        $nodeBreadCrumbs = $this->_getNodeModel()->getNodeBreadCrumbs($page, false);
 

Mike

XenForo developer
Staff member
#2
As there's no down side (and really, it just makes it easier in the future), not a bug. I wouldn't bother reporting things like this TBH.
 

Fuhrmann

Well-known member
#3
Ok, then! :)

This just dont make sense to me: why put the model into a variable and then a few lines after call to the same function instead of the var?
 

Jeremy

Well-known member
#5
Ok, then! :)

This just dont make sense to me: why put the model into a variable and then a few lines after call to the same function instead of the var?
Most of those functions call for a cached version, and if its not available, creates it and places it into the cache. So you actually only receive 1 instance (if I remember the code correctly).