Server Load Mod - 0.1.0

Eklentiler ile ilgili gelişmeler. Yeni modlar, güncellemeler.

Server Load Mod - 0.1.0

İleti sabri ünal 02.09.2006, 13:20

Kesinlikle gereksiz bir mod, fakat amacımız phpBB deki mod zenginliğini sergilemek olduğu için :+1:
ekliyorum...

Son 5 dakikada kaç sayfanın yüklendiğini sayfa altında bilgi olarak gösteriyor...

Server Load: 23 page(s) served in previous 5 minutes.

/ sunucu son 5 dakika içinde 23 sayfa(lar) yükledi

istatistik olarak kullanılabilir, o kadar.

Kod: Tümünü seç
##############################################################
## MOD Title: Server Load Mod
## MOD Author: IDB < ian@errolian.com > (Ian Brooks) http://www.team-allegiance.com
## MOD Description: Mod to show the number of pages served on your web server from your forums
## within a user-defined period (default is 5 mins).
## MOD Version: 0.1.0
##
## Installation Level: Moderate
## Installation Time: 10 Minutes
## Files To Edit: functions.php, page_tail.php, overall_footer.php
## Included Files: n/a
##############################################################
##############################################################
## Author Notes:
##
## 1. This mod requires 1 new table to be added to your database. 
##    Run the SQL statement shown below to do this.
##    Change the table prefix if you use other than phpbb.
##
##    CREATE TABLE phpbb_serverload (time int(14) NOT NULL default '0') TYPE=MyISAM;
##               
## 2. Change the overall_footer.tpl file for all your Templates
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################

#
#-----[ SQL ]------------------------------------------
#
    CREATE TABLE phpbb_serverload (time int(14) NOT NULL default '0') TYPE=MyISAM;
#
#-----[ OPEN]------------------------------------------
#

includes/functions.php

#
#-----[ FIND ]------------------------------------------
#

?>

#
#-----[ ADD BEFORE ]------------------------------------------
#

function serverload() {   
   
   //Ian D. Brooks
   
   global $db;
   $tablename = "phpbb_serverload";  //Change the table prefix if you use one other than phpbb
   
   $duration = "300";    // How many seconds load will represent.
                       // Change the time representation in overall_footer.tpl to match this

   // Delete old page counts
   $sql = "DELETE FROM $tablename WHERE time < " . (time()-$duration);
   if( !($result = $db->sql_query($sql)) )
   {
      message_die(GENERAL_ERROR, 'Could not delete Server Load entries', '', __LINE__, __FILE__, $sql);
   }
       
   // Insert the current page count
   
   $sql = "INSERT INTO $tablename (time) VALUES (" . time() . ") ";
   
        if( !($result = $db->sql_query($sql)) )
   {
      message_die(GENERAL_ERROR, 'Could not uppdate Server Load entries', '', __LINE__, __FILE__, $sql);
   }

   // Get page count (number of rows in the table)
   
   $sql = "SELECT time FROM $tablename";
   
        if( !($result = $db->sql_query($sql)) )
   {
      message_die(GENERAL_ERROR, 'Could not obtain Server Load entries', '', __LINE__, __FILE__, $sql);
   }
   
        return $db->sql_numrows($result);

} // END FUNCTION serverload


#
#-----[ OPEN]------------------------------------------
#

includes/page_tail.php

#
#-----[ FIND ]------------------------------------------
#

$admin_link = ( $userdata['user_level'] == ADMIN ) ? '<a href="' . append_sid("admin/index.$phpEx") . '">' . $lang['Admin_panel'] . '</a><br /><br />' : '';

#
#-----[ ADD BEFORE ]------------------------------------------
#

//Serverload Mod

   $server_load = serverload();
   $out_server = '<center><span class="copyright">Server Load: ';
   $out_server .= $server_load;
   $out_server .=  " page(s) served in previous 5 minutes.";

//

#
#-----[ FIND ]------------------------------------------
#

$template->pparse('overall_footer');

#
#-----[ ADD BEFORE ]------------------------------------------
#

$template->assign_vars(array(
      "SERVER_LOAD" => $out_server)
   );


#
#-----[ OPEN]------------------------------------------
#

templates/subSilver/overall_footer.php

#
#-----[ FIND ]------------------------------------------
#

</div>

#
#-----[ ADD AFTER ]------------------------------------------
#

<br />{SERVER_LOAD}

#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM
Mutluyum, biraz komedi takılıyorum! sakın kızmayın yakında geçer, sebebini ben de bilmiyorum! yeni bir aşk da bulmuş değilim!
Kullanıcı avatarı
sabri ünal
Üye
Üye
 
İleti: 1325
Kayıt: 27.10.2005, 15:49
Konum: İstanbul

İleti webci 02.09.2006, 15:22

bu tip modlar siteyi yavaşlatıyor mu?
webci
Üye
Üye
 
İleti: 274
Kayıt: 10.11.2005, 15:33

İleti nardantaneler 03.09.2006, 08:13

tabi ki yavaşlatır.
Kullanıcı avatarı
nardantaneler
Üye
Üye
 
İleti: 27
Kayıt: 12.04.2006, 19:16

İleti purple 03.09.2006, 12:17

Ne kadar çok sql sorgusu o kadar yavaş sayfa yüklenmesi.
Kullanıcı avatarı
purple
Üye
Üye
 
İleti: 618
Kayıt: 06.03.2006, 22:40

İleti GMabed 03.09.2006, 12:30

bencede gereksiz bir mod :)
Kullanıcı avatarı
GMabed
Üye
Üye
 
İleti: 141
Kayıt: 02.04.2006, 14:51
Konum: Kocaeli

İleti webci 03.09.2006, 13:24

peki daha başka hangi modlar yavaşlatır?Yani bu moda benzer?
webci
Üye
Üye
 
İleti: 274
Kayıt: 10.11.2005, 15:33


Duyurular & Güncellemeler



Kimler çevrimiçi

Bu forumu görüntüleyenler: Kayıtlı kullanıcı yok ve 0 misafir

cron