vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   How do I automatically turn on/off specific forums at a set time? (https://vborg.vbsupport.ru/showthread.php?t=197143)

Lynne 11-25-2008 03:40 PM

No, I am not ReCom. I just thought I would put out some comments to try to help because it looked like there was a path wrong somewhere along the lines. But, if you think the paths are all correct, then fine.

ReCom 11-25-2008 10:04 PM

Quote:

Originally Posted by SemperFideles (Post 1672707)
I did a test run and get this error:
PHP Code:

Turn off Forum

Warning
: include_once([path]/./includes/cron/forumswitch.php?enable=0) [function.include-once]: failed to open streamNo such file or directory in [path]/admincp/cronadmin.php on line 113

Warning
: include_once() [function.include]: Failed opening '[path]/./includes/cron/forumswitch.php?enable=0' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php'in [path]/admincp/cronadmin.php on line 113

Done 


Hmmm, seels like Scheduled Tasks don't accept filenames with query string attached ...

Two alternatives:
  1. Either forget about scheduled tasks and simply invoke the forumswitch.php manually at specified time
  2. Or wrap the forumswitch.php code into a function that takes the $enable value (true/false), and then create two separate files that include the forumswitch.php and call the function with either true or false respectively. Use these separate files in the scheduled tasks.

SemperFideles 12-02-2008 03:57 AM

I ended up simplifying this:

forumswitchoff.php looks like this:
PHP Code:

<?php
$vbulletin
->db->query_read("UPDATE ".TABLE_PREFIX."forum SET options=options - 2 WHERE (options & 2) AND `forumid` IN ('111','81','33','39','105','125','84','52','75','86','51','76')");
build_forum_permissions();
?>

forumswitchon.php looks like this:
PHP Code:

<?php
$vbulletin
->db->query_read("UPDATE ".TABLE_PREFIX."forum SET options=options + 2 WHERE NOT (options & 2) AND `forumid` IN ('111','81','33','39','105','125','84','52','75','86','51','76')");
build_forum_permissions();
?>


ReCom 12-02-2008 04:28 AM

Cool. I didn't know we can do math in SQL queries :o

SemperFideles 12-02-2008 12:52 PM

The format you gave me was critical for the IN command as well as how to put a db query inside a PHP file. The format for the actual SQL query to turn a forum on or off was in the VBulletin 3.7 tricks forum at vbulletin.com. I really appreciate your help or I wouldn't have been able to do it.


All times are GMT. The time now is 03:37 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.01084 seconds
  • Memory Usage 1,735KB
  • 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
  • (3)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete