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

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

use serialized array for config + custom upgrade process

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