[BUG&QUESTION] hookFrontendBeforeOutput doesn't get called and clear cache hook

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • canibozz
    New Member
    • Sep 2018
    • 1
    • 5.3.x

    [BUG&QUESTION] hookFrontendBeforeOutput doesn't get called and clear cache hook

    Hello,

    I've two concerns.

    1. I am currently writing a Plug-In which needs the hookFrontendBeforeOutput Hook.
    Sadly this hook isn't called when the maintenance mode is on and you're not logged in.

    Is this on purpose? Is there a workaround?


    2. Why don't you have hooks while before & after clearing the cache? Here a little hotfix which i needed:
    Original:
    // ###################### Start clear cache ########################
    if ($_REQUEST['do'] == 'clear_cache') {
    print_cp_header($vbphrase['clear_system_cache']);
    vB_Cache::resetCache(); vB::getDatastore()->resetCache();
    print_cp_message($vbphrase['cache_cleared']);
    }
    Modified:
    // ###################### Start clear cache ########################
    if ($_REQUEST['do'] == 'clear_cache') {
    $api = Api_InterfaceAbstract::instance(); $api->invokeHook('hookBeforeClearCache', "");
    print_cp_header($vbphrase['clear_system_cache']);
    vB_Cache::resetCache(); vB::getDatastore()->resetCache();
    print_cp_message($vbphrase['cache_cleared']); $api->invokeHook('hookAfterClearCache', "");
    }
    (PS: Didnt use PHP shortcode because it doesn't expand.)


    Cheers,
    C
  • Wayne Luke
    vBulletin Technical Support Lead
    • Aug 2000
    • 73976

    #2
    #1 I can't really comment on #1 because I have no idea what you're doing with the details provided. Many things don't work when Maintenance mode is on simply because it is Maintenance Mode and means you shouldn't be writing to the database if it can be avoided. Maintenance Mode should be used to create database backups and for upgrading the software. It isn't a development mode.

    #2 Those aren't valid hook calls.

    You should be calling vB::getHooks()->invoke() after your hooks are initialized in your custom package. If you would like to have us add the hooks, please create a hook request here:
    https://tracker.vbulletin.com/vbulletin5. Click the "Report an Issue" button at the top of the screen.
    Translations provided by Google.

    Wayne Luke
    The Rabid Badger - a vBulletin Cloud demonstration site.
    vBulletin 5 API

    Comment

    • glennrocksvb
      Former vBulletin Developer
      • Mar 2011
      • 4011
      • 5.7.X

      #3
      What are you trying to do in the hookFrontendBeforeOutput hook?

      Flag Icon Postbit Insert GIPHY Impersonate User BETTER INITIALS AVATAR Better Name Card Quote Selected Text Bookmark Posts Post Footer Translate Stop Links in Posts +MORE!

      Comment

      widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
      Working...