コード例 #1
0
ファイル: Broker.php プロジェクト: hillstill/sooh
 public static function free($arrConf_or_strModName = null, $subid = null)
 {
     if ($arrConf_or_strModName == null) {
         $ks = array_keys(self::$_instances);
     } elseif (is_array($arrConf_or_strModName)) {
         $ks = array(self::idOfConnection($arrConf_or_strModName));
     } else {
         $ini = sooh_ini::getInstance();
         $dbid = $ini->get('dbByObj.' . $arrConf_or_strModName);
         if ($dbid === null) {
             $dbid = $ini->get('dbByObj.default');
         }
         if (is_array($dbid)) {
             if ($subid === null) {
                 $ks = array();
                 foreach ($dbid as $subid) {
                     $ks[] = self::idOfConnection(self::confOfMod($arrConf_or_strModName, $subid));
                 }
             } else {
                 $ks = array(self::idOfConnection(self::confOfMod($arrConf_or_strModName, $subid)));
             }
         } else {
             $ks = array(self::idOfConnection(self::confOfMod($arrConf_or_strModName, null)));
         }
     }
     if (sooh_trace::needsWrite(__CLASS__)) {
         sooh_trace::obj('final free these db(s):', $ks);
     }
     foreach ($ks as $id) {
         if (isset(self::$_instances[$id])) {
             self::$_instances[$id]->free();
             unset(self::$_instances[$id]);
         }
     }
 }