source: extensions/download_permissions/maintain.inc.php @ 29460

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

initial import

File size: 944 bytes
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  private $default_conf = array();
9
10  function install($plugin_version, &$errors=array())
11  {
12    global $conf, $prefixeTable;
13
14    // create categories.downloadable (true/false)
15    $result = pwg_query('SHOW COLUMNS FROM `'.CATEGORIES_TABLE.'` LIKE "downloadable";');
16    if (!pwg_db_num_rows($result))
17    {
18      pwg_query('ALTER TABLE `'.CATEGORIES_TABLE.'` ADD `downloadable` enum("true", "false") DEFAULT "true";');
19    }
20
21    $this->installed = true;
22  }
23
24  function activate($plugin_version, &$errors=array())
25  {
26    if (!$this->installed)
27    {
28      $this->install($plugin_version, $errors);
29    }
30  }
31
32  function deactivate()
33  {
34  }
35
36  function uninstall()
37  {
38    global $prefixeTable;
39   
40    pwg_query('ALTER TABLE '.CATEGORIES_TABLE.' DROP COLUMN downloadable;');
41  }
42}
Note: See TracBrowser for help on using the repository browser.