function afterUpdate($sign)
 {
     $portalPageService = L::loadClass('portalpageservice', 'area');
     $portalPageService->setPortalStaticState($channel, 1);
     portalEot($sign);
 }
Esempio n. 2
0
/**
 * 更新可视化页面的静态文件
 * @param $sign
 */
function portalStatic($sign, $_viewer = '', $name = '')
{
    $portalPageService = L::loadClass('portalpageservice', 'area');
    if (!$portalPageService->checkPortal($sign)) {
        if ($name) {
            $portalPageService->addPortalPage(array('sign' => $sign, 'title' => $name));
        } else {
            Showmsg('函数portalEcho调用出错,请设置本函数的第三个参数,定义该调用页面的名称');
        }
    }
    $lockName = 'portal_' . $sign;
    if (!procLock($lockName)) {
        return false;
    }
    $staticPath = S::escapePath(PORTAL_PATH . $sign);
    if (!is_dir($staticPath)) {
        return false;
    }
    $staticPath = S::escapePath(PORTAL_PATH . $sign . '/index.html');
    $otherOutput = ob_get_contents();
    ob_clean();
    $invokeService = L::loadClass('invokeservice', 'area');
    $pageConfig = $invokeService->getEffectPageInvokePieces('other', $sign);
    $tplGetData = L::loadClass('tplgetdata', 'area');
    $tplGetData->init($pageConfig);
    require portalEot($sign);
    $temp = ob_get_contents();
    $temp = str_replace(array('<!--<!---->', "<!---->\r\n", '<!---->', '<!-- -->', "\t\t\t"), '', $temp);
    //$success = pwCache::writeover($staticPath, $temp,'wb+');
    $success = pwCache::setData($staticPath, $temp, false, 'wb+');
    procUnLock($lockName);
    if (!$success && !$GLOBALS['db_distribute'] && !pwCache::writeover($staticPath, $temp) && !is_writable($staticPath)) {
        //写入二次尝试
        ob_end_clean();
        ObStart();
        Showmsg('请设置' . str_replace(R_P, '', $staticPath) . '文件为可写,如果文件不存在,则新建一个空文件');
    }
    ob_clean();
    $portalPageService->setPortalStaticState($sign, 0);
    updateCacheData();
    setPortalHtmlTime($sign);
    if ($otherOutput) {
        echo $otherOutput;
    }
}