Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 09-07-2009, 10:01 AM
squishi squishi is offline
 
Join Date: May 2006
Location: Frankfurt
Posts: 282
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Reverse similar threads creation order

If you build the similar threads manually from the maintenance page, it always starts with ID number 1.
I would like to reverse the order. It should start with the latest thread and count down.

Should not be impossible. It would require an edit of the vb files, I suppose.
Any ideas?
Reply With Quote
  #2  
Old 09-07-2009, 04:06 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

The query you are looking for, I think, is in includes/functions_search.php around line 352. You can actually use the hook search_similarthreads_fulltext to add to the query - probably an ORDER BY thread.threadid DESC (I'm not sure, so try it on a test site.)
Reply With Quote
  #3  
Old 09-07-2009, 04:54 PM
squishi squishi is offline
 
Join Date: May 2006
Location: Frankfurt
Posts: 282
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

That sounded good, but the process still started with the first threads.
Reply With Quote
  #4  
Old 09-07-2009, 05:49 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ah.... I thought you meant the query when it is looking for similar threads to put in the table. But, you are looking to do it when you are rebuilding them? Did you know you can start the rebuild in the middle? misc.php?do=updatethread&startat=xxxxx . xxxxx being the threadid to start at. Then it only builds those and the ones greater than that.

If you want to change that query to go backwards, it is in admincp/misc.php, look under do=updatethread and the query that select the threads is right there and it's ordered by threadid and the where statement is threadid >=startat .
Reply With Quote
  #5  
Old 09-07-2009, 06:12 PM
squishi squishi is offline
 
Join Date: May 2006
Location: Frankfurt
Posts: 282
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I have added a DESC to the sort order of the query you mentioned, but it still started at the first thread.

PHP Code:
    $threads $db->query_read("
        SELECT threadid
        FROM " 
TABLE_PREFIX "thread
        WHERE threadid >= " 
$vbulletin->GPC['startat'] . "
        ORDER BY threadid DESC
        LIMIT " 
$vbulletin->GPC['perpage']
    ); 
Reply With Quote
  #6  
Old 09-07-2009, 06:38 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

If it is that query (you didn't verify that what you are doing rebuilding the similar threads), then I think you need to get rid of the line about where threadid >= startup. You may have to redo the lines about $finishat since it assumes you are counting up.

Exactly what are you trying to accomplish here? Perhaps there is an easier way to do this.
Reply With Quote
  #7  
Old 09-07-2009, 08:02 PM
squishi squishi is offline
 
Join Date: May 2006
Location: Frankfurt
Posts: 282
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I think we understand each other correctly now.
I am building the similar threads manually from the maintenance page in the admin backend.
The process starts at thread 3 (which is the first thread on my board).
I'd like it to start at the latest thread and then count down to the first one.
This will allow me to use the similar threads without having the automatic similar thread check enabled (which costs server resources).
Reply With Quote
  #8  
Old 09-07-2009, 08:20 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Did you see my suggestion about just adding startat=xxxx to the url to not do the similar threads from the beginning? When you do the rebuild, it automatically does xxxx threads at a time (default is 100). So, if you know that you just want to rebuild the last 10 threads, why not just do startat=(your lastest thread number - 10) ? Your alternative is to rewrite the code to go backwards (redo how $finishat is handled and redo the query), as I said.
Reply With Quote
  #9  
Old 09-08-2009, 02:49 PM
squishi squishi is offline
 
Join Date: May 2006
Location: Frankfurt
Posts: 282
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

For some reason, I cannot run the script in the browser.
I get a 404 error.
Reply With Quote
  #10  
Old 09-08-2009, 02:52 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Are you using the correct url? It's a file in the admin cp, so you need to use the correct path to that folder.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 07:34 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.07675 seconds
  • Memory Usage 2,251KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete