-
Notifications
You must be signed in to change notification settings - Fork 0
/
maintain.class.php
62 lines (49 loc) · 1.39 KB
/
maintain.class.php
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
<?php
defined('PHPWG_ROOT_PATH') or die('Hacking attempt!');
class photo_quick_validation_maintain extends PluginMaintain
{
private $installed = false;
function __construct($plugin_id)
{
parent::__construct($plugin_id);
}
function install($plugin_version, &$errors=array())
{
global $conf, $prefixeTable;
$result = pwg_query('SHOW COLUMNS FROM `'.IMAGES_TABLE.'` LIKE "pqv_validated";');
if (!pwg_db_num_rows($result))
{
pwg_query('ALTER TABLE '.IMAGES_TABLE.' ADD pqv_validated enum(\'true\', \'false\') DEFAULT NULL;');
}
$result = pwg_query('SHOW COLUMNS FROM `'.GROUPS_TABLE.'` LIKE "pqv_enabled";');
if (!pwg_db_num_rows($result))
{
pwg_query('ALTER TABLE '.GROUPS_TABLE.' ADD pqv_enabled enum(\'true\', \'false\') DEFAULT \'false\';');
}
$this->installed = true;
}
function activate($plugin_version, &$errors=array())
{
global $prefixeTable;
if (!$this->installed)
{
$this->install($plugin_version, $errors);
}
}
function update($old_version, $new_version, &$errors=array())
{
$this->install($new_version, $errors);
}
function deactivate()
{
}
function uninstall()
{
global $prefixeTable;
$query = 'ALTER TABLE '.IMAGES_TABLE.' DROP pqv_validated;';
pwg_query($query);
$query = 'DROP TABLE '.GROUPS_TABLE.' DROP pqv_enabled;';
pwg_query($query);
}
}
?>