Birthday MOD im 2.0.8

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.
Antworten
baschi
Mitglied
Beiträge: 13
Registriert: 07.01.2004 11:23
Wohnort: Hamburg

Birthday MOD im 2.0.8

Beitrag von baschi »

Moin,

ich habe gerade in mein frisch installiertes 2.0.8 den Birthday MOD in der Version 1.5.4 eingebaut!

Der Codeteil für die index.php bremst das komplette Forum aus!

Hat jmd ne Ahnung voran es liegen könnte?

Code: Alles auswählen

#
#-----[ BEFORE, ADD ]-----------------------------------------
#
// 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))
		{ 
usleep(2);
		      $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);
}
Benutzeravatar
Markus67
Ehrenadmin
Beiträge: 28346
Registriert: 12.01.2004 16:02
Wohnort: Neuss
Kontaktdaten:

Beitrag von Markus67 »

hi bashi ...

was bedeutet denn er bremst das forum aus ?

bei mir läuft der mod ohne jegliche probleme auch an der
performance konnte ich keinen unterschied feststellen ...

markus
baschi
Mitglied
Beiträge: 13
Registriert: 07.01.2004 11:23
Wohnort: Hamburg

Beitrag von baschi »

In meiner 2.0.8 Version dauert der Aufruf der index.php fast 15 Sekunden!
baschi
Mitglied
Beiträge: 13
Registriert: 07.01.2004 11:23
Wohnort: Hamburg

Beitrag von baschi »

Die SQL Abfrage habe ich jetzt mal gegen eine aus einer älteren Version des Birthday MODs getauscht:

Code: Alles auswählen

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

Warum auch immer...!
Antworten

Zurück zu „phpBB 2.0: Mod Support“