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

Lack of Interest New Dependency for deferred

Discussion in 'Closed Suggestions' started by xf_phantom, Jul 16, 2013.

  1. xf_phantom

    xf_phantom Well-Known Member

    Wouldn't it be worth to create a own dependencies object for the deferred.php file?

    I'm curios because 2/3(or even all?) of the preloaded data and actions from the public dependency won't be needed and won' tneed to be handled..
    PHP:
    protected $_dataPreLoadFromRegistry = array(
         
    'routesPublic''routeFiltersIn''routeFiltersOut''nodeTypes',
         
    'bannedIps''discouragedIps',
         
    'styles''displayStyles''userBanners''smilies''bbCode''threadPrefixes',
         
    'trophyUserTitles''reportCounts''moderationCounts''userModerationCounts',
         
    'notices''userFieldsInfo'
       
    );

    protected function 
    _handleCustomPreloadedData(array &$data)
       {
         if (!
    is_array($data['routesPublic']))
         {
           
    $data['routesPublic'] = XenForo_Model::create('XenForo_Model_RoutePrefix')->rebuildRoutePrefixTypeCache('public');
         }
         
    XenForo_Link::setHandlerInfoForGroup('public'$data['routesPublic']);

         if (!
    is_array($data['routeFiltersIn']) || !is_array($data['routeFiltersOut']))
         {
           
    $filterCache XenForo_Model::create('XenForo_Model_RouteFilter')->rebuildRouteFilterCache();
           
    $data['routeFiltersIn'] = $filterCache['in'];
           
    $data['routeFiltersOut'] = $filterCache['out'];
         }
         
    XenForo_Application::set('routeFiltersIn'$data['routeFiltersIn']);
         
    XenForo_Application::set('routeFiltersOut'$data['routeFiltersOut']);

         if (!
    is_array($data['bannedIps']))
         {
           
    $data['bannedIps'] = XenForo_Model::create('XenForo_Model_Banning')->rebuildBannedIpCache();
         }
         
    XenForo_Application::set('bannedIps'$data['bannedIps']);

         if (!
    is_array($data['discouragedIps']))
         {
           
    $data['discouragedIps'] = XenForo_Model::create('XenForo_Model_Banning')->rebuildDiscouragedIpCache();
         }
         
    XenForo_Application::set('discouragedIps'$data['discouragedIps']);

         if (!
    is_array($data['styles']))
         {
           
    $data['styles'] = XenForo_Model::create('XenForo_Model_Style')->rebuildStyleCache();
         }
         
    XenForo_Application::set('styles'$data['styles']);

         if (!
    is_array($data['nodeTypes']))
         {
           
    $data['nodeTypes'] = XenForo_Model::create('XenForo_Model_Node')->rebuildNodeTypeCache();
         }
         
    XenForo_Application::set('nodeTypes'$data['nodeTypes']);

         if (!
    is_array($data['smilies']))
         {
           
    $data['smilies'] = XenForo_Model::create('XenForo_Model_Smilie')->rebuildSmilieCache();
         }
         
    XenForo_Application::set('smilies'$data['smilies']);

         if (!
    is_array($data['bbCode']))
         {
           
    $data['bbCode'] = XenForo_Model::create('XenForo_Model_BbCode')->rebuildBbCodeCache();
         }
         
    XenForo_Application::set('bbCode'$data['bbCode']);

         if (!
    is_array($data['threadPrefixes']))
         {
           
    $data['threadPrefixes'] = XenForo_Model::create('XenForo_Model_ThreadPrefix')->rebuildPrefixCache();
         }
         
    XenForo_Application::set('threadPrefixes'$data['threadPrefixes']);
         
    XenForo_Template_Helper_Core::setThreadPrefixes($data['threadPrefixes']);

         if (!
    is_array($data['displayStyles']))
         {
           
    $data['displayStyles'] = XenForo_Model::create('XenForo_Model_UserGroup')->rebuildDisplayStyleCache();
         }
         
    XenForo_Application::set('displayStyles'$data['displayStyles']);
         
    XenForo_Template_Helper_Core::setDisplayStyles($data['displayStyles']);

         if (!
    is_array($data['userBanners']))
         {
           
    $data['userBanners'] = XenForo_Model::create('XenForo_Model_UserGroup')->rebuildUserBannerCache();
         }
         
    XenForo_Application::set('userBanners'$data['userBanners']);
         
    XenForo_Template_Helper_Core::setUserBanners($data['userBanners']);

         if (!
    is_array($data['trophyUserTitles']))
         {
           
    $data['trophyUserTitles'] = XenForo_Model::create('XenForo_Model_Trophy')->rebuildTrophyUserTitleCache();
         }
         
    XenForo_Application::set('trophyUserTitles'$data['trophyUserTitles']);
         
    XenForo_Template_Helper_Core::setUserTitles($data['trophyUserTitles']);

         if (!
    is_array($data['notices']))
         {
           
    $data['notices'] = XenForo_Model::create('XenForo_Model_Notice')->rebuildNoticeCache();
         }
         
    XenForo_Application::set('notices'$data['notices']);

         if (!
    is_array($data['userFieldsInfo']))
         {
           
    $data['userFieldsInfo'] = XenForo_Model::create('XenForo_Model_UserField')->rebuildUserFieldCache();
         }
         
    XenForo_Application::set('userFieldsInfo'$data['userFieldsInfo']);

         if (
    is_array($data['reportCounts']))
         {
           
    XenForo_Application::set('reportCounts'$data['reportCounts']);
         }
         if (
    is_array($data['moderationCounts']))
         {
           
    XenForo_Application::set('moderationCounts'$data['moderationCounts']);
         }
         if (
    is_array($data['userModerationCounts']))
         {
           
    XenForo_Application::set('userModerationCounts'$data['userModerationCounts']);
         }
       }

    In the past i've noticed that this can bring some real benefits to use my own "light" dependency object (e.g. i'm using it for my cli application and for the phpunit bootstrap process.
     
    Last edited: Jul 16, 2013

Share This Page