File: rcube_sauserprefs_storage.php

package info (click to toggle)
roundcube-plugin-sauserprefs 1.20.2%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 444 kB
  • sloc: php: 1,309; javascript: 291; makefile: 40
file content (66 lines) | stat: -rw-r--r-- 2,047 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<?php

/**
 * SAUserPrefs base storage class
 *
 * @author Philip Weir
 *
 * Copyright (C) Philip Weir
 *
 * This program is a Roundcube (https://roundcube.net) plugin.
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Roundcube. If not, see https://www.gnu.org/licenses/.
 */
abstract class rcube_sauserprefs_storage
{
    protected $config;

    /**
     * Object constructor
     *
     * @param mixed $config Roundcube config object
     */
    public function __construct($config)
    {
        $this->config = $config;
    }

    /**
     * Retrieve all SpamAssassin preferences
     *
     * @param string $user sauserprefs_global_userid
     *
     * @return array Array of preferences in format [$pref_name => $pref_value, ...]
     */
    abstract public function load_prefs($user);

    /**
     * Save new SpamAssassin preferences
     *
     * @param string $user_id      sauserprefs_userid
     * @param array  $new_prefs    Array of new preferences to be saved
     * @param array  $cur_prefs    Array of current preferences for comparison with $new_prefs (user_prefs + global_prefs)
     * @param array  $global_prefs Array of global preferences for comparison with $new_prefs
     *
     * @return bool True on success, False on error
     */
    abstract public function save_prefs($user_id, $new_prefs, $cur_prefs, $global_prefs);

    /**
     * Purge learnt Bayes data
     *
     * @param string $user_id sauserprefs_userid
     */
    abstract public function purge_bayes($user_id);
}