source: extensions/photos_from_one_year_ago/maintain.class.php @ 32179

Last change on this file since 32179 was 32125, checked in by ddtddt, 5 years ago

[photos_from_one_year_ago] first commit

File size: 2.1 KB
Line 
1<?php
2// +-----------------------------------------------------------------------+
3// | Photos from one year ago 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 photos_from_one_year_ago_maintain extends PluginMaintain
25{
26  function install($plugin_version, &$errors=array())
27  {
28$q = pwg_query('SHOW COLUMNS FROM ' . HISTORY_TABLE . ' LIKE "section"');
29  $section = pwg_db_fetch_array($q);
30  $type = $section['Type'];
31
32  if (substr_count($type, 'photos_from_one_year_ago') == 0)
33  {
34    $type = strtr($type , array(')' => ',\'photos_from_one_year_ago\')'));
35  }
36
37  pwg_query('ALTER TABLE ' . HISTORY_TABLE . ' CHANGE section section ' . $type . ' DEFAULT NULL');
38  }
39
40  function update($old_version, $new_version, &$errors=array())
41  {
42        $this->install($new_version, $errors);
43  }
44
45  function uninstall()
46  {
47
48  }
49}
Note: See TracBrowser for help on using the repository browser.