source: extensions/memories/maintain.class.php @ 32199

Last change on this file since 32199 was 32199, checked in by ddtddt, 4 years ago

[memories]

File size: 2.7 KB
Line 
1<?php
2// +-----------------------------------------------------------------------+
3// | Memories for Piwigo by TEMMII                                         |
4// +-----------------------------------------------------------------------+
5// | Copyright(C) 2008-2020 ddtddt               http://temmii.com/piwigo/ |
6// +-----------------------------------------------------------------------+
7// | This program is free software; you can redistribute it and/or modify  |
8// | it under the terms of the GNU General Public License as published by  |
9// | the Free Software Foundation                                          |
10// |                                                                       |
11// | This program is distributed in the hope that it will be useful, but   |
12// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
13// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
14// | General Public License for more details.                              |
15// |                                                                       |
16// | You should have received a copy of the GNU General Public License     |
17// | along with this program; if not, write to the Free Software           |
18// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
19// | USA.                                                                  |
20// +-----------------------------------------------------------------------+
21
22if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
23
24class memories_maintain extends PluginMaintain{
25
26  private $default_conf = array(
27    'pfoya_position' => 5,
28    'pfoya_dateb' => 'date_available',
29    'pfoya_datemax' => 5,
30    'pfoya_nip' => 6,
31        'pfoya_menu' => 'link',
32        'pfoya_show' => 1,
33        'pfoya_showps' => 1,
34    );
35
36
37
38  function install($plugin_version, &$errors=array()){
39        global $conf, $pwg_loaded_plugins;
40        if (empty($conf['pfoya'])){
41      conf_update_param('pfoya', $this->default_conf, true);
42    }else{
43      $old_conf = safe_unserialize($conf['pfoya']);
44      foreach (array_keys($this->default_conf) as $conf_key){
45        if (!isset($old_conf[$conf_key])){
46          $old_conf[$conf_key] = $this->default_conf[$conf_key];
47        }
48      }
49      conf_update_param('pfoya', $old_conf, true);
50    }
51       
52        if(isset($pwg_loaded_plugins['photos_from_one_year_ago'])){
53                $query = 'UPDATE ' . PLUGINS_TABLE . ' SET state="inactive" WHERE id="memories";';
54                pwg_query($query);
55                $_SESSION['page_errors'] = array(l10n('you must delete Photo from 1 year ago before activate Memories'));
56    }
57       
58  }
59
60
61  function update($old_version, $new_version, &$errors=array()){
62        $this->install($new_version, $errors);
63  }
64  function uninstall(){
65        conf_delete_param('pfoya');
66  }
67}
Note: See TracBrowser for help on using the repository browser.