Birthday Mod Speed Tuning

Du hast Probleme beim Einbau oder bei der Benutzung eines Mods? In diesem Forum bist du richtig.
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.
Benutzeravatar
BraveEagle
Mitglied
Beiträge: 1884
Registriert: 16.01.2003 18:05
Wohnort: born 2 be a Paelzer
Kontaktdaten:

Birthday Mod Speed Tuning

Beitrag von BraveEagle »

Also beim Updaten des Mods bin ich auf folgenden Thread gestoßen. Da meine Index Seite sich auch sehr langsam aufbaut, will ich diese Modifikation auf jeden Fall auch einbauen. Leider zieht sich das unheimlich hin, da mein Schulenglisch nun doch schon eine ganze Zeit zurück liegt. Gibt es dazu auch einen deutschen Thread, oder gar eine fertige Anleitung (die kann auch auf englisch sein)?

Greetz BE
Benutzeravatar
BraveEagle
Mitglied
Beiträge: 1884
Registriert: 16.01.2003 18:05
Wohnort: born 2 be a Paelzer
Kontaktdaten:

Beitrag von BraveEagle »

*schieb*
Benutzeravatar
Supersonic
Mitglied
Beiträge: 162
Registriert: 16.08.2004 09:04
Kontaktdaten:

Beitrag von Supersonic »

index.php

finde

Code: Alles auswählen

// Birthday Mod, Show users with birthday 
$sql = ($board_config['birthday_check_day']) ? "SELECT user_id, username, user_birthday,user_level FROM " . USERS_TABLE. " WHERE user_birthday!=999999 ORDER BY username" :"";
if($result = $db->sql_query($sql)) 
{ 
	if (!empty($result)) 
	{ 
		$time_now = time();
		$this_year = create_date('Y', $time_now, $board_config['board_timezone']);
		$date_today = create_date('Ymd', $time_now, $board_config['board_timezone']);
		$date_forward = create_date('Ymd', $time_now+($board_config['birthday_check_day']*86400), $board_config['board_timezone']);
	      while ($birthdayrow = $db->sql_fetchrow($result))
		{ 
		      $user_birthday2 = $this_year.($user_birthday = realdate("md",$birthdayrow['user_birthday'] )); 
      		if ( $user_birthday2 < $date_today ) $user_birthday2 += 10000;
			if ( $user_birthday2 > $date_today  && $user_birthday2 <= $date_forward ) 
			{ 
				// user are having birthday within the next days
				$user_age = ( $this_year.$user_birthday < $date_today ) ? $this_year - realdate ('Y',$birthdayrow['user_birthday'])+1 : $this_year- realdate ('Y',$birthdayrow['user_birthday']); 
				switch ($birthdayrow['user_level'])
				{
					case ADMIN :
		      			$birthdayrow['username'] = '<b>' . $birthdayrow['username'] . '</b>'; 
      					$style_color = 'style="color:#' . $theme['fontcolor3'] . '"';
						break;
					case MOD :
		      			$birthdayrow['username'] = '<b>' . $birthdayrow['username'] . '</b>'; 
      					$style_color = 'style="color:#' . $theme['fontcolor2'] . '"';
						break;
					default: $style_color = '';
				}
				$birthday_week_list .= ' <a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $birthdayrow['user_id']) . '"' . $style_color .'>' . $birthdayrow['username'] . ' ('.$user_age.')</a>,'; 
			} else if ( $user_birthday2 == $date_today ) 
      		{ 
				//user have birthday today 
				$user_age = $this_year - realdate ( 'Y',$birthdayrow['user_birthday'] ); 
				switch ($birthdayrow['user_level'])
				{
					case ADMIN :
		      			$birthdayrow['username'] = '<b>' . $birthdayrow['username'] . '</b>'; 
      					$style_color = 'style="color:#' . $theme['fontcolor3'] . '"';
						break;
					case MOD :
			      		$birthdayrow['username'] = '<b>' . $birthdayrow['username'] . '</b>'; 
      					$style_color = 'style="color:#' . $theme['fontcolor2'] . '"';
						break;
					default: $style_color = '';
				}

				$birthday_today_list .= ' <a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $birthdayrow['user_id']) . '"' . $style_color .'>' . $birthdayrow['username'] . ' ('.$user_age.')</a>,'; 
		      }
			 
		}
		if ($birthday_today_list) $birthday_today_list[ strlen( $birthday_today_list)-1] = ' ';
		if ($birthday_week_list) $birthday_week_list[ strlen( $birthday_week_list)-1] = ' ';
	} 
	$db->sql_freeresult($result);
}
ersetze mit

Code: Alles auswählen

// Birthday Mod, Show users with birthday 
$cache_data_file = $phpbb_root_path."cache/index/birthday_". $board_config['board_timezone'] . ".dat"; 
if (@is_file($cache_data_file)  && empty($SID)) 
{ 
    $valid = (date('YzH',time(),0) - date('YzH',@filemtime($cache_data_file),0)<1) ? true : false; 
} else 
{ 
   $valid = false; 
} 

if ($valid ) 
{ 
   include ($cache_data_file); 
   $birthday_today_list = stripslashes($birthday_today_list); 
   $birthday_week_list = stripslashes($birthday_week_list); 
} else 
{ 
   $sql = ($board_config['birthday_check_day']) ? "SELECT user_id, username, user_birthday,user_level FROM " . USERS_TABLE. " WHERE user_birthday!=999999 ORDER BY username" :""; 
   if($result = $db->sql_query($sql)) 
   { 
      if (!empty($result)) 
      { 
         $time_now = time(); 
         $this_year = create_date('Y', $time_now, $board_config['board_timezone']); 
         $date_today = create_date('Ymd', $time_now, $board_config['board_timezone']); 
         $date_forward = create_date('Ymd', $time_now+($board_config['birthday_check_day']*86400), $board_config['board_timezone']); 
            while ($birthdayrow = $db->sql_fetchrow($result)) 
         { 
               $user_birthday2 = $this_year.($user_birthday = realdate("md",$birthdayrow['user_birthday'] )); 
               if ( $user_birthday2 < $date_today ) $user_birthday2 += 10000; 
            if ( $user_birthday2 > $date_today  && $user_birthday2 <= $date_forward ) 
            { 
               // user are having birthday within the next days 
               $user_age = ( $this_year.$user_birthday < $date_today ) ? $this_year - realdate ('Y',$birthdayrow['user_birthday'])+1 : $this_year- realdate ('Y',$birthdayrow['user_birthday']); 
               switch ($birthdayrow['user_level']) 
               { 
                  case ADMIN : 
                        $birthdayrow['username'] = '<b>' . $birthdayrow['username'] . '</b>'; 
                        $style_color = 'style="color:#' . $theme['fontcolor3'] . '"';break; 
                  case MOD : 
                        $birthdayrow['username'] = '<b>' . $birthdayrow['username'] . '</b>'; 
                        $style_color = 'style="color:#' . $theme['fontcolor2'] . '"';break; 
                  default: $style_color = ''; 
               } 
               $birthday_week_list .= ' <a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $birthdayrow['user_id']) . '"' . $style_color .'>' . $birthdayrow['username'] . ' ('.$user_age.')</a>,'; 
            } else if ( $user_birthday2 == $date_today ) 
               { 
               //user have birthday today 
               $user_age = $this_year - realdate ( 'Y',$birthdayrow['user_birthday'] ); 
               switch ($birthdayrow['user_level']) 
               { 
                  case ADMIN : 
                        $birthdayrow['username'] = '<b>' . $birthdayrow['username'] . '</b>'; 
                        $style_color = 'style="color:#' . $theme['fontcolor3'] . '"';break; 
                  case MOD : 
                        $birthdayrow['username'] = '<b>' . $birthdayrow['username'] . '</b>'; 
                        $style_color = 'style="color:#' . $theme['fontcolor2'] . '"';break; 
                  default: $style_color = ''; 
               } 
               $birthday_today_list .= ' <a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $birthdayrow['user_id']) . '"' . $style_color .'>' . $birthdayrow['username'] . ' ('.$user_age.')</a>,'; 
               } 
         } 
         if ($birthday_today_list) $birthday_today_list[ strlen( $birthday_today_list)-1] = ' '; 
         if ($birthday_week_list) $birthday_week_list[ strlen( $birthday_week_list)-1] = ' '; 
      } 
      $db->sql_freeresult($result); 
      if (empty($SID)) 
      { 
         // stores the data set in a cache file 
         $data = "<?php\n"; 
         $data .='$birthday_today_list = \'' . addslashes($birthday_today_list) . ".';\n"; 
         $data .='$birthday_week_list = \''.addslashes($birthday_week_list) . ".';\n?>"; 
         $fp = fopen( $cache_data_file, "w" ); 
         fwrite($fp, $data); 
         fclose($fp); 
      } 
   } 
} 
;)
Habt ihr einen Mod übersetzt oder sucht ihr eine deutsche Version eines Mods?
http://www.phpbbmods.de
Signaturen dürfen maximal 3 Zeilen lang sein
Benutzeravatar
BraveEagle
Mitglied
Beiträge: 1884
Registriert: 16.01.2003 18:05
Wohnort: born 2 be a Paelzer
Kontaktdaten:

Beitrag von BraveEagle »

und was ist damit:

Code: Alles auswählen

[FIND]
 $valid = (time()- @filemtime($cache_data_file)<600) ? true : false;

[REPLACE]
 $valid = (date('YzH',time()) - date('YzH',@filemtime($cache_data_file))<1) ? true : false;

Code: Alles auswählen

[FIND]
// stores the data set in a cache file
$data = "<?php\n";
$data .='$birthday_today_list = ';
$data .=var_export($birthday_today_list,true);
$data .=";\n";
$data .='$birthday_week_list = ';
$data .=var_export($birthday_week_list,true);
$data .=";\n?>";
$fp = fopen( $cache_data_file, "w" );
fwrite($fp, $data);
fclose($fp);

[REPLACE WITH]
if ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_sid']))
{
   // stores the data set in a cache file
   $data = "<?php\n";
   $data .='$birthday_today_list = \'' . $birthday_today_list . "';\n";
   $data .='$birthday_week_list = \''.$birthday_week_list . "';\n?>";
   $fp = fopen( $cache_data_file, "w" );
   fwrite($fp, $data);
   fclose($fp);
} 

Code: Alles auswählen

[FIND]
include ($cache_data_file);
[AFTER, ADD]

$birthday_today_list = stripslashes($birthday_today_list);
$birthday_week_list = stripslashes($birthday_week_list);

[FIND]
$data .='$birthday_today_list = \'' . addslashes($birthday_today_list) . "';\n";
$data .='$birthday_week_list = \''.addslashes($birthday_week_list) . "';\n?>";

[REPLACE WITH]
$data .='$birthday_today_list = \'' . $birthday_today_list . "';\n";
$data .='$birthday_week_list = \''. $birthday_week_list . "';\n?>";

Code: Alles auswählen

[FIND]
// stores the data set in a cache file
$data = "<?php\n";
$data .='$birthday_today_list = ';
$data .=var_export($birthday_today_list,true);
$data .=";\n";
$data .='$birthday_week_list = ';
$data .=var_export($birthday_week_list,true);
$data .=";\n?>";
$fp = fopen( $cache_data_file, "w" );
fwrite($fp, $data);
fclose($fp);

[REPLACE WITH]
if ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_sid']))
{
   // stores the data set in a cache file
   $data = "<?php\n";
   $data .='$birthday_today_list = \'' . $birthday_today_list . "';\n";
   $data .='$birthday_week_list = \''.$birthday_week_list . "';\n?>";
   $fp = fopen( $cache_data_file, "w" );
   fwrite($fp, $data);
   fclose($fp);
}
 
Benutzeravatar
AmigaLink
Mitglied
Beiträge: 1417
Registriert: 09.06.2003 21:56
Wohnort: NRW
Kontaktdaten:

Beitrag von AmigaLink »

@ BraveEagle

Vergiss den ganzen kram und schau mal hier rein.
Installier den Code aus dem erstem Posting und ersetz dabei

Code: Alles auswählen

$cache_bday_update = 86400; // 24 hours cache timeout. change it to whatever you want 
$cache_bday_file = $phpbb_root_path."cache/bday/bday_". $board_config['board_timezone'] . ".php"; 
if (@file_exists($cache_bday_file)) 
{ 
   $last_update_time = @filemtime($cache_bday_file); 

   $valid = ((time() - $cache_bday_update) < $last_update_time) ? true : false; 

   if (((time() - $newest_userdata['user_regdate']) <= (time() - $last_update_time)) || ($last_update_time <= $board_config['time_today'])) 
   { 
      $valid = false; 
   } 
} 
else 
{ 
   $valid = false; 
} 
gegen

Code: Alles auswählen

$cache_bday_file = $phpbb_root_path . "cache/bday/bday_" . $board_config['board_timezone'] . ".php"; 
if (@file_exists($cache_bday_file)) 
{ 
   $sql = "SELECT user_regdate 
      FROM " . USERS_TABLE . " 
      WHERE user_id <> " . ANONYMOUS . " AND user_active = 1 
      ORDER BY user_id DESC 
      LIMIT 1"; 
   $result = $db->sql_query($sql); 
   while ($row = mysql_fetch_array($result)) 
   { 
      $newest_regdate = $row['user_regdate']; 
   } 

   $last_update_time = @filemtime($cache_bday_file); 
   $valid = (((date('Yz',time()) - date('Yz',$last_update_time))<1) && ((time() - $newest_regdate) > (time() - $last_update_time) )) ? true : false;  
} 
else 
{ 
   $valid = false; 
} 
// EDIT
Eine zusammenfassung (mit mehreren eventualitäten) findest du hier auf meiner Seite. :)
Benutzeravatar
BraveEagle
Mitglied
Beiträge: 1884
Registriert: 16.01.2003 18:05
Wohnort: born 2 be a Paelzer
Kontaktdaten:

Beitrag von BraveEagle »

mönsch das artet ja nun echt in denkarbeit aus:

also

-1 Beitrag ist gemacht
-AmigaLink den Code gibt es bei mir so nicht (den ich ersetzen soll)
-bei dem addon von easygo gibts auch probleme:

das hier

Code: Alles auswählen

#
#-----[ FIND ]------------------------------------------------
#
      if ($birthday_today_list) $birthday_today_list[ strlen( $birthday_today_list)-1] = ' ';
      if ($birthday_week_list) $birthday_week_list[ strlen( $birthday_week_list)-1] = ' ';
   }
   $db->sql_freeresult($result);
} 
sieht bei mir z.B. so aus:

Code: Alles auswählen

if ($birthday_today_list) $birthday_today_list[ strlen( $birthday_today_list)-1] = ' ';
         if ($birthday_week_list) $birthday_week_list[ strlen( $birthday_week_list)-1] = ' ';
      }
      $db->sql_freeresult($result);
      if (empty($SID))
      {
         // stores the data set in a cache file
         $data = "<?php\n";
         $data .='$birthday_today_list = \'' . addslashes($birthday_today_list) . ".';\n";
         $data .='$birthday_week_list = \''.addslashes($birthday_week_list) . ".';\n?>";
         $fp = fopen( $cache_data_file, "w" );
         fwrite($fp, $data);
         fclose($fp);
      }
   }
} 
Benutzeravatar
easygo
Mitglied
Beiträge: 2170
Registriert: 03.09.2004 13:45
Kontaktdaten:

Beitrag von easygo »

BraveEagle hat geschrieben:-bei dem addon von easygo gibts auch probleme:

das hier

Code: Alles auswählen

#
#-----[ FIND ]------------------------------------------------
#
      if ($birthday_today_list) $birthday_today_list[ strlen( $birthday_today_list)-1] = ' ';
      if ($birthday_week_list) $birthday_week_list[ strlen( $birthday_week_list)-1] = ' ';
   }
   $db->sql_freeresult($result);
} 
sieht bei mir z.B. so aus:

Code: Alles auswählen

if ($birthday_today_list) $birthday_today_list[ strlen( $birthday_today_list)-1] = ' ';
         if ($birthday_week_list) $birthday_week_list[ strlen( $birthday_week_list)-1] = ' ';
      }
      $db->sql_freeresult($result);
      if (empty($SID))
      {
         // stores the data set in a cache file
         $data = "<?php\n";
         $data .='$birthday_today_list = \'' . addslashes($birthday_today_list) . ".';\n";
         $data .='$birthday_week_list = \''.addslashes($birthday_week_list) . ".';\n?>";
         $fp = fopen( $cache_data_file, "w" );
         fwrite($fp, $data);
         fclose($fp);
      }
   }
} 
Na du bist ja lustig @ BraveEagle :roll:

Machst also lieber deinen eigenen Thread auf anstatt mitzuhelfen, wie?

Na egal! Was du da miteinander vergleichst, passt so freilich net,
wenn du schon Niels Cache Variante verbaut hast.

Was bei dir so aussieht, ersetz einfach durch...

Code: Alles auswählen

			if ($birthday_today_list)
			{
				$birthday_today_list[ strlen( $birthday_today_list)-1] = ' ';
			}
			if ($birthday_week_list)
			{
				$birthday_week_list[ strlen( $birthday_week_list)-1] = ' ';
			}
		}
		$db->sql_freeresult($result);

		if($fp = fopen( $cache_bday_file, "w" ))
		{
			// stores the data set in a cache file
			$bday = "<?php\n";
			$bday .='$birthday_today_list = \'' . addslashes($birthday_today_list) . "';\n";
			$bday .='$birthday_week_list = \'' . addslashes($birthday_week_list) . "';\n?>";
			fwrite($fp, $bday);
			fclose($fp);
			@chmod($cache_bday_file, 0777);
		}
	}
}
... dann passt das vielleicht auch vorn und hinten wieder zusammen.

Anyway, vielen Dank auch für deine Mithilfe im Beta-Test. :D easy
Benutzeravatar
BraveEagle
Mitglied
Beiträge: 1884
Registriert: 16.01.2003 18:05
Wohnort: born 2 be a Paelzer
Kontaktdaten:

Beitrag von BraveEagle »

easygo hat geschrieben: Na du bist ja lustig @ BraveEagle :roll:

Machst also lieber deinen eigenen Thread auf anstatt mitzuhelfen, wie?
Ich hoffe ich verstehe dein Beitrag falsch (Sarkasmus pur). Ich habe doch extra im 1. Post gefragt, ob es einen Deutschen Thread dazu gibt.
Da ich mein Problem dann nach Supersonics Beitrag hier gestellt habe, darf ich nicht noch bei dir posten (phpBB Knigge).

Ich werde nun in deinem Thread weiter posten (auch wenn dies normal nicht erlaubt ist)
Benutzeravatar
easygo
Mitglied
Beiträge: 2170
Registriert: 03.09.2004 13:45
Kontaktdaten:

Beitrag von easygo »

Also... die Frage, wer hier gegen welche Knigge verstoßen hat,
wäre im Zweifelsfall ganz einfach zu erklären...

Gib in die Suche "Birthday" ein und schon legen sich deine Zweifel.

Da bin ich mir ganz sicher. :D easy
Benutzeravatar
BraveEagle
Mitglied
Beiträge: 1884
Registriert: 16.01.2003 18:05
Wohnort: born 2 be a Paelzer
Kontaktdaten:

Beitrag von BraveEagle »

k komm lassen wir das hier :wink:
Antworten

Zurück zu „phpBB 2.0: Mod Support“