vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.7 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=228)
-   -   Forum Home Enhancements - Random Thread (https://vborg.vbsupport.ru/showthread.php?t=193061)

GWLiaR 10-07-2008 10:00 PM

Random Thread
 
English:
What Does it?:This hack will add to Navbar Random Thread :).

Install:
+Go to admin Cp
+Plugin System -> Manage Products -> [Add/Import Product] -> Select
+'product-random_thread.xml' then İmport.

Find Navbar:
Code:

        <if condition="$show['pmwarning']"><div><strong><phrase 1="$vbphrase[pmpercent_nav_compiled]">$vbphrase[your_pm_box_is_x_full]</phrase></strong></div></if>
Add Below:
Code:

$rthread
Mark As Installed

GWLiaR 10-08-2008 11:41 AM

*Reserved

TilkiBey 10-08-2008 11:50 AM

pls renew ur ss with supporting file types (jpg,jpeg etc.)

bmp desteklenmiyor inferno,direkt g?z?kmesi daha hoş olur demo g?r?nt?n?n;)

GWLiaR 10-08-2008 11:53 AM

Quote:

Originally Posted by TilkiBey (Post 1640219)
pls renew ur ss with supporting file types (jpg,jpeg etc.)

bmp desteklenmiyor inferno,direkt g?z?kmesi daha hoş olur demo g?r?nt?n?n;)

D?zelttim..
Added JPEG Demo :)

NAZIA 10-08-2008 02:14 PM

reserved...

noppid 10-08-2008 02:36 PM

That query will/could bring a forum to it's knees running every page view.

Code:

mysql> explain Select * From thread order by rand() DESC LIMIT 1
    -> ;
+----+-------------+--------+------+---------------+------+---------+------+------+---------------------------------+
| id | select_type | table  | type | possible_keys | key  | key_len | ref  | rows | Extra                          |
+----+-------------+--------+------+---------------+------+---------+------+------+---------------------------------+
|  1 | SIMPLE      | thread | ALL  | NULL          | NULL | NULL    | NULL | 6026 | Using temporary; Using filesort |
+----+-------------+--------+------+---------------+------+---------+------+------+---------------------------------+
1 row in set (0.03 sec)

As you can see, a full table walk.

Here's a better way.

Code:

60*60 == 3600
3600*24 == 14400
14400*30 == 432000
1223479602 - 432000 == 1223047602

mysql> explain Select * From thread where dateline >= 1223047602 order by dateline DESC limit 1;
+----+-------------+--------+-------+---------------+----------+---------+------+------+-------------+
| id | select_type | table  | type  | possible_keys | key      | key_len | ref  | rows | Extra      |
+----+-------------+--------+-------+---------------+----------+---------+------+------+-------------+
|  1 | SIMPLE      | thread | range | dateline      | dateline | 4      | NULL |  104 | Using where |
+----+-------------+--------+-------+---------------+----------+---------+------+------+-------------+
1 row in set (0.00 sec)

See the difference? Gotta use those indexes. Rand() is bad.

ahtapod 10-08-2008 05:44 PM

It runs wrong.

When used, it transfers users to wrong thread. :(

MrZeropage 10-08-2008 06:51 PM

Attention - this does not take care of hidden forums or forumpermissions, means it could also bring up a thread from your internal hidden administrator-forum...

noppid 10-08-2008 06:55 PM

Add "AND forumid not in(1,2,3)" to the query.

This hack needs a lot of work.

yousellstuff 10-12-2008 11:05 PM

whats the point of this

tirol07 10-17-2008 09:40 PM

Quote:

Originally Posted by GWLiaR (Post 1640220)
D?zelttim..
Added JPEG Demo :)

bi sorum olacaktı arkadaşım bunu vb sayfası hari? g?sterme imanımız varmi?

Mesela vbulletin haric bir sayfada 5 rastgele konu g?stermek istiyorum! m?mk?nm? bu?

GWLiaR 10-18-2008 03:54 AM

Quote:

Originally Posted by tirol07 (Post 1647317)
bi sorum olacaktı arkadaşım bunu vb sayfası hari? g?sterme imanımız varmi?

Mesela vbulletin haric bir sayfada 5 rastgele konu g?stermek istiyorum! m?mk?nm? bu?

Evet M?mk?n...Mysal ile Yapabilirsin:)

tirol07 10-19-2008 08:09 PM

Quote:

Originally Posted by GWLiaR (Post 1647446)
Evet M?mk?n...Mysal ile Yapabilirsin:)

Peki nasıl yaplıyor bu mysal dediğin?

Detaylı anlatabilirmisin sana zahmet, ?ok uğraştım yapamadım?

KrisP 11-14-2009 12:31 PM

Quote:

Originally Posted by ahtapod (Post 1640507)
It runs wrong.

When used, it transfers users to wrong thread. :(

In plugin change

Quote:

$ryaz.="<a href=showthread.php?p=$veri[threadid]>$baslik</a>";
to

Quote:

$ryaz.="<a href=showthread.php?t=$veri[threadid]>$baslik</a>";

Brandon Sheley 06-06-2010 04:19 AM

It would be handy if this worked properly, I could use it.
Does anyone know of a 3.8 version?

PS... I think the rules say you have to speak in english, or at least have an english version.

valdet 08-12-2011 11:21 AM

Sorry to bump this thread.

Quote:

Originally Posted by noppid (Post 1640311)
That query will/could bring a forum to it's knees running every page view.

Code:

mysql> explain Select * From thread order by rand() DESC LIMIT 1
    -> ;
+----+-------------+--------+------+---------------+------+---------+------+------+---------------------------------+
| id | select_type | table  | type | possible_keys | key  | key_len | ref  | rows | Extra                          |
+----+-------------+--------+------+---------------+------+---------+------+------+---------------------------------+
|  1 | SIMPLE      | thread | ALL  | NULL          | NULL | NULL    | NULL | 6026 | Using temporary; Using filesort |
+----+-------------+--------+------+---------------+------+---------+------+------+---------------------------------+
1 row in set (0.03 sec)

As you can see, a full table walk.

Here's a better way.

Code:

60*60 == 3600
3600*24 == 14400
14400*30 == 432000
1223479602 - 432000 == 1223047602

mysql> explain Select * From thread where dateline >= 1223047602 order by dateline DESC limit 1;
+----+-------------+--------+-------+---------------+----------+---------+------+------+-------------+
| id | select_type | table  | type  | possible_keys | key      | key_len | ref  | rows | Extra      |
+----+-------------+--------+-------+---------------+----------+---------+------+------+-------------+
|  1 | SIMPLE      | thread | range | dateline      | dateline | 4      | NULL |  104 | Using where |
+----+-------------+--------+-------+---------------+----------+---------+------+------+-------------+
1 row in set (0.00 sec)

See the difference? Gotta use those indexes. Rand() is bad.

Can you please let me know how would I optimize this query so it doesn't overload the database as much as with rand() function.

Also how to add the limitations so it does not opens threads from private forums?

Thanks


All times are GMT. The time now is 05:23 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01241 seconds
  • Memory Usage 1,760KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (6)bbcode_code_printable
  • (8)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (16)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete