/** * Callback used in the core features page when the post-by-email feature * is enabled or disabled. * * @package Admin * @param bool $value the "new" status of the post-by-email * (true => enabled, false => disabled) */ function postbyemail_toggle_callback($value) { require_once SUBSDIR . '/ScheduledTasks.subs.php'; toggleTaskStatusByName('maillist_fetch_IMAP', $value); // Should we calculate next trigger? if ($value) { calculateNextTrigger('maillist_fetch_IMAP'); } }
/** * Initializes the mentions settings admin page. * * - Accessed from ?action=admin;area=featuresettings;sa=mentions; */ public function action_mentionSettings_display() { global $context, $scripturl, $modSettings; // Initialize the form $this->_initMentionSettingsForm(); // Initialize it with our settings $config_vars = $this->_mentionSettings->settings(); // Saving the settings? if (isset($_GET['save'])) { checkSession(); if (!isset($_POST['mentions_dont_notify_rlike']) && !empty($modSettings['mentions_dont_notify_rlike']) || isset($_POST['mentions_dont_notify_rlike']) && $_POST['mentions_dont_notify_rlike'] != $modSettings['mentions_dont_notify_rlike']) { require_once SUBSDIR . '/Mentions.subs.php'; toggleMentionsVisibility('rlike', empty($_POST['mentions_dont_notify_rlike'])); } if (!isset($_POST['mentions_buddy']) && !empty($modSettings['mentions_buddy']) || isset($_POST['mentions_buddy']) && $_POST['mentions_buddy'] != $modSettings['mentions_buddy']) { require_once SUBSDIR . '/Mentions.subs.php'; toggleMentionsVisibility('buddy', !empty($_POST['mentions_buddy'])); } // If mentions are enabled, the related task should be enabled as well, otherwise should be disabled. require_once SUBSDIR . '/ScheduledTasks.subs.php'; toggleTaskStatusByName('user_access_mentions', !empty($_POST['mentions_enabled'])); Settings_Form::save_db($config_vars); redirectexit('action=admin;area=featuresettings;sa=mention'); } // Prepare the settings for display $context['post_url'] = $scripturl . '?action=admin;area=featuresettings;save;sa=mention'; Settings_Form::prepare_db($config_vars); }
/** * Run a scheduled task now * * What it does: * - From time to time it may be necessary to fire a scheduled task ASAP * - This function sets the scheduled task to be called before any other one * * @param string $task the name of a scheduled task */ function scheduleTaskImmediate($task) { global $modSettings; if (!isset($modSettings['scheduleTaskImmediate'])) { $scheduleTaskImmediate = array(); } else { $scheduleTaskImmediate = unserialize($modSettings['scheduleTaskImmediate']); } // If it has not been scheduled, the do so now if (!isset($scheduleTaskImmediate[$task])) { $scheduleTaskImmediate[$task] = 0; updateSettings(array('scheduleTaskImmediate' => serialize($scheduleTaskImmediate))); require_once SUBSDIR . '/ScheduledTasks.subs.php'; // Ensure the task is on toggleTaskStatusByName($task, true); // Before trying to run it **NOW** :P calculateNextTrigger($task, true); } }