source: extensions/physical2virtual/maintain.inc.php @ 27229

Last change on this file since 27229 was 27229, checked in by JanisV, 7 years ago

New options (unlock new virtual albums, inherit permissions)

File size: 1.5 KB
Line 
1<?php
2
3defined('PHPWG_ROOT_PATH') or die('Hacking attempt!');
4
5class physical2virtual_maintain extends PluginMaintain
6{
7  private $installed = false;
8
9  private $default_conf = array(
10    'physical_prefix' => '',
11    'physical_postfix' => '',
12    'virtual_prefix' => '',
13    'virtual_postfix' => '',
14    'parent_cat' => null,
15    'lock_physical' => false,
16    'private_physical' => false,
17    'unlock_virtual' => false,
18    'inherit' => false,
19    'update_on_manual' => true,
20    'update_on_upload' => false,
21    'update_on_date' => false,
22    'update_timeout' => 3,
23    'last_update' => 0,
24    'store_structure' => true,
25  );
26
27  function __construct($plugin_id)
28  {
29    parent::__construct($plugin_id);
30  }
31
32  function install($plugin_version, &$errors=array())
33  {
34    global $conf;
35
36    if (empty($conf['physical2virtual']))
37    {
38      $conf['physical2virtual'] = serialize($this->default_conf);
39      conf_update_param('physical2virtual', $conf['physical2virtual']);
40    }
41    else
42    {
43      $new_conf = is_string($conf['physical2virtual']) ? unserialize($conf['physical2virtual']) : $conf['physical2virtual'];
44
45      $conf['physical2virtual'] = serialize($new_conf);
46      conf_update_param('physical2virtual', $conf['physical2virtual']);
47    }
48   
49    $this->installed = true;
50  }
51
52  function activate($plugin_version, &$errors=array())
53  {
54    if (!$this->installed)
55    {
56      $this->install($plugin_version, $errors);
57    }
58  }
59
60  function deactivate()
61  {
62  }
63
64  function uninstall()
65  {
66    conf_delete_param('physical2virtual');
67  }
68}
69
70?>
Note: See TracBrowser for help on using the repository browser.