source: extensions/header_manager/maintain.inc.php @ 17654

Last change on this file since 17654 was 17654, checked in by mistic100, 12 years ago

remove useless file install.inc.php, search for update everytime

File size: 1.3 KB
RevLine 
[15854]1<?php
2if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
3 
4function plugin_install() 
5{
[17654]6  global $conf, $prefixeTable;
7
8  // configuration
9  if (empty($conf['header_manager']))
10  {
11    $header_manager_default_config = serialize(array(
12      'width' => 1000,
13      'height' => 150,
14      'image' => 'random',
15      'display' => 'image_only'
16      ));
17   
18    conf_update_param('header_manager', $header_manager_default_config);
19    $conf['header_manager'] = $header_manager_default_config;
20  }
21
22  // banners directory
23  if (!file_exists(PWG_LOCAL_DIR . 'banners/')) 
24  {
25    mkdir(PWG_LOCAL_DIR . 'banners/', 0755);
26  }
27
28  // banners table
29  $query = '
30CREATE TABLE IF NOT EXISTS `' .$prefixeTable . 'category_banner` (
31  `category_id` smallint(5) unsigned NOT NULL,
32  `image` varchar(255) NOT NULL,
33  `deep` tinyint(1) DEFAULT 1,
34  PRIMARY KEY (`category_id`)
35) ENGINE=MyISAM DEFAULT CHARSET=utf8
36;';
37  pwg_query($query);
38 
[17644]39  define('header_manager_installed', true);
[15854]40}
41
42function plugin_activate()
43{
[17644]44  if (!defined('header_manager_installed'))
[15854]45  {
[17654]46    plugin_install();
[15854]47  }
48}
49
50function plugin_uninstall() 
51{
[16937]52  global $prefixeTable;
53 
54  pwg_query('DROP TABLE `' .$prefixeTable . 'category_banner`;');
[15854]55  pwg_query('DELETE FROM `'. CONFIG_TABLE .'` WHERE param = "header_manager" LIMIT 1;');
56}
57
58?>
Note: See TracBrowser for help on using the repository browser.