欢迎各位兄弟 发布技术文章

这里的技术是共享的

You are here

linux服务器下利用crond实现dedecms 织梦 首页定时更新

shiping1 的头像
inux服务器下利用crond实现dedecms首页定时更新这篇文章的内容如下: 
只有在dedecms5.3下实验过,其他版本原理相同
工具:1,php程序(安装完php后会有这么个程序),可以which下看看在哪
2,crond
步骤:1,需要修改的文件有dede目录下的config.php, makehtml_homepage.php和include目录下的userlogin.class.php文件,为了不干扰正常后台更新功能,把这3个文件都复制一份,重新命名,比如为autoconfig.php,automakehtml_homepage.php,auto.userlogin.class.php,并且放置的位置和原文件同目录。
2,分别修改这3个文件
修改autoconfig.php:
找到 $purview = $GLOBALS['cuserLogin']->getPurview();  在下面添加
$purview = ‘admin_AllowALL’;
修改啊autoconfig.php:
require_once(DEDEINC.”/userlogin.class.php”);    这句修改为
require_once(DEDEINC.”/autouserlogin.class.php”);
if($cuserLogin->getUserID()==-1) 这句修改为
if($cuserLogin->getUserID()!==-1)
修改automakehtml_homepage.php:
require_once(dirname(__FILE__).”/config.php”); 这句修改为
require_once(dirname(__FILE__).”/autoconfig.php”);
在require_once(DEDEINC.”/arc.partview.class.php”);这句下面添加如下内容:
$dopost=”make”;
$templet=”default/index.htm”;
$position=”../index.html”;
$saveset= 1;
3,上传这3个文件到对应的地方
用crond制定更新时间,比如每天的下午5点更新
修改/etc/crontab
添加:15 17 * * * root php -f /home/web/dede/automakehtml_homepage.php
修改的3个文件打包下载

来自 http://www.itfw5.com/seo/sedt/725.html
普通分类: