コード例 #1
0
ファイル: checkup.php プロジェクト: Avantians/Textcube
function clearCache()
{
    global $database, $changed, $errorlog, $memcache;
    static $isCleared = false;
    $context = Model_Context::getInstance();
    if ($isCleared == true) {
        return;
    }
    if (!is_null($blogids = POD::queryColumn("SELECT blogid FROM {$database['prefix']}PageCacheLog"))) {
        $changed = true;
        $errorlog = false;
        echo '<li>', _textf('페이지 캐시를 초기화합니다.'), ': ';
        foreach ($blogids as $ids) {
            if (CacheControl::flushAll($ids) == false) {
                $errorlog = true;
            }
        }
        if ($errorlog == false) {
            echo '<span class="result success">', _text('성공'), '</span></li>';
        } else {
            echo '<span class="result fail">', _text('실패'), '</span></li>';
        }
    }
    if ($context->getProperty('service.codecache', false)) {
        $changed = true;
        $errorlog = false;
        echo '<li>', _textf('코드 캐시를 초기화합니다.'), ': ';
        $code = new CodeCache();
        $code->flush();
        if ($errorlog == false) {
            echo '<span class="result success">', _text('성공'), '</span></li>';
        } else {
            echo '<span class="result fail">', _text('실패'), '</span></li>';
        }
    }
    if (!is_null($memcache)) {
        echo '<li>', _textf('Memcached 캐시를 초기화합니다.'), ': ';
        if ($memcache->flush()) {
            echo '<span class="result success">', _text('성공'), '</span></li>';
        } else {
            echo '<span class="result fail">', _text('실패'), '</span></li>';
        }
    }
    echo '<li>', _textf('공지사항 캐시를 초기화합니다.'), ': ';
    if (POD::execute("DELETE FROM {$database['prefix']}ServiceSettings WHERE name like 'TextcubeNotice%'")) {
        echo '<span class="result success">', _text('성공'), '</span></li>';
    } else {
        echo '<span class="result fail">', _text('실패'), '</span></li>';
    }
    if (!is_null($blogids = POD::queryColumn("SELECT DISTINCT blogid FROM {$database['prefix']}BlogSettings"))) {
        $changed = true;
        $errorlog = false;
        echo '<li>', _textf('댓글 및 트랙백 휴지통을 비웁니다.'), ': ';
        foreach ($blogids as $ids) {
            emptyTrash(true, $ids);
            emptyTrash(false, $ids);
        }
        if ($errorlog == false) {
            echo '<span class="result success">', _text('성공'), '</span></li>';
        } else {
            echo '<span class="result fail">', _text('실패'), '</span></li>';
        }
    }
    $isCleared = true;
}
コード例 #2
0
ファイル: include.php プロジェクト: Avantians/Textcube
/// All rights reserved. Licensed under the GPL.
/// See the GNU General Public License for more details. (/documents/LICENSE, /documents/COPYRIGHT)
/** Pre-define basic components */
/***** Loading code pieces *****/
if (isset($uri)) {
    $codeName = $uri->uri['interfaceType'];
}
if ($context->getProperty('service.codecache', null) == true && file_exists(__TEXTCUBE_CACHE_DIR__ . '/code/' . $codeName)) {
    $codeCacheRead = true;
    require __TEXTCUBE_CACHE_DIR__ . '/code/' . $codeName;
} else {
    $codeCacheRead = false;
    foreach ($context->getProperty('import.library') as $lib) {
        if (strpos($lib, 'DEBUG') === false) {
            importlib($lib);
        } else {
            if (defined('TCDEBUG')) {
                __tcSqlLogPoint($lib);
            }
        }
    }
}
if ($context->getProperty('service.codecache', null) == true && $codeCacheRead == false) {
    $libCode = new CodeCache();
    $libCode->name = $codeName;
    foreach ($context->getProperty('import.library') as $lib) {
        array_push($libCode->sources, '/library/' . str_replace(".", "/", $lib) . '.php');
    }
    $libCode->save();
    unset($libCode);
}