source: extensions/ASearchEngine/ase_install.class.inc.php @ 7318

Revision 7196, 3.2 KB checked in by grum, 9 years ago (diff)

Commit first files

  • Property svn:executable set to *
Line 
1<?php
2/* -----------------------------------------------------------------------------
3  Plugin     : Advanced Search Engine
4  Author     : Grum
5    email    : grum@piwigo.org
6    website  : http://photos.grum.fr
7
8    << May the Little SpaceFrog be with you ! >>
9  ------------------------------------------------------------------------------
10  See main.inc.php for release information
11
12  ASE_Install : classe to manage plugin install
13
14  --------------------------------------------------------------------------- */
15
16   include_once('ase_version.inc.php'); // => Don't forget to update this file !!
17   include_once('ase_root.class.inc.php');
18   include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/GPCTables.class.inc.php');
19
20  /* ASE class for install process */
21  class ASE_Install extends ASE_root
22  {
23
24    public function __construct($prefixeTable, $filelocation)
25    {
26      parent::__construct($prefixeTable, $filelocation);
27    }
28
29    public function __destruct()
30    {
31      parent::__destruct();
32    }
33
34    /*
35        function for installation process
36        return true if install process is ok, otherwise false
37    */
38    public function install()
39    {
40      $this->initConfig();
41      $this->loadConfig();
42      $this->config['installed']=ASE_VERSION2;
43      $this->config['newInstall']='y';
44      $this->saveConfig();
45
46      GPCCore::register($this->getPluginName(), ASE_VERSION, ASE_GPC_NEEDED);
47      return(true);
48    }
49
50
51    /*
52        function for uninstall process
53    */
54    public function uninstall()
55    {
56      $this->deleteConfig();
57      GPCCore::unregister($this->getPluginName());
58      return('');
59    }
60
61    public function activate()
62    {
63      $this->initConfig();
64      $this->loadConfig();
65
66      /*
67       * migration code
68       */
69      switch($this->config['installed'])
70      {
71        // actually, there no migration possible from previous release
72        default:
73          // nothing to do...
74          break;
75      }
76
77      $this->config['installed']=ASE_VERSION2;
78      $this->saveConfig();
79
80      GPCCore::register($this->getPluginName(), ASE_VERSION, ASE_GPC_NEEDED);
81      GPCRequestBuilder::register('ASETag', dirname($this->getFileLocation()).'/ase_rb_callback_tag.class.inc.php');
82      GPCRequestBuilder::register('ASEDate', dirname($this->getFileLocation()).'/ase_rb_callback_date.class.inc.php');
83      GPCRequestBuilder::register('ASECategory', dirname($this->getFileLocation()).'/ase_rb_callback_category.class.inc.php');
84      GPCRequestBuilder::register('ASEKeyword', dirname($this->getFileLocation()).'/ase_rb_callback_keyword.class.inc.php');
85      GPCRequestBuilder::register('ASEHD', dirname($this->getFileLocation()).'/ase_rb_callback_hd.class.inc.php');
86      GPCRequestBuilder::register('ASERate', dirname($this->getFileLocation()).'/ase_rb_callback_rate.class.inc.php');
87      return('');
88    }
89
90    public function deactivate()
91    {
92      GPCRequestBuilder::unregister('ASETag');
93      GPCRequestBuilder::unregister('ASEDate');
94      GPCRequestBuilder::unregister('ASECategory');
95      GPCRequestBuilder::unregister('ASEKeyword');
96      GPCRequestBuilder::unregister('ASEHD');
97      GPCRequestBuilder::unregister('ASERate');
98    }
99
100  } //class
101
102?>
Note: See TracBrowser for help on using the repository browser.