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

Cron Help (To use a cron?)

Discussion in 'XenForo Development Discussions' started by Robust, Oct 2, 2015.

  1. Robust

    Robust Well-Known Member

    So I want to have a delayed alerts system where a user is reminded to come back and look over their thread after X configurable time.

    I was thinking the most efficient way to do it is this:
    • During thread creation if the thread is in the right forum, set a value in the dataregistry saying the alert needs to be set, with the thread ID and the time the alert is due (like update an array or something)
    • A cron runs every 4 hours and checks this dataregistry value to see if anything needs to be done. If it does, it sends the alerts out and removes the value from the DR.
    Is this the most efficient way of doing this?
     
    sami simo likes this.
  2. Daniel Hood

    Daniel Hood Well-Known Member

    I think if you're going to add it to a table on creation and everything you may as well use the deferred system instead. You can set the time to run for each one.
     
  3. Robust

    Robust Well-Known Member

    Any documentation on the deferred system available?
     
  4. Daniel Hood

    Daniel Hood Well-Known Member

    Look at these files:
    • /library/XenForo/Application.php - search for "function defer("
    • /library/XenForo/Deferred/Abstract.php
     
    Robust likes this.

Share This Page