source: extensions/download_permissions/maintain.class.php @ 30608

Last change on this file since 30608 was 30490, checked in by plg, 10 years ago

compatible with Piwigo 2.7

File size: 1.0 KB
Line 
1<?php
2defined('PHPWG_ROOT_PATH') or die('Hacking attempt!');
3
4class download_permissions_maintain extends PluginMaintain
5{
6  private $installed = false;
7
8  function __construct($plugin_id)
9  {
10    parent::__construct($plugin_id);
11  }
12
13  function install($plugin_version, &$errors=array())
14  {
15    // create categories.downloadable (true/false)
16    $result = pwg_query('SHOW COLUMNS FROM `'.CATEGORIES_TABLE.'` LIKE "downloadable";');
17    if (!pwg_db_num_rows($result))
18    {
19      pwg_query('ALTER TABLE `'.CATEGORIES_TABLE.'` ADD `downloadable` enum("true", "false") DEFAULT "true";');
20    }
21
22    $this->installed = true;
23  }
24
25  function activate($plugin_version, &$errors=array())
26  {
27    if (!$this->installed)
28    {
29      $this->install($plugin_version, $errors);
30    }
31  }
32
33  function update($old_version, $new_version, &$errors=array())
34  {
35    $this->install($new_version, $errors);
36  }
37
38  function deactivate()
39  {
40  }
41
42  function uninstall()
43  {
44    pwg_query('ALTER TABLE '.CATEGORIES_TABLE.' DROP COLUMN downloadable;');
45  }
46}
Note: See TracBrowser for help on using the repository browser.