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

Fixed Addon Cronjob is being called, even when the addon is deactivated

Discussion in 'Resolved Bug Reports' started by xf_phantom, Jun 17, 2013.

  1. xf_phantom

    xf_phantom Well-Known Member

    XenForo is calling addon cronjobs from all addons.It doesn't evaluate if the addon is deactivated, which icausing many bad side effects
     
  2. xf_phantom

    xf_phantom Well-Known Member

    Hmm, ATM i'm not sure if i reported this too early
    It seems that there's another problem because xf is checking if addon.active = 1
    PHP:
    public function getMinimumNextRunTime()
        {
            
    $nextRunTime $this->_getDb()->fetchOne('
                SELECT MIN(entry.next_run)
                FROM xf_cron_entry AS entry
                LEFT JOIN xf_addon AS addon ON (entry.addon_id = addon.addon_id)
                WHERE entry.active = 1
                    AND (addon.addon_id IS NULL OR addon.active = 1)
            '
    );
            if (
    $nextRunTime)
            {
                return 
    $nextRunTime;
            }
            else
            {
                return 
    0x7FFFFFFF// no entries to run, return time well in future
            
    }
        }
    &&
    PHP:
        public function getCronEntriesToRun($currentTime null)
        {
            
    $currentTime = ($currentTime === null XenForo_Application::$time $currentTime);

            return 
    $this->fetchAllKeyed('
                SELECT entry.*
                FROM xf_cron_entry AS entry
                LEFT JOIN xf_addon AS addon ON (entry.addon_id = addon.addon_id)
                WHERE entry.active = 1
                    AND entry.next_run < ?
                    AND (addon.addon_id IS NULL OR addon.active = 1)
                ORDER BY entry.next_run
            '
    'entry_id'$currentTime);
        }
     
  3. xf_phantom

    xf_phantom Well-Known Member

    Ok, i've found the problem

    Another admin called the cronjobs from the acp / cronlist.

    The "problem" is, that the list shows ALL available crons, even if the addon is disabled.
    And when you call it, it doesn't check if the addon is active



    What about showing a confirmation message before the cron is being called, if the addon or cron are deactivated?
     
    Last edited: Jun 17, 2013
  4. Mike

    Mike XenForo Developer Staff Member

    Seems to make sense to just block manual running of crons for add-ons that aren't enabled.
     
    xf_phantom likes this.

Share This Page