如何从外部脚本清除Typo3中的缓存? [英] How to clear the cache in Typo3 from an external script?

查看:70
本文介绍了如何从外部脚本清除Typo3中的缓存?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我确实有一个PHP脚本,它不是Typo3的扩展。现在,我想从该脚本中删除整个Typo3缓存。怎么可能?

I do have a PHP script, which is not an extension for Typo3. Now I would like to delete the whole Cache of Typo3 out of this script. How is that possible?

推荐答案

我自己找到了解决方案,实际上很简单。我查看了 t3lib 文件夹中的 class.t3lib_tcemain.php 。那里有清除缓存的必要命令。它还会检查您是否启用了cachingframework。如果是这样,您还需要截断一些其他表(以 cachingframework_cache _ 开头)

I found the solution myself and its actually pretty easy. I took a look into the class.t3lib_tcemain.php in the t3lib folder. There you've got the necessary commands to clear the cache. It also checks, if you have the cachingframework enabled. If so, you need to truncate a few other tables as well (Starts with cachingframework_cache_)

基本上是:

<?php

 require_once('./typo3conf/localconf.php');

 $conn = mysql_connect($typo_db_host, $typo_db_username, $typo_db_password);
 mysql_select_db($typo_db);

 // Clear Cache here
 mysql_query("TRUNCATE cache_treelist;");
 mysql_query("TRUNCATE cache_pagesection;");
 mysql_query("TRUNCATE cache_hash;");
 mysql_query("TRUNCATE cache_pages;");
 if($handle = opendir('./typo3conf')) {
    while (false !== ($file = readdir($handle))) {
        if(strpos($file, 'temp_CACHED_')!==false) {
            unlink('./typo3conf/'.$file);
        }
    }
    closedir($handle);
 }

?>

这篇关于如何从外部脚本清除Typo3中的缓存?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆