vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   Notice Flush/add to Cache (https://vborg.vbsupport.ru/showthread.php?t=315040)

CoffeeLovesYou 10-24-2014 03:30 PM

Notice Flush/add to Cache
 
Hello,
I made a notice creator form that will easily create notices for my staff (with no HTML involved for them).
Basically, it's a HTML form that they enter the info, and it makes it into HTML for them (e.g. if they put Color #FF0000, when I pass it through the query to add the notice's phrase, it'll do <font color="#FF0000">).
I'm not comfortable sharing my code publicly, however, it works. It adds the notice to the notice table correctly, the noticecriteria table correctly, and the phrase table correctly.
Here's the problem. Notices are cached. The cache isn't flushed unless you add a notice from the ACP or modify one.

How can I flush the cache when adding a notice from my form? Or how can I add the notice they just made with my form to the cache? (whichever one is the right one).

Thanks for any help. If someone wants to help privately, I don't mind sending my code.

kh99 10-24-2014 03:38 PM

The admincp code does this when it's finished:

Code:

        // update the datastore notice cache
        require_once(DIR . '/includes/adminfunctions_notice.php');
        build_notice_datastore();

        // rebuild languages
        require_once(DIR . '/includes/adminfunctions_language.php');
        build_language();


CoffeeLovesYou 10-24-2014 03:42 PM

Quote:

Originally Posted by kh99 (Post 2519934)
The admincp code does this when it's finished:

Code:

        // update the datastore notice cache
        require_once(DIR . '/includes/adminfunctions_notice.php');
        build_notice_datastore();

        // rebuild languages
        require_once(DIR . '/includes/adminfunctions_language.php');
        build_language();


Thanks kh99.
However, I don't use the same variables used in adminfunctions_notice.php
If I remade that file with different names and changed the variables to match my own, do you think it'd work?
Would you mind if I PM'd you my code?

kh99 10-24-2014 03:56 PM

Well, the lines I posted rebuild the notice cache and the languages (because a phrase was added), so I don't think it matters what variables your code uses. Unless I'm not understanding the issue.

CoffeeLovesYou 10-24-2014 03:58 PM

That is my issue, you're right.
I tried adding that piece of code where my queries are executed, but upon submission, I received a blank, white page. I can't give you an error because error reports are off. :(
Perhaps I need to do what this person did? https://vborg.vbsupport.ru/showthread.php?t=231389
He said he needed to include fetch_js_safe_string.. how could I do that? Is that needed?

kh99 10-24-2014 06:15 PM

Quote:

Originally Posted by CoffeeLovesYou (Post 2519940)
That is my issue, you're right.
I tried adding that piece of code where my queries are executed, but upon submission, I received a blank, white page. I can't give you an error because error reports are off. :(
Perhaps I need to do what this person did? https://vborg.vbsupport.ru/showthread.php?t=231389
He said he needed to include fetch_js_safe_string.. how could I do that? Is that needed?

Yeah, that's probably it. So what you'd do is add this:
Code:

require_once(DIR . '/includes/adminfunctions.php');
before the code I posted above.


All times are GMT. The time now is 01:08 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.01040 seconds
  • Memory Usage 1,723KB
  • 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_code_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (6)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