Перейти к содержимому


Фотография

Неверно отображается статистика форума

Форумы IBResource

Лучший Ответ dimitry, 27 Ноябрь 2015 - 21:09

Долго не обращал внимания на эту свою ошибку, тут решил посмотреть и выяснил, что виной всему были неправильные установки параметров полей таблицы ibf_stats в БД:

Должно быть так:

CREATE TABLE IF NOT EXISTS `ibf_stats` (
  `TOTAL_REPLIES` int(10) NOT NULL DEFAULT '0',
  `TOTAL_TOPICS` int(10) NOT NULL DEFAULT '0',
  `LAST_MEM_NAME` varchar(32) DEFAULT NULL,
  `LAST_MEM_ID` mediumint(8) NOT NULL DEFAULT '0',
  `MOST_DATE` int(10) DEFAULT NULL,
  `MOST_COUNT` int(10) DEFAULT '0',
  `MEM_COUNT` mediumint(8) NOT NULL DEFAULT '0'
) ENGINE=MyISAM DEFAULT CHARSET=cp1251;

Так вот, каким-то чудным образом было:

CREATE TABLE IF NOT EXISTS `ibf_stats` (
  `TOTAL_REPLIES` int(10) DEFAULT '0',
  `TOTAL_TOPICS` int(10) DEFAULT '0',
  `LAST_MEM_NAME` varchar(32) DEFAULT NULL,
  `LAST_MEM_ID` mediumint(8) DEFAULT '0',
  `MOST_DATE` int(10) DEFAULT NULL,
  `MOST_COUNT` int(10) DEFAULT '0',
  `MEM_COUNT` mediumint(8) DEFAULT '0'
) ENGINE=MyISAM DEFAULT CHARSET=cp1251;

, т.е. везде было NULL - ДА!

 

После этого ресинхронизировал (Пересчитал) статистику через АЦ

 

Также решил убрать сведения о статистике

 

Больше всего тем создал:
Больше всего сообщений у:
Рекорд посещаемости форума - , зафиксирован -

вниз на панель статистики:

skin_boards.php:

 

Найти в functions_WelcomePanel:

{$ibforums->lang['top_starter']}: <a href="{$ibforums->base_url}showuser={$data['tt_id']}">{$data['tt_name']}</a> [{$data['tt_num']}]<br />
			{$ibforums->lang['top_poster']}: <a href="{$ibforums->base_url}showuser={$data['tp_id']}">{$data['tp_name']}</a> [{$data['tp_num']}]<br />

и удалить его оттуда

 

Найти:

function ShowStats($text) {
global $ibforums;
return <<<EOF
		   <tr>
		     <td class='pformstrip' colspan='2'>{$ibforums->lang['board_stats']}</td>
		   </tr>
		   <tr>
			 <td class='row2' width='5%' valign='middle'><{F_STATS}></td>
			 <td class='row4' width="95%" align='left'>$text<br />
		   </tr>
EOF;
}

заменить на:

function ShowStats($text, $data="") {
global $ibforums, $stats;
return <<<EOF
           <tr>
             <td class='pformstrip' colspan='2'>{$ibforums->lang['board_stats']}</td>
           </tr>
           <tr>
             <td class='row2' width='5%' valign='middle'><{F_STATS}></td>
             <td class='row4' width="95%" align='left'>{$ibforums->lang['top_starter']}: <a href="{$ibforums->base_url}showuser={$data['tt_id']}">{$data['tt_name']}</a> [{$data['tt_num']}]<br />
            {$ibforums->lang['top_poster']}: <a href="{$ibforums->base_url}showuser={$data['tp_id']}">{$data['tp_name']}</a> [{$data['tp_num']}]<br />$text<br />
{$ibforums->lang['most_online']}</td>
           </tr>
EOF;
}



Открыть Boards.php

 

Найти:

	//*********************************************/
		// Add in show stats
		//*********************************************/
		
		
		if ($ibforums->vars['show_totals'])
		{
		
			$DB->query("SELECT * FROM ibf_stats");
			$stats = $DB->fetch_row();
			
			// Update the most active count if needed
			
			if ($active['TOTAL'] > $stats['MOST_COUNT'])
			{
				$DB->query("UPDATE ibf_stats SET MOST_DATE='".time()."', MOST_COUNT='".$active[TOTAL]."'");
				$stats['MOST_COUNT'] = $active[TOTAL];
				$stats['MOST_DATE']  = time();
			}
			
			$most_time = $std->get_date( $stats['MOST_DATE'], 'LONG' );
			
			$ibforums->lang['most_online'] = str_replace( "<#NUM#>" ,   $std->do_number_format($stats['MOST_COUNT'])  , $ibforums->lang['most_online'] );
			$ibforums->lang['most_online'] = str_replace( "<#DATE#>",                   $most_time                    , $ibforums->lang['most_online'] );
			
			$total_posts = $stats['TOTAL_REPLIES'] + $stats['TOTAL_TOPICS'];
			
			$total_posts        = $std->do_number_format($total_posts);
			$stats['MEM_COUNT'] = $std->do_number_format($stats['MEM_COUNT']);
			
			$link = $ibforums->base_url."showuser=".$stats['LAST_MEM_ID'];
			
			$ibforums->lang['total_word_string'] = str_replace( "<#posts#>" , "$total_posts"          , $ibforums->lang['total_word_string'] );
			$ibforums->lang['total_word_string'] = str_replace( "<#reg#>"   , $stats['MEM_COUNT']     , $ibforums->lang['total_word_string'] );
			$ibforums->lang['total_word_string'] = str_replace( "<#mem#>"   , $stats['LAST_MEM_NAME'] , $ibforums->lang['total_word_string'] );
			$ibforums->lang['total_word_string'] = str_replace( "<#link#>"  , $link                   , $ibforums->lang['total_word_string'] );
			
			$stats_html .= $this->html->ShowStats($ibforums->lang['total_word_string']);
			
		}

Заменить на:

	//*********************************************/
		// Add in show stats
		//*********************************************/
		
		
		if ($ibforums->vars['show_totals'])
		{
		
			$DB->query("SELECT * FROM ibf_stats");
			$stats = $DB->fetch_row();
			$DB->query("SELECT `starter_id` AS id, `starter_name` AS name, COUNT(*) AS `num` FROM `ibf_topics` WHERE starter_id > 0 GROUP BY id ORDER BY num DESC LIMIT 1");
			$row = $DB->fetch_row();
			$data['tt_id'] = $row[id];
			$data['tt_name'] = $row[name];
			$data['tt_num'] = $row[num];
			
			$DB->query("SELECT `id`,`name`,`posts` FROM `ibf_members` WHERE 1 AND id > 0 ORDER BY `posts` DESC LIMIT 1");
			$row = $DB->fetch_row();
			$data['tp_id'] = $row[id];
			$data['tp_name'] = $row[name];
			$data['tp_num'] = $row[posts];

			// Update the most active count if needed
			
			if ($active['TOTAL'] > $stats['MOST_COUNT'])
			{
				$DB->query("UPDATE ibf_stats SET MOST_DATE='".time()."', MOST_COUNT='".$active[TOTAL]."'");
				$stats['MOST_COUNT'] = $active[TOTAL];
				$stats['MOST_DATE']  = time();
			}
			
			$most_time = $std->get_date( $stats['MOST_DATE'], 'LONG' );
			
			$ibforums->lang['most_online'] = str_replace( "<#NUM#>" ,   $std->do_number_format($stats['MOST_COUNT'])  , $ibforums->lang['most_online'] );
			$ibforums->lang['most_online'] = str_replace( "<#DATE#>",                   $most_time                    , $ibforums->lang['most_online'] );
			
			$total_posts = $stats['TOTAL_REPLIES'] + $stats['TOTAL_TOPICS'];
			
			$total_posts        = $std->do_number_format($total_posts);
			$stats['MEM_COUNT'] = $std->do_number_format($stats['MEM_COUNT']);
			
			$link = $ibforums->base_url."showuser=".$stats['LAST_MEM_ID'];
			
			$ibforums->lang['total_word_string'] = str_replace( "<#posts#>" , "$total_posts"          , $ibforums->lang['total_word_string'] );
			$ibforums->lang['total_word_string'] = str_replace( "<#reg#>"   , $stats['MEM_COUNT']     , $ibforums->lang['total_word_string'] );
			$ibforums->lang['total_word_string'] = str_replace( "<#mem#>"   , $stats['LAST_MEM_NAME'] , $ibforums->lang['total_word_string'] );
			$ibforums->lang['total_word_string'] = str_replace( "<#link#>"  , $link                   , $ibforums->lang['total_word_string'] );
			
			$stats_html .= $this->html->ShowStats($ibforums->lang['total_word_string'], $data);
			
		}

Перейти к сообщению


  • Авторизуйтесь для ответа в теме
Сообщений в теме: 6
dimitry
  • Участники
  • Cообщений: 209

Отправлено

Долго пытался найти тему с методом по исправлению этого бага, но нашел только для версий 2.1.x
На форуме 0 сообщений
Зарегистрировано 0 пользователей
Приветствуем новичка по имени
- и вот так постоянно, т.е. статистику не считает
И вверху тоже самое
Пользователей: 0 | Тем: 0 | Ответов: 0 | Всего сообщений: 0
Приветствуем новичка:
- тоже неверно
остальное все правильно считает.
Где нужно что исправить?

Master
  • Участники
  • Cообщений: 3 051
  • Город:Чебы

Отправлено

Попробуйте в админцентре выполнить пересчет статистики.
Админцентр -> настройки. На вкладке дополнительно есть пункт Пересчет и обновление. Выполните :D

dimitry
  • Участники
  • Cообщений: 209

Отправлено

Попробуйте в админцентре выполнить пересчет статистики.
Админцентр -> настройки. На вкладке дополнительно есть пункт Пересчет и обновление. Выполните

Да делал уже, не помогло.
Подозрение, что это результат установки мода mod_enhanced_topics
Там во многих местах mod_enhanced_topics exclude begin mod_enhanced_topics exclude end
Может из-за исключений этих...всяких
Смотрел boards.php skin_boards.php - вроде нет изменений, которые повлияли бы...
Если провести поиск по выражению TOTAL_REPLIES в установленном дистрибутиве, где все нормально отображается результат такой
Processing file : Z:\home\rrr.ru\www\forums\ssi.php
19.11.2003 19:15:30, 13272 bytes
Line 335 - $total_posts = $stats['TOTAL_REPLIES']+$stats['TOTAL_TOPICS'];
Line 341 - 'replies' => $stats['TOTAL_REPLIES'],
Found 2 occurrences.

Processing file : Z:\home\rrr.ru\www\forums\lang\en\lang_portal.php
28.06.2003 19:53:36, 4529 bytes
Line 102 - $lang['total_replies'] = "Replies:";
Found 1 occurrences.

Processing file : Z:\home\rrr.ru\www\forums\lang\2\lang_portal.php
11.12.2003 18:08:40, 4631 bytes
Line 102 - $lang['total_replies'] = "Îòâåòîâ:";
Found 1 occurrences.

Processing file : Z:\home\rrr.ru\www\forums\Skin\s1\skin_portal.php
07.12.2003 23:43:32, 28351 bytes
Line 565 - {$ibforums->lang['total_replies']} {$data['stats']['TOTAL_REPLIES']}, {$ibforums->lang['total_posts']} {$data['stats']['TOTAL_POSTS']}<br>
Line 565 - {$ibforums->lang['total_replies']} {$data['stats']['TOTAL_REPLIES']}, {$ibforums->lang['total_posts']} {$data['stats']['TOTAL_POSTS']}<br>
Found 2 occurrences.

Processing file : Z:\home\rrr.ru\www\forums\Skin\s1\skin_boards.php
07.12.2003 22:54:40, 12917 bytes
Line 305 - {$ibforums->lang['tot_users']}: {$data['stats']['MEM_COUNT']} | {$ibforums->lang['tot_topics']}: {$data['stats']['TOTAL_TOPICS']} | {$ibforums->lang['tot_replies']}: {$data['stats']['TOTAL_REPLIES']} | {$ibforums->lang['tot_posts']}: {$data['stats']['TOTAL_POSTS']}<br />
Found 1 occurrences.

Processing file : Z:\home\rrr.ru\www\forums\sources\Moderate.php
03.12.2003 22:39:02, 61718 bytes
Line 1575 - $DB->query("UPDATE ibf_stats SET TOTAL_REPLIES=TOTAL_REPLIES-1");
Line 1575 - $DB->query("UPDATE ibf_stats SET TOTAL_REPLIES=TOTAL_REPLIES-1");
Found 2 occurrences.

Processing file : Z:\home\rrr.ru\www\forums\sources\Profile.php
03.12.2003 21:42:38, 21322 bytes
Line 369 - $DB->query("SELECT TOTAL_TOPICS, TOTAL_REPLIES FROM ibf_stats");
Line 373 - $board_posts = $stats['TOTAL_TOPICS'] + $stats['TOTAL_REPLIES'];
Found 2 occurrences.

Processing file : Z:\home\rrr.ru\www\forums\sources\Boards.php
11.12.2003 12:47:06, 33540 bytes
Line 382 - $total_posts = $stats['TOTAL_REPLIES'] + $stats['TOTAL_TOPICS'];
Line 509 - $total_posts = $std->do_number_format($data['stats']['TOTAL_REPLIES'] + $data['stats']['TOTAL_TOPICS']);
Line 515 - $data['stats']['TOTAL_REPLIES'] = $std->do_number_format($data['stats']['TOTAL_REPLIES']);
Line 515 - $data['stats']['TOTAL_REPLIES'] = $std->do_number_format($data['stats']['TOTAL_REPLIES']);
Found 4 occurrences.

Processing file : Z:\home\rrr.ru\www\forums\sources\Portal.php
28.06.2003 19:51:00, 51220 bytes
Line 184 - $data['stats']['TOTAL_POSTS'] = $data['stats']['TOTAL_TOPICS'] + $data['stats']['TOTAL_REPLIES'];
Line 489 - $total_posts = $stats['TOTAL_REPLIES']+$stats['TOTAL_TOPICS'];
Found 2 occurrences.

Processing file : Z:\home\rrr.ru\www\forums\sources\lib\modfunctions.php
19.11.2003 19:15:30, 23559 bytes
Line 179 - $DB->query("UPDATE ibf_stats SET TOTAL_REPLIES=TOTAL_REPLIES+".$add_posts);
Line 179 - $DB->query("UPDATE ibf_stats SET TOTAL_REPLIES=TOTAL_REPLIES+".$add_posts);
Line 548 - $DB->query("UPDATE ibf_stats SET TOTAL_TOPICS=".$topics['tcount'].", TOTAL_REPLIES=".$posts);
Found 3 occurrences.

Processing file : Z:\home\rrr.ru\www\forums\sources\lib\post_q_reply_post.php
19.11.2003 19:15:30, 18497 bytes
Line 299 - $DB->query("UPDATE ibf_stats SET TOTAL_REPLIES=TOTAL_REPLIES+1");
Line 299 - $DB->query("UPDATE ibf_stats SET TOTAL_REPLIES=TOTAL_REPLIES+1");
Found 2 occurrences.

Processing file : Z:\home\rrr.ru\www\forums\sources\lib\post_reply_post.php
19.11.2003 19:15:30, 15124 bytes
Line 251 - $DB->query("UPDATE ibf_stats SET TOTAL_REPLIES=TOTAL_REPLIES+1");
Line 251 - $DB->query("UPDATE ibf_stats SET TOTAL_REPLIES=TOTAL_REPLIES+1");
Found 2 occurrences.

Processing file : Z:\home\rrr.ru\www\forums\sources\Admin\ad_forums.php
15.12.2003 15:46:44, 75025 bytes
Line 680 - $DB->query("UPDATE ibf_stats SET TOTAL_TOPICS=TOTAL_TOPICS-".$forum['topics'].", TOTAL_REPLIES=TOTAL_REPLIES-".$forum['posts']);
Line 680 - $DB->query("UPDATE ibf_stats SET TOTAL_TOPICS=TOTAL_TOPICS-".$forum['topics'].", TOTAL_REPLIES=TOTAL_REPLIES-".$forum['posts']);
Found 2 occurrences.

Processing file : Z:\home\rrr.ru\www\forums\sources\Admin\ad_index.php
15.12.2003 16:16:14, 17577 bytes
Line 161 - if ($row['TOTAL_REPLIES'] < 0) $row['TOTAL_REPLIES'] = 0;
Line 161 - if ($row['TOTAL_REPLIES'] < 0) $row['TOTAL_REPLIES'] = 0;
Line 422 - "Êîë-âî îòâåòîâ â òåìàõ" , $row['TOTAL_REPLIES']
Found 3 occurrences.

Processing file : Z:\home\rrr.ru\www\forums\sources\Admin\ad_member.php
21.11.2003 7:21:34, 97863 bytes
Line 265 - $contents = str_replace( "{total_posts}", $stats['TOTAL_TOPICS'] + $stats['TOTAL_REPLIES'] , $contents );
Found 1 occurrences.

Processing file : Z:\home\rrr.ru\www\forums\sources\Admin\ad_settings.php
15.12.2003 16:47:06, 114029 bytes
Line 868 - $stats['TOTAL_REPLIES'] = $r['posts'];
Line 869 - $stats['TOTAL_REPLIES'] < 1 ? 0 : $stats['TOTAL_REPLIES'];
Line 869 - $stats['TOTAL_REPLIES'] < 1 ? 0 : $stats['TOTAL_REPLIES'];
Line 876 - $stats['TOTAL_REPLIES'] -= $stats['TOTAL_TOPICS'];
а в скриптах, в котором баг этот со статистикой
Processing file : Z:\home\kdn.ru\www\forums\ssi.php
19.02.2004 14:34:06, 13425 bytes
Line 348 - $total_posts = $stats['TOTAL_REPLIES']+$stats['TOTAL_TOPICS'];
Line 354 - 'replies' => $stats['TOTAL_REPLIES'],
Found 2 occurrences.

Processing file : Z:\home\kdn.ru\www\forums\lang\en\lang_portal.php
28.06.2003 19:53:36, 4529 bytes
Line 102 - $lang['total_replies'] = "Replies:";
Found 1 occurrences.

Processing file : Z:\home\kdn.ru\www\forums\lang\2\lang_portal.php
11.12.2003 18:08:40, 4631 bytes
Line 102 - $lang['total_replies'] = "Îòâåòîâ:";
Found 1 occurrences.

Processing file : Z:\home\kdn.ru\www\forums\Skin\s1\skin_portal.php
07.12.2003 23:43:32, 28351 bytes
Line 565 - {$ibforums->lang['total_replies']} {$data['stats']['TOTAL_REPLIES']}, {$ibforums->lang['total_posts']} {$data['stats']['TOTAL_POSTS']}<br>
Line 565 - {$ibforums->lang['total_replies']} {$data['stats']['TOTAL_REPLIES']}, {$ibforums->lang['total_posts']} {$data['stats']['TOTAL_POSTS']}<br>
Found 2 occurrences.

Processing file : Z:\home\kdn.ru\www\forums\Skin\s1\skin_boards.php
30.10.2006 23:01:44, 14389 bytes
Line 325 - {$ibforums->lang['tot_users']}: {$data['stats']['MEM_COUNT']} | {$ibforums->lang['tot_topics']}: {$data['stats']['TOTAL_TOPICS']} | {$ibforums->lang['tot_replies']}: {$data['stats']['TOTAL_REPLIES']} | {$ibforums->lang['tot_posts']}: {$data['stats']['TOTAL_POSTS']}<br />
Found 1 occurrences.

Processing file : Z:\home\kdn.ru\www\forums\sources\Portal.php
28.06.2003 19:51:00, 51220 bytes
Line 184 - $data['stats']['TOTAL_POSTS'] = $data['stats']['TOTAL_TOPICS'] + $data['stats']['TOTAL_REPLIES'];
Line 489 - $total_posts = $stats['TOTAL_REPLIES']+$stats['TOTAL_TOPICS'];
Found 2 occurrences.

Processing file : Z:\home\kdn.ru\www\forums\sources\Moderate.php
18.10.2006 5:39:08, 91265 bytes
Line 1836 - $DB->query("UPDATE ibf_stats SET TOTAL_REPLIES=TOTAL_REPLIES-1");
Line 1836 - $DB->query("UPDATE ibf_stats SET TOTAL_REPLIES=TOTAL_REPLIES-1");
Line 2692 - $DB->query("UPDATE ibf_stats SET TOTAL_REPLIES=TOTAL_REPLIES-$idz");
Line 2692 - $DB->query("UPDATE ibf_stats SET TOTAL_REPLIES=TOTAL_REPLIES-$idz");
Line 2934 - $DB->query("UPDATE ibf_stats SET TOTAL_REPLIES=TOTAL_REPLIES+1");
Line 2934 - $DB->query("UPDATE ibf_stats SET TOTAL_REPLIES=TOTAL_REPLIES+1");
Found 6 occurrences.

Processing file : Z:\home\kdn.ru\www\forums\sources\Boards.php
23.10.2006 7:45:16, 36259 bytes
Line 394 - $total_posts = $stats['TOTAL_REPLIES'] + $stats['TOTAL_TOPICS'];
Line 521 - $total_posts = $std->do_number_format($data['stats']['TOTAL_REPLIES'] + $data['stats']['TOTAL_TOPICS']);
Line 527 - $data['stats']['TOTAL_REPLIES'] = $std->do_number_format($data['stats']['TOTAL_REPLIES']);
Line 527 - $data['stats']['TOTAL_REPLIES'] = $std->do_number_format($data['stats']['TOTAL_REPLIES']);
Found 4 occurrences.

Processing file : Z:\home\kdn.ru\www\forums\sources\Profile.php
29.10.2006 9:05:26, 25061 bytes
Line 369 - $DB->query("SELECT TOTAL_TOPICS, TOTAL_REPLIES FROM ibf_stats");
Line 373 - $board_posts = $stats['TOTAL_TOPICS'] + $stats['TOTAL_REPLIES'];
Found 2 occurrences.

Processing file : Z:\home\kdn.ru\www\forums\sources\lib\modfunctions.php
25.09.2006 2:27:18, 25809 bytes
Line 179 - $DB->query("UPDATE ibf_stats SET TOTAL_REPLIES=TOTAL_REPLIES+".$add_posts);
Line 179 - $DB->query("UPDATE ibf_stats SET TOTAL_REPLIES=TOTAL_REPLIES+".$add_posts);
Line 564 - $DB->query("UPDATE ibf_stats SET TOTAL_TOPICS=".$topics['tcount'].", TOTAL_REPLIES=".$posts);
Found 3 occurrences.

Processing file : Z:\home\kdn.ru\www\forums\sources\lib\post_q_reply_post.php
02.10.2006 17:55:16, 20623 bytes
Line 321 - $DB->query("UPDATE ibf_stats SET TOTAL_REPLIES=TOTAL_REPLIES+1");
Line 321 - $DB->query("UPDATE ibf_stats SET TOTAL_REPLIES=TOTAL_REPLIES+1");
Found 2 occurrences.

Processing file : Z:\home\kdn.ru\www\forums\sources\lib\post_reply_post.php
02.10.2006 17:55:16, 16959 bytes
Line 273 - $DB->query("UPDATE ibf_stats SET TOTAL_REPLIES=TOTAL_REPLIES+1");
Line 273 - $DB->query("UPDATE ibf_stats SET TOTAL_REPLIES=TOTAL_REPLIES+1");
Found 2 occurrences.

Processing file : Z:\home\kdn.ru\www\forums\sources\Admin\ad_index.php
21.09.2006 3:58:38, 18198 bytes
Line 161 - if ($row['TOTAL_REPLIES'] < 0) $row['TOTAL_REPLIES'] = 0;
Line 161 - if ($row['TOTAL_REPLIES'] < 0) $row['TOTAL_REPLIES'] = 0;
Line 422 - "Êîë-âî îòâåòîâ â òåìàõ" , $row['TOTAL_REPLIES']
Found 3 occurrences.

Processing file : Z:\home\kdn.ru\www\forums\sources\Admin\ad_member.php
18.10.2006 2:31:38, 141919 bytes
Line 231 - $r['TOTAL_REPLIES'] = $r['TOTAL_REPLIES'] - $postsremoved;
Line 231 - $r['TOTAL_REPLIES'] = $r['TOTAL_REPLIES'] - $postsremoved;
Line 234 - $DB->query("UPDATE ibf_stats SET TOTAL_REPLIES = ".$r['TOTAL_REPLIES']);
Line 234 - $DB->query("UPDATE ibf_stats SET TOTAL_REPLIES = ".$r['TOTAL_REPLIES']);
Line 453 - $contents = str_replace( "{total_posts}", $stats['TOTAL_TOPICS'] + $stats['TOTAL_REPLIES'] , $contents );
Found 5 occurrences.

Processing file : Z:\home\kdn.ru\www\forums\sources\Admin\ad_forums.php
21.10.2006 1:37:42, 84832 bytes
Line 692 - $DB->query("UPDATE ibf_stats SET TOTAL_TOPICS=TOTAL_TOPICS-".$forum['topics'].", TOTAL_REPLIES=TOTAL_REPLIES-".$forum['posts']);
Line 692 - $DB->query("UPDATE ibf_stats SET TOTAL_TOPICS=TOTAL_TOPICS-".$forum['topics'].", TOTAL_REPLIES=TOTAL_REPLIES-".$forum['posts']);
Found 2 occurrences.

Processing file : Z:\home\kdn.ru\www\forums\sources\Admin\ad_settings.php
30.10.2006 19:34:42, 133473 bytes
Line 768 - $stats['TOTAL_REPLIES'] = $r['posts'];
Line 769 - $stats['TOTAL_REPLIES'] < 1 ? 0 : $stats['TOTAL_REPLIES'];
Line 769 - $stats['TOTAL_REPLIES'] < 1 ? 0 : $stats['TOTAL_REPLIES'];
Line 779 - $stats['TOTAL_REPLIES'] = $r['posts'];
Line 780 - $stats['TOTAL_REPLIES'] < 1 ? 0 : $stats['TOTAL_REPLIES'];
Line 780 - $stats['TOTAL_REPLIES'] < 1 ? 0 : $stats['TOTAL_REPLIES'];
Line 787 - $stats['TOTAL_REPLIES'] -= $stats['TOTAL_TOPICS'];
Found 7 occurrences.

Processing file : Z:\home\kdn.ru\www\forums\sources\mods\enhanced_topics\CodeChange.php
17.05.2006 16:28:42, 45747 bytes
Line 731 - $stats['TOTAL_REPLIES'] = $r['posts'];
Line 732 - $stats['TOTAL_REPLIES'] < 1 ? 0 : $stats['TOTAL_REPLIES'];
Line 732 - $stats['TOTAL_REPLIES'] < 1 ? 0 : $stats['TOTAL_REPLIES'];
Found 3 occurrences.

Processing file : Z:\home\kdn.ru\www\forums\sources\mods\enhanced_topics\mod_enhanced_topics_func.php
17.05.2006 16:30:56, 23689 bytes
Line 439 - $DB->query("UPDATE ibf_stats SET TOTAL_REPLIES=TOTAL_REPLIES+1");
Line 439 - $DB->query("UPDATE ibf_stats SET TOTAL_REPLIES=TOTAL_REPLIES+1");
Found 2 occurrences.

Processing file : Z:\home\kdn.ru\www\forums\sources\mods\enhanced_topics\mod_enhanced_topics_howto.htm
17.05.2006 18:26:20, 177156 bytes
Line 1221 - &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$stats['TOTAL_REPLIES']&nbsp;=&nbsp;$r['posts'];<br />
Line 1222 - &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$stats['TOTAL_REPLIES']&nbsp;&lt;&nbsp;1&nbsp;?&nbsp;0&nbsp;:&nbsp;$stats['TOTAL_REPLIES'];<br />
Line 1222 - &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$stats['TOTAL_REPLIES']&nbsp;&lt;&nbsp;1&nbsp;?&nbsp;0&nbsp;:&nbsp;$stats['TOTAL_REPLIES'];<br />
Found 3 occurrences.
Сейчас смотрю в БД в таблицу ibf_stats нет записей вообще типа:
TOTAL_REPLIES 	TOTAL_TOPICS 	LAST_MEM_NAME 	LAST_MEM_ID 	MOST_DATE 	MOST_COUNT 	MEM_COUNT 
 	 	 	0	2	 	1	1162236573	1	1
- вот представьте себе этих записей, которые должны быть нет!!! Т.е. вообще не выводятся в базе все записи с полями.
Вот интересно, какой же запрос и где накрылся в скрипте?

Jax
  • Участники
  • Cообщений: 2 682
  • http://emuravjev.ru

Отправлено

dimitry, я советую убрать вам этот мод немедленно. Это не мод, система-разрушитель для вашего форума. Она грузит бд, как только можно и нельзя.

Не убивайте свой форум.

Song
  • Участники
  • Cообщений: 9 552
  • http://www.sysman.ru
  • Город:Кострома
  • Интересы:Программирование, плаванье

Отправлено

Jax, и чем же он грузит? Апдейтом в ibf_stats? :D

dimitry
  • Участники
  • Cообщений: 209

Отправлено   Лучший Ответ

Долго не обращал внимания на эту свою ошибку, тут решил посмотреть и выяснил, что виной всему были неправильные установки параметров полей таблицы ibf_stats в БД:

Должно быть так:

CREATE TABLE IF NOT EXISTS `ibf_stats` (
  `TOTAL_REPLIES` int(10) NOT NULL DEFAULT '0',
  `TOTAL_TOPICS` int(10) NOT NULL DEFAULT '0',
  `LAST_MEM_NAME` varchar(32) DEFAULT NULL,
  `LAST_MEM_ID` mediumint(8) NOT NULL DEFAULT '0',
  `MOST_DATE` int(10) DEFAULT NULL,
  `MOST_COUNT` int(10) DEFAULT '0',
  `MEM_COUNT` mediumint(8) NOT NULL DEFAULT '0'
) ENGINE=MyISAM DEFAULT CHARSET=cp1251;

Так вот, каким-то чудным образом было:

CREATE TABLE IF NOT EXISTS `ibf_stats` (
  `TOTAL_REPLIES` int(10) DEFAULT '0',
  `TOTAL_TOPICS` int(10) DEFAULT '0',
  `LAST_MEM_NAME` varchar(32) DEFAULT NULL,
  `LAST_MEM_ID` mediumint(8) DEFAULT '0',
  `MOST_DATE` int(10) DEFAULT NULL,
  `MOST_COUNT` int(10) DEFAULT '0',
  `MEM_COUNT` mediumint(8) DEFAULT '0'
) ENGINE=MyISAM DEFAULT CHARSET=cp1251;

, т.е. везде было NULL - ДА!

 

После этого ресинхронизировал (Пересчитал) статистику через АЦ

 

Также решил убрать сведения о статистике

 

Больше всего тем создал:
Больше всего сообщений у:
Рекорд посещаемости форума - , зафиксирован -

вниз на панель статистики:

skin_boards.php:

 

Найти в functions_WelcomePanel:

{$ibforums->lang['top_starter']}: <a href="{$ibforums->base_url}showuser={$data['tt_id']}">{$data['tt_name']}</a> [{$data['tt_num']}]<br />
			{$ibforums->lang['top_poster']}: <a href="{$ibforums->base_url}showuser={$data['tp_id']}">{$data['tp_name']}</a> [{$data['tp_num']}]<br />

и удалить его оттуда

 

Найти:

function ShowStats($text) {
global $ibforums;
return <<<EOF
		   <tr>
		     <td class='pformstrip' colspan='2'>{$ibforums->lang['board_stats']}</td>
		   </tr>
		   <tr>
			 <td class='row2' width='5%' valign='middle'><{F_STATS}></td>
			 <td class='row4' width="95%" align='left'>$text<br />
		   </tr>
EOF;
}

заменить на:

function ShowStats($text, $data="") {
global $ibforums, $stats;
return <<<EOF
           <tr>
             <td class='pformstrip' colspan='2'>{$ibforums->lang['board_stats']}</td>
           </tr>
           <tr>
             <td class='row2' width='5%' valign='middle'><{F_STATS}></td>
             <td class='row4' width="95%" align='left'>{$ibforums->lang['top_starter']}: <a href="{$ibforums->base_url}showuser={$data['tt_id']}">{$data['tt_name']}</a> [{$data['tt_num']}]<br />
            {$ibforums->lang['top_poster']}: <a href="{$ibforums->base_url}showuser={$data['tp_id']}">{$data['tp_name']}</a> [{$data['tp_num']}]<br />$text<br />
{$ibforums->lang['most_online']}</td>
           </tr>
EOF;
}



Открыть Boards.php

 

Найти:

	//*********************************************/
		// Add in show stats
		//*********************************************/
		
		
		if ($ibforums->vars['show_totals'])
		{
		
			$DB->query("SELECT * FROM ibf_stats");
			$stats = $DB->fetch_row();
			
			// Update the most active count if needed
			
			if ($active['TOTAL'] > $stats['MOST_COUNT'])
			{
				$DB->query("UPDATE ibf_stats SET MOST_DATE='".time()."', MOST_COUNT='".$active[TOTAL]."'");
				$stats['MOST_COUNT'] = $active[TOTAL];
				$stats['MOST_DATE']  = time();
			}
			
			$most_time = $std->get_date( $stats['MOST_DATE'], 'LONG' );
			
			$ibforums->lang['most_online'] = str_replace( "<#NUM#>" ,   $std->do_number_format($stats['MOST_COUNT'])  , $ibforums->lang['most_online'] );
			$ibforums->lang['most_online'] = str_replace( "<#DATE#>",                   $most_time                    , $ibforums->lang['most_online'] );
			
			$total_posts = $stats['TOTAL_REPLIES'] + $stats['TOTAL_TOPICS'];
			
			$total_posts        = $std->do_number_format($total_posts);
			$stats['MEM_COUNT'] = $std->do_number_format($stats['MEM_COUNT']);
			
			$link = $ibforums->base_url."showuser=".$stats['LAST_MEM_ID'];
			
			$ibforums->lang['total_word_string'] = str_replace( "<#posts#>" , "$total_posts"          , $ibforums->lang['total_word_string'] );
			$ibforums->lang['total_word_string'] = str_replace( "<#reg#>"   , $stats['MEM_COUNT']     , $ibforums->lang['total_word_string'] );
			$ibforums->lang['total_word_string'] = str_replace( "<#mem#>"   , $stats['LAST_MEM_NAME'] , $ibforums->lang['total_word_string'] );
			$ibforums->lang['total_word_string'] = str_replace( "<#link#>"  , $link                   , $ibforums->lang['total_word_string'] );
			
			$stats_html .= $this->html->ShowStats($ibforums->lang['total_word_string']);
			
		}

Заменить на:

	//*********************************************/
		// Add in show stats
		//*********************************************/
		
		
		if ($ibforums->vars['show_totals'])
		{
		
			$DB->query("SELECT * FROM ibf_stats");
			$stats = $DB->fetch_row();
			$DB->query("SELECT `starter_id` AS id, `starter_name` AS name, COUNT(*) AS `num` FROM `ibf_topics` WHERE starter_id > 0 GROUP BY id ORDER BY num DESC LIMIT 1");
			$row = $DB->fetch_row();
			$data['tt_id'] = $row[id];
			$data['tt_name'] = $row[name];
			$data['tt_num'] = $row[num];
			
			$DB->query("SELECT `id`,`name`,`posts` FROM `ibf_members` WHERE 1 AND id > 0 ORDER BY `posts` DESC LIMIT 1");
			$row = $DB->fetch_row();
			$data['tp_id'] = $row[id];
			$data['tp_name'] = $row[name];
			$data['tp_num'] = $row[posts];

			// Update the most active count if needed
			
			if ($active['TOTAL'] > $stats['MOST_COUNT'])
			{
				$DB->query("UPDATE ibf_stats SET MOST_DATE='".time()."', MOST_COUNT='".$active[TOTAL]."'");
				$stats['MOST_COUNT'] = $active[TOTAL];
				$stats['MOST_DATE']  = time();
			}
			
			$most_time = $std->get_date( $stats['MOST_DATE'], 'LONG' );
			
			$ibforums->lang['most_online'] = str_replace( "<#NUM#>" ,   $std->do_number_format($stats['MOST_COUNT'])  , $ibforums->lang['most_online'] );
			$ibforums->lang['most_online'] = str_replace( "<#DATE#>",                   $most_time                    , $ibforums->lang['most_online'] );
			
			$total_posts = $stats['TOTAL_REPLIES'] + $stats['TOTAL_TOPICS'];
			
			$total_posts        = $std->do_number_format($total_posts);
			$stats['MEM_COUNT'] = $std->do_number_format($stats['MEM_COUNT']);
			
			$link = $ibforums->base_url."showuser=".$stats['LAST_MEM_ID'];
			
			$ibforums->lang['total_word_string'] = str_replace( "<#posts#>" , "$total_posts"          , $ibforums->lang['total_word_string'] );
			$ibforums->lang['total_word_string'] = str_replace( "<#reg#>"   , $stats['MEM_COUNT']     , $ibforums->lang['total_word_string'] );
			$ibforums->lang['total_word_string'] = str_replace( "<#mem#>"   , $stats['LAST_MEM_NAME'] , $ibforums->lang['total_word_string'] );
			$ibforums->lang['total_word_string'] = str_replace( "<#link#>"  , $link                   , $ibforums->lang['total_word_string'] );
			
			$stats_html .= $this->html->ShowStats($ibforums->lang['total_word_string'], $data);
			
		}


Сообщение отредактировал dimitry: 27 Ноябрь 2015 - 23:04


bifidokk
  • Участники
  • Cообщений: 92

Отправлено

я бы еще в кеш это дело размещал, чтобы при каждом запросе ibf_stats не дергать






Количество пользователей, читающих эту тему: 0

0 пользователей, 0 гостей, 0 анонимных