/* Get last task run date(s). Array keys are app names, values are
* last run timestamps. Special key '_once' contains list of
* ONCE tasks previously run. */
- $lasttask_pref = $this->_backend->getLastTasks();
+ $lasttask_pref = $this->_backend->getLastRun();
/* Create time objects for today's date and last task run date. */
$cur_date = getdate();
!in_array($classname, $lasttask_pref['_once'])) {
$addtask = true;
$lasttask_pref['_once'][] = $classname;
- $GLOBALS['prefs']->setValue('last_logintasks', serialize($lasttask_pref));
+ $this->_backend->setLastRun($lasttask_pref);
}
break;
}
/* If we've successfully completed every task in the list (or skipped
* it), record now as the last time login tasks was run. */
if ($this->_tasklist->isDone()) {
- $lasttasks = unserialize($GLOBALS['prefs']->getValue('last_logintasks'));
- $lasttasks[$this->_app] = time();
- if (($this->_app != 'horde') &&
- !isset($_SESSION['horde_logintasks']['horde'])) {
- $lasttasks['horde'] = time();
- $_SESSION['horde_logintasks']['horde'] = true;
- }
- $GLOBALS['prefs']->setValue('last_logintasks', serialize($lasttasks));
+ $this->_backend->markLastRun();
/* This will prevent us from having to store the entire tasklist
* object in the session, while still indicating we have
*
* @return array The information about the last time the tasks were run.
*/
- abstract public function getLastTasks();
+ abstract public function getLastRun();
+
+ /**
+ * Store the information about the last time the tasks were run.
+ *
+ * @param array $last The information about the last time the tasks were run.
+ *
+ * @return NULL
+ */
+ abstract public function setLastRun(array $last);
+
+ /**
+ * Mark the current time as time the login tasks were run for the last time.
+ *
+ * @return NULL
+ */
+ abstract public function markLastRun();
/**
* Return the URL of the login tasks view.
*
* @return array The information about the last time the tasks were run.
*/
- public function getLastTasks()
+ public function getLastRun()
{
$lasttask_pref = @unserialize($this->_prefs->getValue('last_logintasks'));
if (!is_array($lasttask_pref)) {
}
/**
+ * Store the information about the last time the tasks were run.
+ *
+ * @param array $last The information about the last time the tasks were run.
+ *
+ * @return NULL
+ */
+ public function setLastRun(array $last)
+ {
+ $this->_prefs->setValue('last_logintasks', serialize($last));
+ }
+
+ /**
+ * Mark the current time as time the login tasks were run for the last time.
+ *
+ * @return NULL
+ */
+ public function markLastRun()
+ {
+ $lasttasks = $this->getLastRun();
+ $lasttasks[$this->_app] = time();
+ if (($this->_app != 'horde') &&
+ !isset($_SESSION['horde_logintasks']['horde'])) {
+ $lasttasks['horde'] = time();
+ $_SESSION['horde_logintasks']['horde'] = true;
+ }
+ $GLOBALS['prefs']->setValue('last_logintasks', serialize($lasttasks));
+ }
+
+ /**
* Return the URL of the login tasks view.
*
* @return string The URL of the login tasks view