source: extensions/Back2Front/maintain.inc.php @ 27153

Last change on this file since 27153 was 23177, checked in by mistic100, 11 years ago

use serialized array for config + custom upgrade process

File size: 1.2 KB
Line 
1<?php
2if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
3
4defined('B2F_ID') or define('B2F_ID', basename(dirname(__FILE__)));
5include_once(PHPWG_PLUGINS_PATH . B2F_ID . '/include/install.inc.php');
6include_once(PHPWG_PLUGINS_PATH . B2F_ID . '/include/functions.inc.php');
7
8function plugin_install() 
9{
10  back2front_install();
11 
12  define('back2front_installed', true);
13}
14
15function plugin_activate()
16{
17  if (!defined('back2front_installed'))
18  {
19    back2front_install();
20  }
21}
22
23
24function plugin_uninstall()
25{
26  global $conf, $prefixeTable;
27 
28  $conf['back2front'] = unserialize($conf['back2front']);
29 
30  $query = "SELECT * FROM `" . $prefixeTable . "image_verso`;";
31  $images_versos = pwg_query($query);
32 
33  while ($item = pwg_db_fetch_assoc($images_versos))
34  {
35    back2front_restaure_categories($item);
36  }
37
38  pwg_query("DROP TABLE `" . $prefixeTable . "image_verso`;");
39  pwg_query("DELETE FROM `" . CONFIG_TABLE . "` WHERE param = 'back2front';");
40  pwg_query("DELETE FROM `" . CATEGORIES_TABLE ."`WHERE id = ".$conf['back2front']['versos_cat'].";");
41 
42  // rebuild categories cache
43  include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
44  invalidate_user_cache(true);
45}
46?>
Note: See TracBrowser for help on using the repository browser.