[BETA] Version cache mod (phpBB 2.0.12 or newer only)

In diesem Forum können Mod-Autoren ihre Mods vorstellen, die sich noch im Entwicklungsstatus befinden. Der Einbau in Foren im produktiven Betrieb wird nicht empfohlen.
Forumsregeln
phpBB 2.0 hat das Ende seiner Lebenszeit überschritten
phpBB 2.0 wird nicht mehr aktiv unterstützt. Insbesondere werden - auch bei Sicherheitslücken - keine Patches mehr bereitgestellt. Der Einsatz von phpBB 2.0 erfolgt daher auf eigene Gefahr. Wir empfehlen einen Umstieg auf phpBB 3.0, welches aktiv weiterentwickelt wird und für welches regelmäßig Updates zur Verfügung gestellt werden.
Antworten
Dave
Mitglied
Beiträge: 2085
Registriert: 25.05.2003 15:03
Wohnort: Wuppertal

[BETA] Version cache mod (phpBB 2.0.12 or newer only)

Beitrag von Dave »

CyberAlien hat geschrieben: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.

Note: chmod directory "cache" to 777 to make cache writable.

Code: Alles auswählen

################################################################# 
## MOD Title: Version Cache mod
## MOD Version: 0.01
## 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))
	{

# 
#-----[ 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'] . '.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;
		}
	}

	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'))
		{
			fwrite($f, '<' . '?php $last_update = ' . time() . '; $version_info = "' . addslashes($version_info) . '"; ?' . '>');
			fclose($f);
			@chmod($cache_file, 0777);
		}
	}
	// Version cache mod end

# 
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------ 
# 
# EoM 
Mod is available in .mod format here: http://files.phpbbstyles.com/ca/mod_versioncache.txt
Dürfte hier auch einige andere interessieren
:wink:
Antworten

Zurück zu „phpBB 2.0: Mods in Entwicklung“