source: extensions/most_downloaded/maintain.class.php @ 31909

Last change on this file since 31909 was 31453, checked in by ddtddt, 9 years ago

[extensions] - most_downloaded - First release

File size: 2.1 KB
Line 
1<?php
2
3// +-----------------------------------------------------------------------+
4// |Most Downloaded for piwigo                                             |
5// +-----------------------------------------------------------------------+
6// | Copyright(C) 2016 ddtddt                    http://temmii.com/piwigo/ |
7// +-----------------------------------------------------------------------+
8// | This program is free software; you can redistribute it and/or modify  |
9// | it under the terms of the GNU General Public License as published by  |
10// | the Free Software Foundation                                          |
11// |                                                                       |
12// | This program is distributed in the hope that it will be useful, but   |
13// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
14// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
15// | General Public License for more details.                              |
16// |                                                                       |
17// | You should have received a copy of the GNU General Public License     |
18// | along with this program; if not, write to the Free Software           |
19// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
20// | USA.                                                                  |
21// +-----------------------------------------------------------------------+
22
23if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
24
25class most_downloaded_maintain extends PluginMaintain
26{
27  function install($plugin_version, &$errors=array())
28  {
29$q = pwg_query('SHOW COLUMNS FROM ' . HISTORY_TABLE . ' LIKE "section"');
30  $section = pwg_db_fetch_array($q);
31  $type = $section['Type'];
32
33  if (substr_count($type, 'most_downloaded') == 0)
34  {
35    $type = strtr($type , array(')' => ',\'most_downloaded\')'));
36  }
37
38  pwg_query('ALTER TABLE ' . HISTORY_TABLE . ' CHANGE section section ' . $type . ' DEFAULT NULL');
39  }
40
41  function update($old_version, $new_version, &$errors=array())
42  {
43        $this->install($new_version, $errors);
44  }
45
46  function uninstall()
47  {
48
49  }
50}
Note: See TracBrowser for help on using the repository browser.