vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.0 Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=33)
-   -   Auto close thread after x days. (https://vborg.vbsupport.ru/showthread.php?t=74764)

trafix 01-20-2005 10:00 PM

Auto close thread after x days.
 
Requested by Skyline_GT

This is a simple script that will close all threads where the last post is 30 days or older

Edited script with KirbyDE's code

I got it this time :) ... and tested and works

Tnx :)

only 1 variable to edit here .... default is 30 days but you can change it to whatever you want ;)

Please click Install

Andreas 01-20-2005 11:45 PM

Seems to be complicated, and might/will issue a lot of UPDATEs

I think this could also be done in 1 line ;)

trafix 01-20-2005 11:51 PM

Sorry if i steped on you toes KirbyDE

if updates are required ... its just the code

Andreas 01-21-2005 12:03 AM

Quote:

Originally Posted by trafix
if updates are required ... its just the code

I don't understand this, sorry.
What do you mean?

I just wanted to point out that this can be done with just one UPDATE, instead of querying the table for outdated threads to get the threadis and then issue a query for each thread to close it.

Imagine the script is run for the first time and there are 10.000 outdated threads.
This would mean 10.001 queries are being executed ...

cinq 01-21-2005 12:04 AM

I think Kirby was refering to this easier way

trafix 01-21-2005 12:11 AM

hmm ... i see where you are comming from ....

can i use your 1 liner?

Andreas 01-21-2005 12:12 AM

Sure :)

I must admit that I didn't test it, but as the query is pretty simple I am 99,75% sure that it does the job.

trafix 01-21-2005 12:20 AM

Tnx Co-authour ;)

Andreas 01-21-2005 12:28 AM

I fear that this version will close no threads ...

Let's say TIMENOW is 1106274310

Then $deletedate will be 1103682310

So (TIMENOW - $deletedate) will be 2592000, which is the timestamp of 1970-01-31 01:00:00.

I don't think you'll find threads that old anywhere ;)

trafix 01-21-2005 12:40 AM

oh crap ... i forgot about that the line should be

PHP Code:

$DB_site->query("UPDATE " TABLE_PREFIX "thread SET open=0 WHERE lastpost <= $deletedate"
); 



All times are GMT. The time now is 02:42 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.00983 seconds
  • Memory Usage 1,729KB
  • 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
  • (1)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete