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

Lack of interest Fetching of Global Required Data in the dependency object

xf_phantom

Well-known member
#1
There's no way to preload the data, before init_dependencies, because the data are preloaded BEFORE the event system is inizialited.

It would be nice if we wouldn't need to fetch everything on event init_dependencies or put everything into simpleCache.
This way we would just need to add the entries to the config array and it would need only 1 query, instead of probably X queries.



What about something like my current implemention:
PHP:
//config.php:

$config['preloadData'] = array('systemMailCount','lastStats');


//XenForo_Dependencies_Abstract



   /**
    * Pre-loads globally required data for the system.
    */
   public function preLoadData()
   {
  $additionalData = array();
  if (XenForo_Application::get('config')->enableListeners)
  {
  $additionalData= XenForo_Application::getConfig()->preloadData->toArray();
  }

     $required = array_merge(
       array('options', 'languages', 'contentTypes', 'codeEventListeners', 'deferredRun', 'simpleCache', 'addOns', 'defaultStyleProperties'),
       $this->_dataPreLoadFromRegistry,
  $additionalData
     );

This could even be split up into additionalPublicData and additionalAdminData
 
Last edited: