国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > CMS > 帝國Empire > 正文

帝國CMS二次開發(fā)不開后臺定時刷新腳本

2024-08-28 12:26:44
字體:
供稿:網(wǎng)友

在你的操作系統(tǒng),如果是linux的話,添加以下計劃任務(wù)。 

* * * * *  /usr/bin/php /webrootpath/e/tasks/backend_cronjob.php。

把代碼傳到 /e/tasks/ 下。 

這個腳本將替代后臺的定時刷新,你不用在開著后臺了,它幫你定時刷新。

適用場景:全戰(zhàn)靜態(tài)化,需要定時刷新。(比如首頁有點計量,排行榜這樣的數(shù)據(jù)) 同時適用于,需要在多臺服務(wù)器上生成內(nèi)容的情況。
 


<?php
if (substr(php_sapi_name(), 0, 3) !== 'cli') {
    die("forbidden");
}
define('DOC_ROOT'strtr(__FILE__,'','/'));
define('ROOT_PATH',dirname(dirname(dirname(DOC_ROOT))));
require(ROOT_PATH.'/e/class/connect.php');
require(ROOT_PATH.'/e/class/functions.php');
require(ROOT_PATH.'/e/data/dbcache/class.php'); //引入欄目緩存文件
require(ROOT_PATH.'/e/class/db_sql.php');
require(ROOT_PATH.'/e/class/t_functions.php');
require(ROOT_PATH.'/e/data/dbcache/class.php');
require(ROOT_PATH.'/e/data/dbcache/MemberLevel.php');
$link = db_connect();
$empire new mysqlquery();
//定時刷新任務(wù)
function DoTimeRepage(){
    global $empire,$dbtbpre;
    DoAutoUpAndDownInfo();//自動上/下線
    $dotime=time();
    $b=0;
    $sql=$empire->query("select doing,classid,doid from {$dbtbpre}enewsdo where isopen = 1 and lasttime + dotime * 60 < $dotime");
    while($r=$empire->fetch($sql))
    {
        $b=1;
        if($r['doing']==1)//生成欄目
        {
            $cr=explode(',',$r['classid']);
            $count=count($cr)-1;
            for($i=1;$i<$count;$i++)
            {
                if(empty($cr[$i]))
                {
                    continue;
                }
                $cr[$i]=(int)$cr[$i];
                ReListHtml($cr[$i],1);
            }
        }
        elseif($r['doing']==2)//生成專題
        {
            $cr=explode(',',$r['classid']);
            $count=count($cr)-1;
            for($i=1;$i<$count;$i++)
            {
                if(empty($cr[$i]))
                {
                    continue;
                }
                $cr[$i]=(int)$cr[$i];
                ListHtmlIndex($cr[$i],null,0);
            }
        }
        elseif($r['doing']==3)//生成自定義列表
        {
            $cr=explode(',',$r['classid']);
            $count=count($cr)-1;
            for($i=1;$i<$count;$i++)
            {
                if(empty($cr[$i]))
                {
                    continue;
                }
                $cr[$i]=(int)$cr[$i];
                $ur=$empire->fetch1("select listid,pagetitle,filepath,filetype,totalsql,listsql,maxnum,lencord,listtempid,pagekeywords,pagedescription from {$dbtbpre}enewsuserlist where listid='".$cr[$i]."'");
                ReUserlist($ur,"");
            }
        }
        elseif($r['doing']==4)//生成自定義頁面
        {
            $cr=explode(',',$r['classid']);
            $count=count($cr)-1;
            for($i=1;$i<$count;$i++)
            {
                if(empty($cr[$i]))
                {
                    continue;
                }
                $cr[$i]=(int)$cr[$i];
                $ur=$empire->fetch1("select id,path,pagetext,title,pagetitle,pagekeywords,pagedescription,tempid from {$dbtbpre}enewspage where id='".$cr[$i]."'");
                ReUserpage($ur['id'],$ur[pagetext],$ur[path],$ur[title],$ur[pagetitle],$ur[pagekeywords],$ur[pagedescription],$ur[tempid]);
            }
        }
        elseif($r['doing']==5)//生成自定義JS
        {
            $cr=explode(',',$r['classid']);
            $count=count($cr)-1;
            for($i=1;$i<$count;$i++)
            {
                if(empty($cr[$i]))
                {
                    continue;
                }
                $cr[$i]=(int)$cr[$i];
                $ur=$empire->fetch1("select jsid,jsname,jssql,jstempid,jsfilename from {$dbtbpre}enewsuserjs where jsid='".$cr[$i]."'");
                ReUserjs($ur,'');
            }
        }
        elseif($r['doing']==6)//生成標(biāo)題分類頁面
        {
            $cr=explode(',',$r['classid']);
            $count=count($cr)-1;
            for($i=1;$i<$count;$i++)
            {
                if(empty($cr[$i]))
                {
                    continue;
                }
                $cr[$i]=(int)$cr[$i];
                ListHtml($cr[$i],null,5);
            }
        }
        else//生成首頁
        {
            $indextemp=GetIndextemp();
            NewsBq(null,$indextemp,1,0);
        }
        $empire->query("update {$dbtbpre}enewsdo set lasttime = $dotime where doid= '$r[doid] '");
    }
    if($b)
    {
        echo "最后執(zhí)行時間:".date("Y-m-d H:i:s"$dotime);
    }
}
//定時上線/下線
function DoAutoUpAndDownInfo(){
    global $empire,$dbtbpre,$class_r,$emod_r,$public_r;
    $dotime=time();
    $sql=$empire->query("select id,classid,infouptime,infodowntime from {$dbtbpre}enewsinfovote where infouptime>0 or infodowntime>0");
    while($r=$empire->fetch($sql))
    {
        if(!$class_r[$r[classid]]['tbname'])
        {
            continue;
        }
        //上線
        if($r['infouptime']&&$r['infouptime']<=$dotime)
        {
            $infor=$empire->fetch1("select * from {$dbtbpre}ecms_".$class_r[$r[classid]][tbname]."_check where id='$r[id]' limit 1");
            if(!$infor['id'])
            {
                continue;
            }
            //簽發(fā)
            if($infor['isqf'])
            {
                $qfr=$empire->fetch1("select checktno from {$dbtbpre}enewswfinfo where id='$r[id]' and classid='$r[classid]' limit 1");
                if($qfr['checktno']!='100')
                {
                    continue;
                }
            }
            $empire->query("update {$dbtbpre}ecms_".$class_r[$r[classid]][tbname]."_index set checked=1 where id='$r[id]' limit 1");
            $pubid=ReturnInfoPubid($r['classid'],$r['id']);
            $empire->query("update {$dbtbpre}enewsinfovote set infouptime=0 where pubid='$pubid' limit 1");
            //互轉(zhuǎn)
            MoveCheckInfoData($class_r[$r[classid]][tbname],0,$infor['stb'],"id='$r[id]'");
            AddClassInfos($r['classid'],'','+1');
            //刷新信息
            GetHtml($infor['classid'],$infor['id'],$infor,1);
            //刷新列表
            ReListHtml($r[classid],1);
        }
        //下線
        if($r['infodowntime']&&$r['infodowntime']<=$dotime)
        {
            $mid=$class_r[$r[classid]][modid];
            $tbname=$class_r[$r[classid]][tbname];
            $pf=$emod_r[$mid]['pagef'];
            $stf=$emod_r[$mid]['savetxtf'];
            //主表
            $infor=$empire->fetch1("select * from {$dbtbpre}ecms_".$class_r[$r[classid]][tbname]." where id='".$r[id]."' limit 1");
            if(!$infor['id'])
            {
                continue;
            }
            //簽發(fā)
            if($infor['isqf'])
            {
                $qfr=$empire->fetch1("select checktno from {$dbtbpre}enewswfinfo where id='$r[id]' and classid='$r[classid]' limit 1");
                if($qfr['checktno']!='100')
                {
                    continue;
                }
            }
            //分頁字段
            if($pf)
            {
                if(strstr($emod_r[$mid]['tbdataf'],','.$pf.','))
                {
                    $finfor=$empire->fetch1("select ".$pf." from {$dbtbpre}ecms_".$tbname."_data_".$infor[stb]." where id='$r[id]' limit 1");
                    $infor[$pf]=$finfor[$pf];
                }
                if($stf&&$stf==$pf)//存放文本
                {
                    $infor[$pf]=GetTxtFieldText($infor[$pf]);
                }
            }
            DelNewsFile($infor[filename],$infor[newspath],$infor[classid],$infor[$pf],$infor[groupid]);
            $empire->query("update {$dbtbpre}ecms_".$class_r[$r[classid]][tbname]."_index set checked=0,havehtml=0 where id='$r[id]' limit 1");
            $pubid=ReturnInfoPubid($r['classid'],$r['id']);
            $empire->query("update {$dbtbpre}enewsinfovote set infodowntime=0 where pubid='$pubid' limit 1");
            //互轉(zhuǎn)
            MoveCheckInfoData($class_r[$r[classid]][tbname],1,$infor['stb'],"id='$r[id]'");
            AddClassInfos($r['classid'],'','-1');
            //刷新列表
            ReListHtml($r[classid],1);
        }
    }
}
DoTimeRepage();
db_close();
$empire=null;
發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 井研县| 辽宁省| 简阳市| 司法| 建平县| 泾阳县| 云安县| 鄱阳县| 长治市| 聂荣县| 灵璧县| 仁怀市| 通山县| 苗栗县| 东阿县| 临城县| 淮南市| 临澧县| 麻栗坡县| 弥渡县| 哈尔滨市| 东山县| 罗江县| 塘沽区| 尤溪县| 奉贤区| 馆陶县| 赞皇县| 察雅县| 苏尼特右旗| 绥中县| 南木林县| 北流市| 武平县| 桑日县| 腾冲县| 佛坪县| 大足县| 仁化县| 南召县| 武义县|