Line | |
---|
1 | <?php |
---|
2 | defined('PHPWG_ROOT_PATH') or die('Hacking attempt!'); |
---|
3 | |
---|
4 | class comments_blacklist_maintain extends PluginMaintain |
---|
5 | { |
---|
6 | private $default_conf = array( |
---|
7 | 'action' => 'reject', |
---|
8 | ); |
---|
9 | |
---|
10 | private $file; |
---|
11 | |
---|
12 | function __construct($plugin_id) |
---|
13 | { |
---|
14 | parent::__construct($plugin_id); |
---|
15 | $this->file = PHPWG_ROOT_PATH . PWG_LOCAL_DIR . 'comments_blacklist.txt'; |
---|
16 | } |
---|
17 | |
---|
18 | function install($plugin_version, &$errors=array()) |
---|
19 | { |
---|
20 | global $conf; |
---|
21 | |
---|
22 | if (empty($conf['comments_blacklist'])) |
---|
23 | { |
---|
24 | conf_update_param('comments_blacklist', $this->default_conf, true); |
---|
25 | } |
---|
26 | |
---|
27 | if (!file_exists($this->file)) |
---|
28 | { |
---|
29 | touch($this->file); |
---|
30 | } |
---|
31 | } |
---|
32 | |
---|
33 | function update($old_version, $new_version, &$errors=array()) |
---|
34 | { |
---|
35 | $this->install($new_version, $errors); |
---|
36 | } |
---|
37 | |
---|
38 | function uninstall() |
---|
39 | { |
---|
40 | conf_delete_param('comments_blacklist'); |
---|
41 | |
---|
42 | @unlink($this->file); |
---|
43 | } |
---|
44 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.