static function writeConfig($ConfigFile) { $m = D('Admin/Config'); if ($ConfigFile == 'core') { //core缓存到配置目录 $savefile = CONF_PATH . 'core.php'; $data = $m->getConfig($ConfigFile); $b = cache_array($data, $savefile); return $data; } if ($ConfigFile == 'home/config') { //core缓存到配置目录 $savefile = CONF_PATH . 'Home/config.php'; $data = $m->getConfig($ConfigFile); if (empty($data['DEFAULT_THEME'])) { $data['DEFAULT_THEME'] = 'Default'; } $b = cache_array($data, $savefile); return $data; } if ($ConfigFile == 'wap/config') { //core缓存到配置目录 $savefile = CONF_PATH . 'Wap/config.php'; $data = $m->getConfig($ConfigFile); if (empty($data['DEFAULT_THEME'])) { $data['DEFAULT_THEME'] = 'Default'; } $b = cache_array($data, $savefile); return $data; } //缓存域名配置到缓存 if ($ConfigFile == 'domain') { $savefile = CONF_PATH . 'domain.php'; $data = $m->getConfig($ConfigFile); $domain = array('APP_SUB_DOMAIN_RULES' => array()); if (empty($data)) { cache_array($domain, $savefile); //写入空 return false; } $dList = explode(',', trim($data['WAP_URL'])); foreach ((array) $dList as $d) { if (!empty($d)) { $d = str_ireplace('http://', '', $d); //去掉http:// $temp[$d] = array('wap/'); } } $domain['APP_SUB_DOMAIN_RULES'] = $temp; $b = cache_array($domain, $savefile); return $data; } //html缓存 if ($ConfigFile == 'html') { $savefile = CONF_PATH . 'html.php'; $data = $m->getConfig($ConfigFile); $htmlEnable = $data['HTML_ENABLE'] == 1 ? true : false; //Html首页缓存时间 $IndexCacheTime = $data['INDEX_CACHE_TIME']; //$IndexCacheTime = is_numeric($IndexCacheTime) ? "'$IndexCacheTime'" : "'0'"; //Html频道缓存时间 $ChannelCacheTime = $data['CHANNEL_CACHE_TIME']; //$ChannelCacheTime = is_numeric($ChannelCacheTime) ? "'$ChannelCacheTime'" : "'0'"; //Html信息缓存时间 $InfoCacheTime = $data['INFO_CACHE_TIME']; //$InfoCacheTime = is_numeric($InfoCacheTime) ? "'$InfoCacheTime'" : "'0'"; $html = array('HTML_CACHE_ON' => $htmlEnable, 'HTML_CACHE_RULES' => array('index:index' => array('{:group}/index_{0|get_language_mark}', $IndexCacheTime), 'channel:index' => array('{:group}/channel/{id}{jobid}{infoid}_{0|get_language_mark}_{0|get_para}', $ChannelCacheTime), 'info:read' => array('{:group}/info/{id}_{0|get_para}', $InfoCacheTime))); $b = cache_array($html, $savefile); return $data; } //设置无需区分语言缓存项 $file = $ConfigFile; if (in_array($ConfigFile, YdCache::$list)) { $data = $m->getConfig($ConfigFile); F($file, $data); //快速缓存 } else { //需要缓存所有语言 $lang = YdCache::readLanguage(); foreach ($lang as $k => $v) { $file = $ConfigFile . '_' . $v['LanguageMark']; $where = '(LanguageID=' . $v['LanguageID'] . ' or LanguageID=0)'; $where .= " and IsEnable = 1 and ConfigFile='{$ConfigFile}'"; $data = $m->where($where)->getField('ConfigName,ConfigValue'); F($file, $data); //快速缓存 } } return $data; }
showmessage("初始化" . $matches[1] . "表数据", $b); } } } } showmessage("安装数据完成!"); //写入管理员数据====================================================================== $sql = "Update youdian_admin Set AdminName='{$AdminName}', AdminPassword='******' Where AdminID=1"; $b = @$db->query($sql); $sql = "Update youdian_member Set MemberName='{$AdminName}', MemberPassword='******' Where MemberID=1"; $b = @$db->query($sql); showmessage("创建管理员", $b); //================================================================================== //将数据库文件写入配置 $dbInfo = array('DB_TYPE' => 'mysql', 'DB_HOST' => "{$dbHost}", 'DB_NAME' => "{$dbName}", 'DB_USER' => "{$dbUser}", 'DB_PWD' => "{$dbPwd}", 'DB_PORT' => "{$dbPort}", 'DB_PREFIX' => 'youdian_'); $b = cache_array($dbInfo, $dbFile); showmessage("写入数据库配置文件", $b); echo '<script type="text/javascript">Finish();</script>'; ob_flush(); //修改部分 flush(); showmessage("数据库安装完成!"); //创建安装锁定文件 if (!file_exists($InstallLock)) { @touch($InstallLock); } exit; case '4': //第四步 include_once "./Tpl/step4.html"; ob_flush();