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

Fixed Bug in library\XenForo\Model\DataRegistry.php

Discussion in 'Resolved Bug Reports' started by Yoskaldyr, Nov 4, 2010.

  1. Yoskaldyr

    Yoskaldyr Well-Known Member

    I've tried to use file-cache and after enabling it in the config.php I've found a problem - forum script recreates cache after every request. So I went to look where the problem is, and (surprise, surprise =)) I've found it in the XenForo_Model_DataRegistry class in the method getMulti - there is a unset function call, which should delete an array item, but there is wrong key used to do this. So there is a quickfix:
    find
    PHP:
            $cache $this->_getCache(true);
            
    $dbItemNames $itemNames;
            
    $data = array();

            foreach (
    $itemNames AS $itemName)
            {
                
    $cacheData = ($cache $cache->load($this->_getCacheEntryName($itemName)) : false);
                if (
    $cacheData !== false)
                {
                    
    $data[$itemName] = $cacheData;
                    unset(
    $dbItemNames[$itemName]);
                }
            }
    Replace with
    PHP:
            $cache $this->_getCache(true);
            
    $dbItemNames = array();
            
    $data = array();

            foreach (
    $itemNames AS $itemName)
            {
                
    $cacheData = ($cache $cache->load($this->_getCacheEntryName($itemName)) : false);
                if (
    $cacheData !== false)
                {
                    
    $data[$itemName] = $cacheData;
                }
                else
                {
                     
    $dbItemNames[] = $itemName;
                }
            }
     
    Romchik®, CyberAP and Pepelac like this.
  2. Yoskaldyr

    Yoskaldyr Well-Known Member

    Bug is still present in the beta 3 :(
     
  3. Mike

    Mike XenForo Developer Staff Member

    Changed the code differently (the unset should be based on the key, not the value), but fixed now. Thanks :)
     
    Yoskaldyr likes this.

Share This Page