source: spip-zone/_plugins_/blockreferer/base/blockreferer_upgrade.php @ 70524

Last change on this file since 70524 was 15695, checked in by pierre.andrews@…, 13 years ago

creation de la base ppour la BL.

File size: 1.8 KB
Line 
1<?php
2
3/*
4 *   Plugin Blockreferer
5 *   Copyright (C) 2007 Pierre Andrews
6 *
7 *   This program is free software: you can redistribute it and/or modify
8 *   it under the terms of the GNU General Public License as published by
9 *   the Free Software Foundation, either version 3 of the License, or
10 *   (at your option) any later version.
11 *
12 *   This program is distributed in the hope that it will be useful,
13 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
14 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 *   GNU General Public License for more details.
16 *
17 *   You should have received a copy of the GNU General Public License
18 *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
19 */
20
21
22function blockreferer_droptables() {
23  spip_query("DROP TABLE IF EXISTS ".$GLOBALS['table_prefix']."_blockreferer_blacklist;");
24}
25
26function blockreferer_doupgrade() {
27  include_spip('base/blockreferer_db');
28  $installe = $GLOBALS['meta']['blockreferer:installe'];
29   $uptodate = $installe && ($installe == $GLOBALS['blockrefererdb_version']);
30  if(!$uptodate) {
31        include_spip('base/create');
32        include_spip('base/abstract_sql');
33        creer_base();
34        ecrire_meta('blockreferer:installe',$GLOBALS['blockrefererdb_version']);
35        ecrire_metas();
36  }
37}
38
39function blockreferer_install($action){
40  switch ($action){
41        case 'test':
42          include_spip('base/blockreferer_db');
43          //Contrôle du plugin à chaque chargement de la page d'administration
44          $installe = $GLOBALS['meta']['blockreferer:installe'];
45          $uptodate = $installe && ($installe == $GLOBALS['blockrefererdb_version']);
46          return $uptodate;
47          break;
48        case 'install':
49          blockreferer_doupgrade();
50          break;
51        case 'uninstall':
52          //Appel de la fonction de suppression
53          blockreferer_droptables();
54          effacer_meta('blockreferer:installe');
55          ecrire_metas();
56          break;
57  }
58}
59
60?>
Note: See TracBrowser for help on using the repository browser.