1<?php
2/**
3 * The Horde_LoginTasks_Backend:: class provides the specific backend providing
4 * the dependencies of the LoginTasks system (e.g. preferences, session storage,
5 * redirection facilites, shutdown management etc.)
6 *
7 * Copyright 2001-2016 Horde LLC (http://www.horde.org/)
8 *
9 * See the enclosed file COPYING for license information (LGPL). If you
10 * did not receive this file, see http://www.horde.org/licenses/lgpl21.
11 *
12 * @author   Michael Slusarz <slusarz@horde.org>
13 * @author   Gunnar Wrobel <wrobel@pardus.de>
14 * @category Horde
15 * @license  http://www.horde.org/licenses/lgpl21 LGPL 2.1
16 * @package  LoginTasks
17 */
18abstract class Horde_LoginTasks_Backend
19{
20    /**
21     * Retrieve a cached tasklist if it exists.
22     *
23     * @return Horde_LoginTasks_Tasklist|boolean  The cached task list or
24     *                                            false if no task list was
25     *                                            cached.
26     */
27    abstract public function getTasklistFromCache();
28
29    /**
30     * Store a login tasklist in the cache.
31     *
32     * @param Horde_LoginTasks_Tasklist|boolean $tasklist  The tasklist to be
33     *                                                     stored.
34     */
35    abstract public function storeTasklistInCache($tasklist);
36
37    /**
38     * Get the class names of the task classes that need to be performed.
39     *
40     * @return array  An array of class names.
41     */
42    abstract public function getTasks();
43
44    /**
45     * Get the information about the last time the tasks were run. Array keys
46     * are app names, values are last run timestamps. Special key '_once'
47     * contains list of ONCE tasks previously run.
48     *
49     * @return array  The information about the last time the tasks were run.
50     */
51    abstract public function getLastRun();
52
53    /**
54     * Store the information about the last time the tasks were run.
55     *
56     * @param array $last  The information about the last time the tasks were
57     *                     run.
58     */
59    abstract public function setLastRun(array $last);
60
61    /**
62     * Mark the current time as time the login tasks were run for the last
63     * time.
64     */
65    abstract public function markLastRun();
66
67    /**
68     * Redirect to the given URL.
69     *
70     * @param string $url  The URL to redirect to.
71     */
72    abstract public function redirect($url);
73
74    /**
75     * Return the URL of the login tasks view.
76     *
77     * @return string  The URL of the login tasks view
78     */
79    abstract public function getLoginTasksUrl();
80}
81