Smiley Categories MOD 2.0.4

Cachet rechenintensive Vorgänge bei der Darstellung von Beiträgen. Dadurch wird die Performance des phpBB stabilisiert und teilweise sogar erheblich verbessert.

Moderator: Supporter

Smiley Categories MOD 2.0.4

Beitragvon *wuerzi* » 14. Apr 2007 11:54

Moin, :P

ich hab da momentan etwas leichte Koordinationschwierigkeiten bei einem Upgrade von Smilie Categories 2.0.4. :(

Ich soll da einen Teil in der viewtopic bearbeiten, der schon vom CPS angefasst wird, bzw. eine Stelle ausgeklammert und durch einen anderen Teil des CPS ersetzt wurde. Naja... Zusätzlich habe ich noch in diesem Abschnitt drin, daß die Signatur begrenzt wird. :D :roll:

Also bin ich wieder mal planlos. :P

Hier mal der zu änderende Teil:

Code: Alles auswählen
#
#-----[ OPEN ]-------------------------------------------------
#
viewtopic.php

#
#-----[ FIND ]-------------------------------------------------
#
   if ( $board_config['allow_smilies'] )
   {
      if ( $postrow[$i]['user_allowsmile'] && $user_sig != '' )
      {
         $user_sig = smilies_pass($user_sig);
      }

      if ( $postrow[$i]['enable_smilies'] )
      {
         $message = smilies_pass($message);
      }
   }

#
#-----[ REPLACE WITH ]-----------------------------------------
#
   if( $board_config['allow_smilies'] )
   {
      if( $postrow[$i]['user_allowsmile'] && $user_sig != '' )
      {
         $user_sig = smilies_pass($user_sig, $forum_id);
      }

      if( $postrow[$i]['enable_smilies'] )
      {
         $message = smilies_pass($message, $forum_id);
      }
   }
   else
   {
      if( $board_config['smilie_removal1'] )
      {
         $message = smilies_code_removal($message);
      }
   }


Ich zeige dir mal den Abschnitt meiner viewtopic.php bevor ich dran rumgepfuscht habe:

Code: Alles auswählen
   if ( $board_config['allow_smilies'] )
   {
      if ( $postrow[$i]['user_allowsmile'] && $user_sig != '' && $board_config['sig_allow_smilies'] != 0 )
      {
         $user_sig = smilies_pass($user_sig);
      }

      (!$parsed || !$board_config['enable_post_cache']) ? (($postrow[$i]['enable_smilies']) ? $message = smilies_pass($message) : '') : ''; // Cache Posts
/*      if ( $postrow[$i]['enable_smilies'] )
      {
         $message = smilies_pass($message);
      }*/
   }
 
  // Cache Posts
   if (!$parsed && $board_config['enable_post_cache'] && ($postrow[$i]['enable_bbcode'] || $postrow[$i]['enable_html']) && !$postrow[$i]['dont_cache'] && !$forum_topic_data['topic_cache_lock'])
   {
      $cstyle = ($userdata['session_logged_in'] && $userdata['user_style'] != $board_config['default_style'] && $board_config['cache_each_template']) ? $userdata['user_style'].'_' : '';
      $cachefile = 'cache/posts/'.$cstyle.'post_'.$postrow[$i]['post_id'].'.gz';
      $handle = @fopen($phpbb_root_path.$cachefile, 'w');
      @flock($handle, LOCK_EX);
      $packed = gzdeflate($message, 9);
      $cf_size = @fwrite($handle, $packed);
      @flock($handle, LOCK_UN);
      @fclose($handle);
      @chmod($phpbb_root_path.$cachefile, 0666);

      if ($cf_size)
      {
         if ($cf_size > $board_config['min_post_cache_size'])
         {
            $parsed = 1;
            $sql = "UPDATE " . POSTS_TABLE . "
               SET parsed = 1, cache_file_md5 = '".md5_file($cachefile)."'
               WHERE post_id = ".$postrow[$i]['post_id'];
            if(!$result = $db->sql_query($sql))
            {
               message_die(GENERAL_ERROR, 'Could not update parse info', '', __LINE__, __FILE__, $sql);
            }
         }
         else
         {
            $parsed = 0;
            $postrow[$i]['dont_cache'] = 1;
            foreach (glob($phpbb_root_path.'cache/posts/*post_'.$postrow[$i]['post_id'].'.gz') as $cachefile)
            {
               @unlink($cachefile);
            }
            $sql = "UPDATE " . POSTS_TABLE . "
               SET parsed = 0, dont_cache = 1, cache_file_md5 = NULL
               WHERE post_id = ".$postrow[$i]['post_id'];
            if(!$result = $db->sql_query($sql))
            {
               message_die(GENERAL_ERROR, 'Could not update parse info', '', __LINE__, __FILE__, $sql);
            }
         }
      }
      else if ($postrow[$i]['parsed'])
      {
         $parsed = 0;
         $sql = "UPDATE " . POSTS_TABLE . "
            SET parsed = 0, cache_file_md5 = NULL
            WHERE post_id = ".$postrow[$i]['post_id'];
         if(!$result = $db->sql_query($sql))
         {
            message_die(GENERAL_ERROR, 'Could not update parse info', '', __LINE__, __FILE__, $sql);
         }
      }
      $postrow[$i]['parsed'] = $parsed;
   }
   else if ( $forum_topic_data['topic_cache_lock'] )
   {
      $parsed = 0;
      $postrow[$i]['dont_cache'] = 1;
      $sql = "UPDATE " . POSTS_TABLE . "
         SET parsed = 0, dont_cache = 1, cache_file_md5 = NULL
         WHERE post_id = ".$postrow[$i]['post_id'];
      if(!$result = $db->sql_query($sql))
      {
         message_die(GENERAL_ERROR, 'Could not update parse info', '', __LINE__, __FILE__, $sql);
      }
      $postrow[$i]['parsed'] = $parsed;
   }
   if ($board_config['enable_post_cache'])
   {
      $parse_status = ($parsed) ? $CPS_Indicator['cached'] : (($postrow[$i]['dont_cache']) ? $CPS_Indicator['dont_cache'] : ((!$postrow[$i]['enable_bbcode'] && !$postrow[$i]['enable_html']) ? $CPS_Indicator['not_cached'] : $CPS_Indicator['error']));
      $cps_img = (!$forum_topic_data['topic_cache_lock']) ? '<a href="modcp.'.$phpEx.'?'.POST_CPS_MANAGE_URL.'=recycle&amp;'.POST_POST_URL.'='.$postrow[$i]['post_id'].'&amp;'.POST_TOPIC_URL.'='.$postrow[$i]['topic_id'].'&amp;sid='.$userdata['session_id'].'"><img src="'.$images['icon_cache_recycle'].'" alt="'.$lang['CPS_recycle'].'" title="'.$lang['CPS_recycle'].'" border="0" /></a>' : '';
      $cps_img .= ($parsed) ? ' <a href="modcp.'.$phpEx.'?'.POST_CPS_MANAGE_URL.'=deactivate&amp;'.POST_POST_URL.'='.$postrow[$i]['post_id'].'&amp;'.POST_TOPIC_URL.'='.$postrow[$i]['topic_id'].'&amp;sid='.$userdata['session_id'].'"><img src="'.$images['icon_cache_deactivate'].'" alt="'.$lang['CPS_dont_cache'].'" title="'.$lang['CPS_dont_cache'].'" border="0" /></a>' : '';
   } else {
      $parse_status = ($postrow[$i]['parsed']) ? $CPS_Indicator['off_but_cached'] : $CPS_Indicator['off'] ;
      $cps_img = ($postrow[$i]['parsed'] && $userdata['user_level'] == ADMIN) ? '<a href="modcp.'.$phpEx.'?'.POST_CPS_MANAGE_URL.'=delete&amp;'.POST_POST_URL.'='.$postrow[$i]['post_id'].'&amp;'.POST_TOPIC_URL.'='.$postrow[$i]['topic_id'].'&amp;sid='.$userdata['session_id'].'"><img src="'.$images['icon_cache_delete'].'" alt="'.$lang['CPS_delete'].'" title="'.$lang['CPS_delete'].'" border="0" /></a>' : '';
   }
// Cache Posts
 


Und jetzt nach meinem Kunstwerk:

Code: Alles auswählen
   if ( $board_config['allow_smilies'] )
   {
      if ( $postrow[$i]['user_allowsmile'] && $user_sig != '' && $board_config['sig_allow_smilies'] != 0 )
      {
         $user_sig = smilies_pass($user_sig, $forum_id);
      }

      (!$parsed || !$board_config['enable_post_cache']) ? (($postrow[$i]['enable_smilies']) ? $message = smilies_pass($message, $forum_id) : '') : ''; // Cache Posts
/*      if ( $postrow[$i]['enable_smilies'] )
      {
         $message = smilies_pass($message);
      }*/
   }
 
     else
   {
      if( $board_config['smilie_removal1'] )
      {
         $message = smilies_code_removal($message);
      }
   }
 
  // Cache Posts
   if (!$parsed && $board_config['enable_post_cache'] && ($postrow[$i]['enable_bbcode'] || $postrow[$i]['enable_html']) && !$postrow[$i]['dont_cache'] && !$forum_topic_data['topic_cache_lock'])
   {
      $cstyle = ($userdata['session_logged_in'] && $userdata['user_style'] != $board_config['default_style'] && $board_config['cache_each_template']) ? $userdata['user_style'].'_' : '';
      $cachefile = 'cache/posts/'.$cstyle.'post_'.$postrow[$i]['post_id'].'.gz';
      $handle = @fopen($phpbb_root_path.$cachefile, 'w');
      @flock($handle, LOCK_EX);
      $packed = gzdeflate($message, 9);
      $cf_size = @fwrite($handle, $packed);
      @flock($handle, LOCK_UN);
      @fclose($handle);
      @chmod($phpbb_root_path.$cachefile, 0666);

      if ($cf_size)
      {
         if ($cf_size > $board_config['min_post_cache_size'])
         {
            $parsed = 1;
            $sql = "UPDATE " . POSTS_TABLE . "
               SET parsed = 1, cache_file_md5 = '".md5_file($cachefile)."'
               WHERE post_id = ".$postrow[$i]['post_id'];
            if(!$result = $db->sql_query($sql))
            {
               message_die(GENERAL_ERROR, 'Could not update parse info', '', __LINE__, __FILE__, $sql);
            }
         }
         else
         {
            $parsed = 0;
            $postrow[$i]['dont_cache'] = 1;
            foreach (glob($phpbb_root_path.'cache/posts/*post_'.$postrow[$i]['post_id'].'.gz') as $cachefile)
            {
               @unlink($cachefile);
            }
            $sql = "UPDATE " . POSTS_TABLE . "
               SET parsed = 0, dont_cache = 1, cache_file_md5 = NULL
               WHERE post_id = ".$postrow[$i]['post_id'];
            if(!$result = $db->sql_query($sql))
            {
               message_die(GENERAL_ERROR, 'Could not update parse info', '', __LINE__, __FILE__, $sql);
            }
         }
      }
      else if ($postrow[$i]['parsed'])
      {
         $parsed = 0;
         $sql = "UPDATE " . POSTS_TABLE . "
            SET parsed = 0, cache_file_md5 = NULL
            WHERE post_id = ".$postrow[$i]['post_id'];
         if(!$result = $db->sql_query($sql))
         {
            message_die(GENERAL_ERROR, 'Could not update parse info', '', __LINE__, __FILE__, $sql);
         }
      }
      $postrow[$i]['parsed'] = $parsed;
   }
   else if ( $forum_topic_data['topic_cache_lock'] )
   {
      $parsed = 0;
      $postrow[$i]['dont_cache'] = 1;
      $sql = "UPDATE " . POSTS_TABLE . "
         SET parsed = 0, dont_cache = 1, cache_file_md5 = NULL
         WHERE post_id = ".$postrow[$i]['post_id'];
      if(!$result = $db->sql_query($sql))
      {
         message_die(GENERAL_ERROR, 'Could not update parse info', '', __LINE__, __FILE__, $sql);
      }
      $postrow[$i]['parsed'] = $parsed;
   }
   if ($board_config['enable_post_cache'])
   {
      $parse_status = ($parsed) ? $CPS_Indicator['cached'] : (($postrow[$i]['dont_cache']) ? $CPS_Indicator['dont_cache'] : ((!$postrow[$i]['enable_bbcode'] && !$postrow[$i]['enable_html']) ? $CPS_Indicator['not_cached'] : $CPS_Indicator['error']));
      $cps_img = (!$forum_topic_data['topic_cache_lock']) ? '<a href="modcp.'.$phpEx.'?'.POST_CPS_MANAGE_URL.'=recycle&amp;'.POST_POST_URL.'='.$postrow[$i]['post_id'].'&amp;'.POST_TOPIC_URL.'='.$postrow[$i]['topic_id'].'&amp;sid='.$userdata['session_id'].'"><img src="'.$images['icon_cache_recycle'].'" alt="'.$lang['CPS_recycle'].'" title="'.$lang['CPS_recycle'].'" border="0" /></a>' : '';
      $cps_img .= ($parsed) ? ' <a href="modcp.'.$phpEx.'?'.POST_CPS_MANAGE_URL.'=deactivate&amp;'.POST_POST_URL.'='.$postrow[$i]['post_id'].'&amp;'.POST_TOPIC_URL.'='.$postrow[$i]['topic_id'].'&amp;sid='.$userdata['session_id'].'"><img src="'.$images['icon_cache_deactivate'].'" alt="'.$lang['CPS_dont_cache'].'" title="'.$lang['CPS_dont_cache'].'" border="0" /></a>' : '';
   } else {
      $parse_status = ($postrow[$i]['parsed']) ? $CPS_Indicator['off_but_cached'] : $CPS_Indicator['off'] ;
      $cps_img = ($postrow[$i]['parsed'] && $userdata['user_level'] == ADMIN) ? '<a href="modcp.'.$phpEx.'?'.POST_CPS_MANAGE_URL.'=delete&amp;'.POST_POST_URL.'='.$postrow[$i]['post_id'].'&amp;'.POST_TOPIC_URL.'='.$postrow[$i]['topic_id'].'&amp;sid='.$userdata['session_id'].'"><img src="'.$images['icon_cache_delete'].'" alt="'.$lang['CPS_delete'].'" title="'.$lang['CPS_delete'].'" border="0" /></a>' : '';
   }
// Cache Posts


Also optisch ist mir die viewtopic ja sehr gut gelungen find ich und ich krieg nicht mal ne Fehlermeldung. :P

Aber ob das so richtig eingebaut ist, entzieht sich meiner Kenntnis. Will ja nicht, daß das CPS dadurch irgendwie ausgehebelt wird. :(

Ich hoffe du kannst mir irgendwie helfen. ;)

Danke schon mal. ;)
*wuerzi*
 
Beiträge: 22
Registriert: 1. Feb 2007 20:33
Wohnort: Würzburg

Beitragvon AmigaLink » 15. Apr 2007 07:40

Das hast du vollkommen richtig gemacht. :)
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

Beitragvon *wuerzi* » 15. Apr 2007 08:52

:shock: Ja Schmarrn...

:shock: Kann ja gar nicht sein...

Bild Juhu... Bild

Danke dir vielmals und noch nen schönen Sonntag. Bild
*wuerzi*
 
Beiträge: 22
Registriert: 1. Feb 2007 20:33
Wohnort: Würzburg

Beitragvon AmigaLink » 15. Apr 2007 09:23

:lol:
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

Beitragvon Fantasie » 9. Mai 2007 14:52

Hallo, habe auch den Cache Post Mode eingebaut und wollte nun den Smiley Categories MOD 2.04 einbauen und habe das selbe Problem mit der viewtropic, wie mache ich das jetzt?
Hier der auszug der orginal viewtropic:
Code: Alles auswählen
if ( $board_config['allow_smilies'] )
   {
      if ( $postrow[$i]['user_allowsmile'] && $user_sig != '' )
      {
         $user_sig = smilies_pass($user_sig);
      }

      (!$parsed || !$board_config['enable_post_cache']) ? (($postrow[$i]['enable_smilies']) ? $message = smilies_pass($message) : '') : ''; // Cache Posts
/*      if ( $postrow[$i]['enable_smilies'] )
      {
         $message = smilies_pass($message);
      }*/
   }
// Cache Posts

und das soll rein:
Code: Alles auswählen
#-----[ OPEN ]-------------------------------------------------
#
viewtopic.php

#
#-----[ FIND ]-------------------------------------------------
#
   if ( $board_config['allow_smilies'] )
   {
      if ( $postrow[$i]['user_allowsmile'] && $user_sig != '' )
      {
         $user_sig = smilies_pass($user_sig);
      }

      if ( $postrow[$i]['enable_smilies'] )
      {
         $message = smilies_pass($message);
      }
   }

#
#-----[ REPLACE WITH ]-----------------------------------------
#
   if( $board_config['allow_smilies'] )
   {
      if( $postrow[$i]['user_allowsmile'] && $user_sig != '' )
      {
         $user_sig = smilies_pass($user_sig, $forum_id);
      }

      if( $postrow[$i]['enable_smilies'] )
      {
         $message = smilies_pass($message, $forum_id);
      }
   }
   else
   {
      if( $board_config['smilie_removal1'] )
      {
         $message = smilies_code_removal($message);
      }
   }
Fantasie
 
Beiträge: 4
Registriert: 9. Mai 2007 14:41
Wohnort: @home

Beitragvon AmigaLink » 9. Mai 2007 15:17

Steht doch bereits im erstem Beitrag. :?
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

Beitragvon Fantasie » 9. Mai 2007 15:25

Sorry für doppel Post, hatte zu spät gesehen das hier Erledigt steht, daher habe ich einen neuen Therad aufgemacht.
Nun zum Problem, also einfach das einfügen?:
Code: Alles auswählen
   if ( $board_config['allow_smilies'] ) 
   { 
      if ( $postrow[$i]['user_allowsmile'] && $user_sig != '' && $board_config['sig_allow_smilies'] != 0 ) 
      { 
         $user_sig = smilies_pass($user_sig, $forum_id); 
      } 

      (!$parsed || !$board_config['enable_post_cache']) ? (($postrow[$i]['enable_smilies']) ? $message = smilies_pass($message, $forum_id) : '') : ''; // Cache Posts 
/*      if ( $postrow[$i]['enable_smilies'] ) 
      { 
         $message = smilies_pass($message); 
      }*/ 
   } 
   
     else 
   { 
      if( $board_config['smilie_removal1'] ) 
      { 
         $message = smilies_code_removal($message); 
      } 
   } 
   
  // Cache Posts 
Fantasie
 
Beiträge: 4
Registriert: 9. Mai 2007 14:41
Wohnort: @home

Beitragvon AmigaLink » 9. Mai 2007 15:47

Jepp :)
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

Beitragvon Fantasie » 9. Mai 2007 15:54

OK, Danke habe es gerade installiert, funktioniert. :D
Fantasie
 
Beiträge: 4
Registriert: 9. Mai 2007 14:41
Wohnort: @home


Zurück zu Cache Post System



Wer ist online?

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

cron