vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Quick help with PHP. (PLEEEAAASSE!!) (https://vborg.vbsupport.ru/showthread.php?t=104143)

NoRespect 01-01-2006 01:52 AM

Quick help with PHP. (PLEEEAAASSE!!)
 
I am wanting to run a script every so often, to move any threads with more than 1 reply from certain forums to another. Currently I have redirect.php under /includes/cron, but when I run it, nothing happens.

Here is the code:

PHP Code:

<?php

$db
->query("UPDATE " TABLE_PREFIX "thread SET forumid = 2 WHERE forumid = 11 AND replycount >= 1");
$db->query("UPDATE " TABLE_PREFIX "thread SET forumid = 2 WHERE forumid = 9 AND replycount >= 1");
$db->query("UPDATE " TABLE_PREFIX "thread SET forumid = 2 WHERE forumid = 10 AND replycount >= 1");
$db->query("UPDATE " TABLE_PREFIX "thread SET forumid = 2 WHERE forumid = 8 AND replycount >= 1");
$db->query("UPDATE " TABLE_PREFIX "thread SET forumid = 2 WHERE forumid = 12 AND replycount >= 1");

require_once(
'./includes/functions_databuild.php');
build_forum_counters(8);
build_forum_counters(9);
build_forum_counters(10);
build_forum_counters(11);
build_forum_counters(12);
build_forum_counters(2);

log_cron_action('Threads with replies moved from Forum 11, 9, 10, 8, and 12 to Forum 2'$nextitem);

?>


Help? :ermm:

Paul M 01-01-2006 02:05 AM

Is that all that's in the file ?

"$db->query" should probably be "$vbulletin->db->query_write"

:)

NoRespect 01-01-2006 02:06 AM

Quote:

Originally Posted by Paul M
Is that all that's in the file ?

"$db->query" should probably be "$vbulletin->db->query_write"

:)

Yes. Should there be more? :speechless:

IT WORKED! A million thanks. :)

Paul M 01-01-2006 02:13 AM

Not absolutely necessary, but it's normal to include a check like this at the top of a cron file ;

PHP Code:

// Database connection ?
if (!is_object($vbulletin->db)) exit; 

Quote:

Originally Posted by NoRespect
IT WORKED!

Well yes, do try not to seem too surprised ;) :p

jugo 01-01-2006 02:17 AM

LOL...hey thanks PAUL...this answered a question for me as well.

WOWSERS!!!! lol


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

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.01114 seconds
  • Memory Usage 1,728KB
  • 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
  • (2)bbcode_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (5)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