Version cache mod (phpBB 2.0.12 or newer only)

Kleine Codeänderungen oder Mini-MODs
Keine Anfragen!!! -- No requests!!!

Moderator: Supporter

Beitragvon AmigaLink » 20. Jul 2005 22:48

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


Zugefügt nach 142 Tag(en) 10 Stunde(n) 20 Minute(n):

Von diesem Snippet ist mittlerweile eine neuere Version verfügbar. :arrow: http://www.amigalink.de/dl_detai ... d=84&cat=8
Die deutsche Sprache ist Freeware, du kannst sie benutzen, ohne dafür zu bezahlen. Sie ist aber nicht Open Source, also darfst du sie nicht verändern, wie es dir gerade passt.
Benutzeravatar
AmigaLink
Administrator
 
Beiträge: 3987
Registriert: 11. Aug 2004 01:06
Wohnort: NRW

Zurück zu phpBB2 Snippets



Wer ist online?

Mitglieder in diesem Forum: 0 Mitglieder und 8 Gäste