내가 어디에서 가져 왔는지 확실하지 않지만 오랫동안 사용 해왔다. 이것을 phpbb3
루트 디렉토리에두고 고유 한 이름을 지정하십시오. 이를 원한다면 URL을 방문하는 모든 사용자가 캐시를 지울 수 있습니다.
이 스크립트를 직접 스크립트에 넣으려면 아래의 delete_cache
함수를 살펴 보시기 바랍니다. 당신은 나이에 따라 일부 파일을 삭제할 경우이 코드는 독특한 무언가가 당신이해야 할 유일한 것은 아니다 그것을 이름을 제외한 큰 노력
<?php
/**
*
* @package phpBB3
* @copyright (c) 2009 3Di - delete_cache.php v. 0001 - 2009-2-28
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
/**
*/
/**
* @ignore
*/
define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup();
// Purges the tmp cache files based on time-frame
function delete_cache()
{
global $phpbb_root_path;
$phpbb_cache = ($phpbb_root_path . 'cache');
// time in seconds the files are allowed to last into the cache dir
$seconds_old = 1;
// directory check-in first
if (is_dir("$phpbb_cache"))
{
$handle=opendir($phpbb_cache);
while (false!==($tmp_phpbb_cache_files = readdir($handle)))
{
// we delete everything but index.htm, .htaccess and sub-folders
if ($tmp_phpbb_cache_files != "." && $tmp_phpbb_cache_files != ".." && $tmp_phpbb_cache_files != "index.htm" && $tmp_phpbb_cache_files != ".htaccess")
{
$diff = (time() - filectime("$phpbb_cache/$tmp_phpbb_cache_files"));
if ($diff > $seconds_old)
{
unlink("$phpbb_cache/$tmp_phpbb_cache_files");
}
}
}
closedir($handle);
}
// that should never happen..
else
{
trigger_error('CACHE_DIR_ERROR');
}
}
delete_cache();
?>
, 일부 해커에 htaccess로 사용 등 디렉토리 스캐너를 사용 이 파일을 보호하고 서버 IP와 정적 IP (인터넷 연결에 사용하는 IP)에서만 허용하십시오. 이렇게하면 보안을 강화하는 데 도움이됩니다. 나는이 의견이 stackoverflow 사용자에게 도움이되기를 바랍니다. – jagb