1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Rebuild User Cache every minute

Discussion in 'XenForo Development Discussions' started by Alex Price, Dec 9, 2013.

  1. Alex Price

    Alex Price Member

    I was wondering if someone could assist me in getting something like this working.

    I am planning on changing the user's group externally through the forum's SQL database, and for it to actually change the user's group, the user cache needs to be rebuilt.

    Is there a way of making the forums rebuild the user cache every minute?

    Any help is greatly appreciated!
     
    Dan Allen likes this.
  2. Alex Price

    Alex Price Member

  3. Nobita.Kun

    Nobita.Kun Well-Known Member

    Using Cron Entry or Deferred System to rebuild cache.
     
  4. Alex Price

    Alex Price Member

    How might one do this with a Cron Entry?
     
    Dan Allen likes this.
  5. Nobita.Kun

    Nobita.Kun Well-Known Member

    You can view some examples from XenForo.
    In PHP code: ../library/XenForo/CronEntry
    In Tools: {YourBoardUrl}/admin.php?tools/-> Cron Entries Tab
     
  6. Alex Price

    Alex Price Member

    Whenever I add a cron entry with the following settings:
    [​IMG]
    I get the following error:
    [​IMG]
     
    Dan Allen likes this.
  7. Nobita.Kun

    Nobita.Kun Well-Known Member

    Your code in php have some problems. :D Check that ;)
     
  8. Alex Price

    Alex Price Member

    I am just using Xenforo's User cache rebuild, I haven't changed anything in it.
     
    Dan Allen likes this.
  9. Alex Price

    Alex Price Member

  10. Daniel Hood

    Daniel Hood Well-Known Member

    Do a file health check and make sure that file wasn't modified.
     
  11. xf_phantom

    xf_phantom Well-Known Member

    1.Your cron callback isn't valid (you can't use the cacherebuild class & methodname as cron callback;).

    2. The cacherebuild is deprecated and doestn't exist in 1.2. Are you still on 1.1.x?
     
    Last edited: Dec 12, 2013
  12. Alex Price

    Alex Price Member

    I am using 1.1.5.
     
    Dan Allen likes this.
  13. Alex Price

    Alex Price Member

    Can you suggest a setup that is valid for a cron callback that will rebuild the user cache every minute?
     
    Dan Allen likes this.
  14. Alex Price

    Alex Price Member

    Bump
     
    Dan Allen likes this.
  15. tyteen4a03

    tyteen4a03 Well-Known Member

    Don't change the user group via SQL. Use XenForo_Model_User::addUserGroupChange and removeUserGroupChange instead.
     
    Xon and xf_phantom like this.
  16. Alex Price

    Alex Price Member

    How might I do this?
     
    Dan Allen likes this.
  17. tyteen4a03

    tyteen4a03 Well-Known Member

    Does your script have access to the xF installation?
     
  18. Alex Price

    Alex Price Member

    Yes the script does. I just need a script to change the user's actual group on the forums.
     
    Dan Allen likes this.
  19. tyteen4a03

    tyteen4a03 Well-Known Member

    Then initialize a XenForo evironment and invoke the function I mentioned.
     
  20. Alex Price

    Alex Price Member

    How would I initialize a Xenforo environment?
     
    Dan Allen likes this.

Share This Page