MOD: Version Cache

Downloadable phpBB mods/hacks.

MOD: Version Cache

Postby PostBot on Wed Feb 23, 2005 3:02 pm

Mod name: Version Cache mod
Mod version: 0.0.3
Author: CyberAlien
phpBB version: 2.0.12 - 2.0.19

Download: click "download" link in header of following code block:
[code filename="version_cache.txt"]#################################################################
## MOD Title: Version Cache mod
## MOD Version: 0.03
## MOD Author: CyberAlien <no@public_email> (Vjacheslav Trushkin) http://www.phpbbstyles.com
## MOD Description:
## This mod caches phpBB version update information so phpBB checks
## for update only once a day instead of checking it every time you
## open admin control panel index.
##
## Installation Level: Easy
## Installation Time: 1-2 Minutes
## Files To Edit (1): admin/index.php
##############################################################
## For Security Purposes, Please Check: http://www.phpbb.com/mods/ for the
## latest version of this MOD. Downloading this MOD from other sites could cause malicious code
## to enter into your phpBB Forum. As such, phpBB will not offer support for MOD's not offered
## in our MOD-Database, located at: http://www.phpbb.com/mods/
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################

#
#-----[ OPEN ]---------------------------------------------
#
admin/index.php

#
#-----[ FIND ]---------------------------------------------
# around line 570
if ($fsock = @fsockopen('www.phpbb.com', 80, $errno, $errstr, 10))
{

#
#-----[ BEFORE, ADD ]---------------------------------------
#
// Version cache mod start
// Change following two variables if you need to:
$cache_update = 86400; // 24 hours cache timeout. change it to whatever you want
$cache_file = '../cache/phpbb_update_' . $board_config['default_lang'] . $board_config['version'] . '.php'; // file where to store cache

$do_update = true;
if(@file_exists($cache_file))
{
$last_update = 0;
$version_info = '';
@include($cache_file);
if($last_update && !empty($version_info) && $last_update > (time() - $cache_update))
{
$do_update = false;
}
else
{
$version_info = '';
}
}

if($do_update)
{
// Version cache mod end

#
#-----[ FIND ]---------------------------------------------
# around line 641
$version_info .= '<p>' . $lang['Mailing_list_subscribe_reminder'] . '</p>';

#
#-----[ AFTER, ADD ]---------------------------------------
#
// Version cache mod start
if(@$f = fopen($cache_file, 'w'))
{
$search = array('\\', '\'');
$replace = array('\\\\', '\\\'');
fwrite($f, '<' . '?php $last_update = ' . time() . '; $version_info = \'' . str_replace($search, $replace, $version_info) . '\'; ?' . '>');
fclose($f);
@chmod($cache_file, 0777);
}
}
// Version cache mod end

#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM [/code]

Description:

phpBB 2.0.12 checks for latest phpBB version in admin control panel. It checks for version every time you open admin control panel index and it slows down acp index for few seconds (it depends on your host's connection to phpbb.com and phpbb.com speed).

This mod caches result returned by phpbb.com, so instead of checking for update every time you open acp it checks for update only once in 24 hours. So acp index opens faster and phpbb.com gets less queries.
Do NOT pm me, I don't visit this forum anymore, don't own it, don't provide any support and don't moderate.
User avatar
PostBot
Moderator
Moderator
 
Posts: 10659
Joined: Sat Aug 02, 2003 3:52 pm
Location: Mars

Return to phpBB 2.0 Mods

Who is online

Users browsing this forum: No registered users and 1 guest