前々から使用しているキャッシュ管理しているプログラムを
Cache_Lite に対応出来るように修正を試みようとしたけど

真剣に修正方法がわかりません
本当、どうしようかな・・・・
何方か、修正方法を教えてくる心優しい人とか居ないかな
以下が修正する必要があるプログラムです。
function read_cache_file( $url, $dir_name = "" )
{
$cache_file_name = sprintf( "%s%s%s.txt", DENNO_CACHE_PATH, $dir_name, md5( $url ) );
if( is_file( $cache_file_name ) ) {
$year = (int)date( "Y" );
$month = (int)date( "m" );
$day = (int)date( "d" );
$hour = (int)date( "H" );
$minute = (int)date( "i" );
$second = (int)date( "s" );
clearstatcache();
$one_day_ago_time = mktime( $hour, $minute, $second, $month, ($day - 7), $year );
$file_update_time = filemtime( $cache_file_name );
if( $one_day_ago_time > $file_update_time ) {
$xml = file_get_contents( $url );
output_file( $cache_file_name, $xml );
} else {
$xml = file_get_contents( $cache_file_name );
}
} else {
$xml = file_get_contents( $url );
output_file( $cache_file_name, $xml );
}
return mb_convert_encoding( $xml, 'SJIS', DENNO_XML_WORD_ENCODE );
}
function read_cache_file_no_encoding( $url, $dir_name = "" )
{
$cache_file_name = sprintf( "%s%s%s.txt", DENNO_CACHE_PATH, $dir_name, md5( $url ) );
if( is_file( $cache_file_name ) ) {
$year = (int)date( "Y" );
$month = (int)date( "m" );
$day = (int)date( "d" );
$hour = (int)date( "H" );
$minute = (int)date( "i" );
$second = (int)date( "s" );
clearstatcache();
$one_day_ago_time = mktime( $hour, $minute, $second, $month, ($day - 7), $year );
$file_update_time = filemtime( $cache_file_name );
if( $one_day_ago_time > $file_update_time ) {
$xml = file_get_contents( $url );
output_file( $cache_file_name, $xml );
} else {
$xml = file_get_contents( $cache_file_name );
}
} else {
$xml = file_get_contents( $url );
output_file( $cache_file_name, $xml );
}
return $xml;
}
/*
* キャッシュファイル出力
*/
function output_file( $file_name, $contents )
{
// ディレクトリが無かったら作る。
if( !is_dir( dirname( $file_name ) ) ) {
mkdir( dirname( $file_name ) );
chmod( dirname( $file_name ), 0777 );
}
$fp = fopen( $file_name, 'w' );
if( $fp ) {
fwrite( $fp, $contents );
fclose( $fp );
chmod( $file_name, 0666 );
return true;
} else {
return false;
}
}
