当前位置:首页 > 网站管理 > 正文内容

dede织梦data目录正确迁移及引起的问题解决方法

wzccxx5年前 (2021-06-05)网站管理10

教程1:

关于将dede织梦data目录迁移出web目录织梦官方提供了一个教程,但是如果你是按照他们提供的教程做的话会出现很多问题。比如验证码问题, 图片显示问题等等一大堆。织梦官方这种是很不负责任的,因为那个教程有很大缺陷。这里跟大家提供一个完整版本的如何将dede织梦data目录正确迁移, 以及按照官方版本教程迁移出现问题的解决办法。这里先看看官方的吧,然后我再补充。

  1、将data目录转移到非Web目录

  我们这里举例“D:\dedecms\v57”为我们系统的根目录,我们需要将目录下的data文件夹(如图1)迁移要上一级目录(非Web目录),简单的办法直接剪切或者拷贝即可。

   到了这里官方说教程已经完成,可是如果你信了那就麻烦了。你会碰到很多问题。这么草率的搬离问题很多的比如,我们常见的网站地图和生成的JS 文件,全部会导致路径不正确。例如发现移动后有两点问题,第一、后台登陆不显示验证码了,第二、联动类别后台发布的时候不显示.移动后发布文章时候联动类 别不显示和后台登陆不显示验证码。等等,即使你想要转移回去发现问题依然存在。其实真正正确的转移方法是:你需要把整个程序里所有关于调用到'/.. /data' 的部分全部换掉。而不仅仅是上面官方说的那几个。下面就挨个说下经常碰到的问题解决方法。

  转移data目录后验证码不显示或者输入验证码一直提示错误

  不显示验证码的同学请改一下/include/vdimgck.php这个文件 这个文件里也调用了DATA里的文件也可以改路径,把带有这个 /../data 改成你现在的路径。

$im = @imagecreatefromjpeg(dirname(__FILE__).'/data/vdcode.jpg');

  首页index.php文件也需要修改

  还需要把首页中index.php中的/data/改为/../data。也就是下面这句。

  if(!file_exists(dirname(__FILE__).'/data/common.inc.php'))
  {
  header('Location:install/index.php');
  exit();
  }

  DEDECMS默认生成的rss地图以及网站地图等都是生成在DATA的文件夹中,但是这个是一个非常重要的文件夹,一般我们在 Robots.txt 是禁止搜索引擎爬行这文件夹的,这就造成了,我们生成了地图,但是搜索根本就找不到的尴尬,下面就教大家如何更改自动生成的目录

  下面是详细的步骤:

  1,首先登录ftp,在根目录下建立rss文件夹

  2,修改根目录下你的管理员文件夹(默认是dede)下的makehtml_map.php文件

复制代码
复制代码
  将17行的$cfg_cmspath."/data/sitemap.html";改为

  $cfg_cmspath."/sitemap.html";

  将22行的$cfg_cmspath."/data/rssmap.html";改为

  $cfg_cmspath."/rssmap.html";
复制代码
复制代码

  17行是普通网站地图,22行是RSS的网站地图

  3,修改根目录下include下面的arc.rssview.class.php

  将71行的$murl = $GLOBALS['cfg_cmspath']."/data/rss/".$this->TypeID.".xml";改为

  $murl = $GLOBALS['cfg_cmspath']."/rss/".$this->TypeID.".xml";

  4,修改根目录下include下的sitemap.class.php

复制代码
复制代码
  将57行的$typelink = $GLOBALS['cfg_cmsurl']."/data/rss/".$row->id.".xml";

  $typelink = $GLOBALS['cfg_cmsurl']."/rss/".$row->id.".xml";

  将94行的$typelink = $GLOBALS['cfg_cmsurl']."/data/rss/".$row->id.".xml";

  $typelink = $GLOBALS['cfg_cmsurl']."/rss/".$row->id.".xml";
复制代码
复制代码

  5,修改/templets/default模板文件head.htm

  在11行左右找到

<li class="r3"><a href="{dede:global.cfg_dataurl/}/sitemap.html">网站地图</a></li><li class="r4"><a href="{dede:global.cfg_dataurl/}/rssmap.html">RSS订阅</a></li>

  改为

<li class="r3"><a href="{dede:global.cfg_cmsurl/}/sitemap.html">网站地图</a></li><li class="r4"><a href="{dede:global.cfg_cmsurl/}/rssmap.html">RSS订阅</a></li>

  6,进入后台,更新网站地图,更新RSS文件,更新主页。


教程2:

织梦的data目录是系统缓存和配置文件的目录,一般都有可以读写的权限,存在很大的安全隐患,很多站长甚至给予这个目录可执行的权限,更是非常危险的。

官方建议我们将data目录搬迁到web之外,但是织梦的程序中很多地方都是直接写死的data路径,单纯的修改后台和搬迁目录会造成一系列的麻烦问题,本文给大家列举了织梦所有涉及data路径的文件以及需要修改的地方。需要注意的是,由于本文没有修改安装(install)目录的相关文件,这将导致修改data之后再次安装程序会失败,需要把文件夹名称改回data(只修改回data文件夹名称即可,已经修改过的php文件不必理会),安装完成之后再将data修改为自定的文件夹名称。

本文以#data#php#为文件夹名称举例,之所以用#data#php#是因为查找和还原起来比较方便(毕竟改完之后全站只有我们修改过的是#data#php#),当我们需要还原的时候,用DW等软件查找全站的#data#php#并还原即可。搬迁目录操作是一样的,话不多说,直接上货。

开始修改之前,老规矩,先备份、备份、备份!!!后台“系统”-“数据库备份/还原”备份数据库,然后把整站程序打包成zip格式,如果修改错了,又不知道错在哪,那就还原备份。

第一步:登录网站后台,系统 - 基本参数设置 - 性能选项 - 模板缓存目录,将/data/tplcache中的data修改为你自己想要更换的名字。

(ps:如果想要搬迁到站点的上一级目录,写入/../data/tplcache,如果只是要修改文件夹名称,直接更换即可/#data#php#/tplcache

第二步:把网站程序中的data目录直接重命名为#data#php#

第三步:按照以下列出的文件进行更改,共有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行左右
$safeMsg[] = '强烈建议data/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'))



扫描二维码推送至手机访问。

版权声明:本文由泰山森林发布,如需转载请注明出处。

本文链接:https://wzc.tzts.ltd/post/70.html

分享给朋友:

相关文章

如何取消织梦cms的data、uploads执行php权限

登录织梦cms后台就会有提醒1.目前data、uploads有执行.php权限,非常危险,需要立即取消目录的执行权限!2.强烈建议data/common.inc.php文件属性设置为644(Linux/Unix)或只读(NT);3.强烈建议...

dede取消后台登陆验证码

找到织梦程序data\safe\inc_safe_config.php文件,然后用Edit打开(其它代码编辑器也可以但是切记不要用记事本打开,避免出错)找到以下代码,去掉“6”保存即可;(这种方法的作用就是关掉织梦登陆后台的验证码功能,百试...

dede站点转移空间后,数据库要怎么连接

DEDE 服务器转移方法 方法一: 1、进旧站后台:系统管理→数据库备份。单击下部“全选”后“提交”进行备份;   2、将旧站的所有文件上传到新站点,删除install目录下的install.lock文件;   3...

dede 织梦 修改admin 用户名,删除admin账户

修改用户名:update dede_admin set userid='你要的登录名' where id=1删除admin账户(前提要有另一个超级管理员账户)delete from dede_admin where unam...

DEDECMS各目录安全权限设置

1、以下目录:data、templets、uploads、a设置可读写不可执行权限。其中a目录为文档HTML默认保存路径,可以在后台进行更改;2、以下目录:include、member、plus、dede设置为可读可执行不可写入权限。其中后...

dede取消目录执行权限设置

dede取消目录执行权限设置

网站安全中,对目录的执行权限是非常敏感的,一般来说,可以写入的目录是不能够拥有脚本的执行权限的,像DedeCMS系统,可写入的有两个目录data、uploads,data目录主要是基本配置文件和缓存数据,uploads则是附件上传保存的目录...

发表评论

访客

◎欢迎参与讨论,请在这里发表您的看法和观点。