source: extensions/ContactForm/maintain.inc.php @ 6547

Last change on this file since 6547 was 6547, checked in by Gotcha, 14 years ago

v1.0.9

File size: 1.3 KB
Line 
1<?php
2if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
3if (!defined('IN_ADMIN') or !IN_ADMIN) die('Hacking attempt!');
4
5if (!defined('CF_PATH')) {
6  define('CF_PATH',     PHPWG_PLUGINS_PATH.basename(dirname(__FILE__)).'/');
7}
8if (!defined('CF_ROOT')) {
9  define('CF_ROOT',     dirname(__FILE__).'/');
10}
11
12function plugin_install($plugin_id, $version, &$errors) {
13  include_once(CF_PATH . 'include/cf_common.inc.php');
14  // Include language advices
15  load_language('plugin.lang', CF_PATH);
16  if ($version != CF_VERSION) {
17    array_push($errors, sprintf(l10n('cf_inconsistent_version'), $plugin_id));
18    return;
19  }
20  update_config($plugin_id, CF_CFG_DB_FACTORY);
21}
22
23function plugin_activate($plugin_id, $version, &$errors) {
24  update_config($plugin_id);
25}
26
27function plugin_deactivate($plugin_id) {
28  // Nothing special
29}
30
31function plugin_uninstall($plugin_id) {
32  include_once(CF_PATH . 'include/cf_common.inc.php');
33  $uninstall = CF_Config::uninstall($plugin_id);
34}
35
36function update_config($plugin_id, $db_comment=null) {
37  include_once(CF_PATH . 'include/cf_common.inc.php');
38  $clean = cf_clean_obsolete_files(CF_OBSOLETE);
39  $cf_config_default[CF_CFG_VERSION] = CF_VERSION;
40  if (null != $db_comment) {
41    $cf_config_default[CF_CFG_COMMENT] = $db_comment;
42  }
43  $install = CF_Config::install($plugin_id);
44}
45?>
Note: See TracBrowser for help on using the repository browser.