织梦的data目录存放着我们重要的系统文件,有存放后台系统管理数据备份,数据还原的一些备份信息的backupdata目录,还有和数据库交互的文件,和后台的设置信息,以及我们登陆时的一些缓存验证信息等。织梦data目录一般都有可以读写的权限,存在很大的安全隐患,很多站长甚至给予这个目录可执行的权限,更是非常危险的。默认的名称很容易被攻击,从而取得我们网站的管理权限等,所以白露教大家把织梦默认的data目录改个名字,从而增加我们网站的安全系数。
其实关于织梦data目录,织梦官方有个织梦data目录迁移教程,但是这个教程有很多缺陷,所以白露不推荐使用官方的教程。而且织梦的程序中很多地方都是直接写死的data路径,单纯的修改后台和搬迁目录会造成一系列的麻烦问题,本文白露就给大家列举了织梦所有涉及data路径的文件以及需要修改的地方,看看你有没有改错!
在织梦更改data目录教程开始修改之前,老规矩,先备份、备份、备份!!!后台“系统”-“数据库备份/还原”备份数据库,然后把整站程序打包成zip格式,如果修改错了,又不知道错在哪,我们还可以还原备份。
织梦更改data目录名称教程:
第一步:把网站程序中的data目录直接重命名为databailu;

第二步:按照以下列出的文件进行更改,共有78处需要修改。
/index.php 找到第9行左右
if(!file_exists(dirname(__FILE__).'/data/common.inc.php'))
/data/config.cache.bak.php 找到第55行左右
$cfg_tplcache_dir = '/data/tplcache';
/data/config.cache.inc.php 找到第123行左右
$cfg_tplcache_dir = '/data/tplcache';
/data/config.file.inc.php 找到第50行左右
'filedir'=>'/data/js',
/dede/index_testenv.php 找到第141行左右
//if(TestExecuteable(DEDEROOT.'/data',$cfg_basehost)
/dede/index_testenv.php 找到第155行左右(common.inc.php这是我们的数据库连接文件,建议文件属性设置为644(Linux/Unix)或只读(NT);可以看白露发布的《织梦data/common.inc.php文件属性设置为644(Linux/Unix)或只读(NT)的bug解决!》)
$safeMsg[] = '强烈建议databailu/common.inc.php文件属性设置为644(Linux/Unix)或只读(NT);';
/dede/index_testenv.php 找到第173行左右
//if(PostHost($cfg_basehost.'/data/admin/ver.txt') === @file_get_contents(DEDEDATA.'/admin/ver.txt'))
/dede/mail_file_manage.php 找到第23行左右
$inpath = $cfg_basedir."/data/mail";
/dede/mail_file_manage.php 找到第25行左右
$inpath = $cfg_basedir.$activepath."/data/mail";
/dede/makehtml_js_action.php 找到第43行左右
$pv->SaveToHtml($cfg_basedir.$cfg_cmspath."/data/js/".$row['id'].".js",$isremote);
/dede/makehtml_js_action.php 找到第45行左右
ShowMsg("成功更新".$cfg_cmspath."/data/js/".$row['id'].".js,继续进行操作!
/dede/makehtml_js_action.php 找到第51行左右
$pv->SaveToHtml($cfg_basedir.$cfg_cmspath."/data/js/".$typeid.".js",$isremote);
/dede/makehtml_js_action.php 找到第52行左右
echo "成功更新".$cfg_cmspath."/data/js/".$typeid.".js!";
/dede/makehtml_js_action.php 找到第55行左右
src='".$cfg_cmspath."/data/js/".$typeid.".js'
/dede/makehtml_list_action.php 找到第87行左右
showmsg('没有该栏目数据, 可能缓存文件(/data/cache/inc_catalog_base.inc)没有更新, 请检查是否有写入权限');
/dede/makehtml_map.php 找到第26行左右
$murl = $cfg_cmspath."/data/sitemap.html";
/dede/makehtml_map.php 找到第31行左右
$murl = $cfg_cmspath."/data/rssmap.html";
/dede/makeremote_all.php 找到第139行左右
$dirarray[$i++] = addDir('/data/js', '生成js目录', 0, 0, 1);
/dede/sys_safetest.php 找到第18行左右
$safefile = "data/common.inc.php
/dede/sys_safetest.php 找到第59行左右
if(NotCheckFile($f) || preg_match("#data/tplcache|.svn#", $f)) return -1;
/dede/sys_verifies.php 找到第318行左右
请从临时目录[../data/{$tmpdir}]中取出这几个文件手动还原。";
/dede/testenv.php 找到第123行左右
$cfg_cmspath/data|
/dede/testenv.php 找到第124行左右
$cfg_cmspath/data/$cfg_backup_dir|
/dede/testenv.php 找到第125行左右
$cfg_cmspath/data/textdata|
/dede/testenv.php 找到第126行左右
$cfg_cmspath/data/sessions|
/dede/testenv.php 找到第127行左右
$cfg_cmspath/data/tplcache|
/dede/testenv.php 找到第128行左右
$cfg_cmspath/data/admin|
/dede/testenv.php 找到第129行左右
$cfg_cmspath/data/enums|
/dede/testenv.php 找到第130行左右
$cfg_cmspath/data/mark|
/dede/testenv.php 找到第131行左右
$cfg_cmspath/data/module|
/dede/testenv.php 找到第132行左右
$cfg_cmspath/data/rss|
/dede/update_guide.php 找到第249行左右
$allFileList .= "文件临时存放目录:../data/
/dede/update_guide.php 找到第388行左右
你也可以直接使用[../data/{$tmpdir}]目录的文件手动升级。","javascript:;");
/dede/update_guide.php 找到第471行左右
$badmsg = ",其中失败 {$badcp} 个文件,
请从临时目录[../data/{$tmpdir}]中取出这几个文件手动升级。";
/dede/inc/inc_archives_all.php 找到第194行左右
$ipath = $GLOBALS['cfg_cmspath']."/data/textdata";
/dede/templets/baidunews.htm 找到第32行左右
value="../data/baidunews.xml"
/dede/templets/mail_file_manage.htm 找到第58行左右
urlencode($activepath."/data/mail")."'>[删除]
/dede/templets/makehtml_js.htm 找到第52行左右
src='".$cfg_cmspath."/data/js/"
/dede/templets/member_toadmin.htm 找到第7行左右
src='../data/enums/area.js'
/dede/templets/member_view.htm 找到第7行左右
src='../data/enums/area.js'
/dede/templets/sys_info_mark.htm 找到第54行左右
src="../data/mark/"
/dede/templets/sys_info_pay.htm 找到第173行左右
如果该配置无效要手动更改,可打开/data/sys_pay.cache.php文件进行手工配置
/dede/templets/sys_verifies_getfiles.htm 找到第22行左右
下载的文件临时存放在文件夹(../data/)内
/dede/templets/update_guide_getfiles.htm 找到第22行左右
下载的文件临时存放在文件夹(../data/)内
/dede/templets/vote_getcode.htm 找到第48行左右
$cfg_basehost.'/data/vote/vote_'.$aid.'.js'
/plus/advancedsearch.php 找到第18行左右
$timelock = '../data/time.lock';
/include/arc.archives.class.php 找到第301行左右
src='{$GLOBALS['cfg_cmspath']}/data/vote/vote_{$voteid}.js'
/include/arc.archives.class.php 找到第304行左右
src='{$GLOBALS['cfg_mainsite']}/data/vote/vote_{$voteid}.js'
/include/arc.listview.class.php 找到第88行左右
$this->Fields['rsslink'] = $GLOBALS['cfg_cmsurl']."/data/rss/".$this->TypeID.".xml";
/include/arc.rssview.class.php 找到第101行左右
$murl = $GLOBALS['cfg_cmspath']."/data/rss/".$this->TypeID.".xml";
/include/arc.sglistview.class.php 找到第90行左右
$this->Fields['rsslink'] = $GLOBALS['cfg_cmsurl']."/data/rss/".$this->TypeID.".xml";
/include/common.inc.php 找到第16行左右
define('DEDEDATA', DEDEROOT.'/data');
/include/common.inc.php 找到第197行左右
$cfg_data_dir = $cfg_cmspath.'/data';
/include/control.class.php 找到第106行左右
$help_path = $path.'/data/helper/'.$helper.".helper.php";
/include/customfields.func.php 找到第60行左右
src='{$cmspath}data/enums/{$fieldname}.js'
/include/customfields.func.php 找到第263行左右
$ipath = $cfg_cmspath."/data/textdata";
/include/customfields.func.php 找到第427行左右
src='{$cmspath}data/enums/{$fieldname}.js'
/include/dedesql.class.php 找到第516行左右
$RecordLogFile = dirname(__FILE__).'/../data/mysqli_record_log.inc';
/include/dedesql.class.php 找到第533行左右
$errorTrackFile = dirname(__FILE__).'/../data/mysql_error_trace.inc';
/include/dedesql.class.php 找到第534行左右
if( file_exists(dirname(__FILE__).'/../data/mysql_error_trace.php') )
/include/dedesql.class.php 找到第536行左右
@unlink(dirname(__FILE__).'/../data/mysql_error_trace.php');
/include/dedesql.class.php 找到第628行左右
$log_file = DEDEINC.'/../data/'.md5($cfg_cookie_encode).'_safe.txt';
/include/dedesqli.class.php 找到第517行左右
$RecordLogFile = dirname(__FILE__).'/../data/mysqli_record_log.inc';
/include/dedesqli.class.php 找到第534行左右
$errorTrackFile = dirname(__FILE__).'/../data/mysqli_error_trace.inc';
/include/dedesqli.class.php 找到第535行左右
if( file_exists(dirname(__FILE__).'/../data/mysqli_error_trace.php') )
/include/dedesqli.class.php 找到第537行左右
@unlink(dirname(__FILE__).'/../data/mysqli_error_trace.php');
/include/dedesqli.class.php 找到第609行左右
$log_file = DEDEINC.'/../data/'.md5($cfg_cookie_encode).'_safe.txt';
/include/ftp.class.php 找到第630行左右
$errorTrackFile = dirname(__FILE__).'/../data/ftp_error_trace.inc';
/include/sitemap.class.php 找到第74行左右
$typelink = $GLOBALS['cfg_cmsurl']."/data/rss/".$row->id.".xml";
/include/sitemap.class.php 找到第118行左右
$typelink = $GLOBALS['cfg_cmsurl']."/data/rss/".$row->id.".xml";
/include/splitword.class.php 找到第1127行左右
$unpackagefile = array_keys($zip->Extract($targetfile,DEDEINC.'/data/'));
/include/splitword.class.php 找到第1129行左右
$this->MakeDict(DEDEINC.'/data/'.$unpackagefile[0]);
/include/splitword.class.php 找到第1130行左右
unlink(DEDEINC.'/data/'.$unpackagefile[0]);
/include/payment/alipay.php 找到第286行左右
$fp = fopen(dirname(__FILE__)."/../../data/payment/log.txt","a");
/include/payment/yeepay.php 找到第417行左右
$fp = fopen(dirname(__FILE__)."/../../data/payment/log.txt","a");
/include/taglib/infoguide.lib.php 找到第73行左右
src='{$cfg_mainsite}{$cmspath}data/enums/nativeplace.js'
/include/taglib/infoguide.lib.php 找到第79行左右
src='{$cfg_mainsite}{$cmspath}data/enums/infotype.js'
/m/index.php 找到第2行左右
if(!file_exists(dirname(__FILE__).'/../data/common.inc.php'))
织梦更改data目录应该就是改以上这些,如果在使用的过程中发现什么问题,可以直接在本页面右侧的“留言”提交异常情况,白露会尽快解决。如果更改织梦data目录出现未知问题,可以用DW等软件查找全站的databailu(你自己命名的data目录名)并还原即可
猜你喜欢