Exemplo n.º 1
0
$result = $db->query($sqlSelect);
$arrResult = $db->fetch_array($result);
//--------------------初始化数据--------------------------------------------
$indexCache->AnalysisData($arrResult, (array) $viewID);
//将viewid转换成数组
$indexCache->AnalysisCache();
$arrResult = null;
unset($arrResult);
$baidu = new baidu();
$baidu->AnalysisCache($indexCache->conBaidu[$viewID]);
$baidu->SetKey($indexCache->key);
$baidu->SetViewId($viewID);
$baidu->CrawlView();
//--------------------更新数据库--------------------------------------------
if ($baidu->isUp) {
    $sqlUpdate = 'UPDATE `' . $indexCache->dbPrefix . 'cat` SET `baidu' . $viewID . '`=\'' . addslashes($baidu->GetSerializeCache()) . '\' WHERE `cid`=' . $indexCache->cid;
    $db->query($sqlUpdate);
}
$db->close();
//--------------------输出--------------------------------------------
if ($cfg->isMemcached) {
    $memcached = new Memcached();
    $memcached->addServer('127.0.0.1', '11211');
}
$templets = GetContent($indexCache->mainDomain . 'view.html', './templets/view.html', $memcached, 86400, $cfg->isMemcached);
//生成相关链接:
$arrKeys = explode(',', $indexCache->keys);
$keysLink = '';
foreach ($arrKeys as $v) {
    $keyEPath = GetEPath($v);
    $arr = explode('/', $keyEPath);
Exemplo n.º 2
0
$indexContent->SetUpTimes($upTimes);
//--------------------更新百度--------------------------------------------
$sqlUpBaidu = '';
$indexContent->CleanBaiduArray();
$baiduLinks = '';
foreach ($arrBaiduViewId as $k => $v) {
    $baidu = new baidu();
    $baidu->AnalysisCache($indexContent->conBaidu[$v]);
    $baidu->SetKey($indexContent->key);
    $baidu->SetViewId($v);
    $baidu->InsertLinks($baiduLinks);
    $baidu->CrawlList();
    $baiduLinks = $baidu->links;
    $indexContent->SetBaidu($v, $baidu->title, $baidu->description);
    if ($baidu->isUp) {
        $sqlUpBaidu .= ',`baidu' . $v . "`='" . addslashes($baidu->GetSerializeCache()) . "' ";
    }
    $baidu = NULL;
    unset($baidu);
}
//--------------------更新随机文章-----------------------------------------
$dayAfterCreate = (int) ((time() - $indexContent->createTime) / 86400);
$arrRandArticleViewId = array($dayAfterCreate + 1, $dayAfterCreate + 2, $dayAfterCreate + 3);
$indexContent->CleanRandArticleArray();
foreach ($arrRandArticleViewId as $v) {
    $randArticle = new randArticle($cfg->isMemcached);
    $randArticle->SetKey($indexContent->key);
    $randArticle->SetKeys($indexContent->keys);
    $randArticle->SetStroyPath($cfg->storyPath);
    $randArticle->InitFeature($indexContent->baseUrl . $v);
    $randArticle->GenerateTitle();