Ignore:
Timestamp:
Jan 31, 2011, 11:14:57 AM (13 years ago)
Author:
grum
Message:

release 3.4.0
optimise config load

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/GrumPluginClasses/classes/GPCCore.class.inc.php

    r8961 r9003  
    192192  static public function loadConfig($pluginName, &$config=Array())
    193193  {
    194     if(!is_array($config))
     194    global $conf;
     195
     196    if(!isset($conf[$pluginName.'_config']))
    195197    {
    196198      return(false);
    197199    }
    198200
    199     $sql="SELECT value FROM ".CONFIG_TABLE."
    200           WHERE param = '".$pluginName."_config'";
    201     $result=pwg_query($sql);
    202     if($result)
    203     {
    204       $row=pwg_db_fetch_row($result);
    205       if(is_string($row[0]))
     201    $configValues = unserialize($conf[$pluginName.'_config']);
     202    reset($configValues);
     203    while (list($key, $val) = each($configValues))
     204    {
     205      if(is_array($val))
    206206      {
    207         $configValues = unserialize($row[0]);
    208         reset($configValues);
    209         while (list($key, $val) = each($configValues))
     207        foreach($val as $key2 => $val2)
    210208        {
    211           if(is_array($val))
    212           {
    213             foreach($val as $key2 => $val2)
    214             {
    215               $config[$key][$key2]=$val2;
    216             }
    217           }
    218           else
    219           {
    220             $config[$key] =$val;
    221           }
     209          $config[$key][$key2]=$val2;
    222210        }
    223211      }
    224       return(true);
    225     }
    226     return(false);
     212      else
     213      {
     214        $config[$key] =$val;
     215      }
     216    }
     217
     218    return(true);
    227219  }
    228220
Note: See TracChangeset for help on using the changeset viewer.