Ignore:
Timestamp:
Oct 28, 2009, 3:36:29 PM (15 years ago)
Author:
Eric
Message:

[NBC_UserAdvManager] pre 2.12.0 identified as 2.12.0a :

  • Improving plugin upgrade process
  • Adding new function (Ghost Tracker - Tracking of ghost users) from bug 1194 : Only admin panel and database requests are coded.
  • Language files updated for new Ghost Tracker feature.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/NBC_UserAdvManager/trunk/maintain.inc.php

    r4124 r4135  
    55
    66include_once (NBC_UserAdvManager_PATH.'include/constants.php');
     7include_once (NBC_UserAdvManager_PATH.'include/functions_UserAdvManager.inc.php');
    78
    89function plugin_install()
     
    1213  $q = '
    1314    INSERT INTO '.CONFIG_TABLE.' (param, value, comment)
    14     VALUES ("nbc_UserAdvManager","true;false;false;-1;-1;-1;false;false;;-1;;;false;;false;100;false","Parametres du plugin nbc UserAdvManager")
     15    VALUES ("nbc_UserAdvManager","true;false;false;-1;-1;-1;false;false;;-1;;;false;;false;100;false,false","Parametres du plugin nbc UserAdvManager")
    1516  ;';
    1617  pwg_query($q);
     
    3738      status enum('webmaster','admin','normal','generic','guest') default NULL,
    3839      date_check datetime default NULL,
     40      lastvisit DATETIME NULL DEFAULT NULL,
     41      reminder ENUM('true','false') NULL DEFAULT NULL
    3942      PRIMARY KEY  (id)
     43    )
     44  ;";
     45  pwg_query($q);
     46
     47        $q = "
     48    CREATE TABLE IF NOT EXISTS ".USER_LASTVISIT_TABLE." (
     49      user_id SMALLINT(5) NOT NULL DEFAULT '0',
     50      lastvisit DATETIME NULL DEFAULT NULL,
     51      reminder ENUM('true','false') NULL,
     52      PRIMARY KEY (`user_id`)
    4053    )
    4154  ;";
     
    4760          global $conf;
    4861       
    49 /* Check for upgrade */
     62/* Check for upgrade from 2.10 */
    5063          $query = '
    5164    SELECT *
    52                 FROM '.CONFIG_TABLE.'
     65                  FROM '.CONFIG_TABLE.'
    5366    WHERE param = "nbc_UserAdvManager_ConfirmMail"
    5467  ;';
     
    6073                upgrade_210();
    6174        }
     75
     76/* Check for upgrade from 2.11 */
     77  if (!table_exist(USER_LASTVISIT_TABLE))
     78  {
     79    /* upgrade from branch 2.11 */
     80                upgrade_211();
     81  }
    6282}
     83
    6384
    6485function plugin_uninstall()
     
    88109  $q = 'DROP TABLE '.USER_CONFIRM_MAIL_TABLE.';';
    89110  pwg_query( $q );
     111
     112  $q = 'DROP TABLE '.USER_LASTVISIT_TABLE.';';
     113  pwg_query( $q );
    90114}
    91115
     116/* upgrade from branch 2.10 */
    92117function upgrade_210()
    93118{
     
    107132  ;';
    108133  pwg_query($q);
     134
     135upgrade_211();
     136}
     137
     138/* upgrade from branch 2.11 */
     139function upgrade_211()
     140{
     141        global $conf;
     142
     143  $conf_nbc_UserAdvManager = isset($conf['nbc_UserAdvManager']) ? explode(";" , $conf['nbc_UserAdvManager']) : array();
     144
     145  if ((!isset($conf_nbc_UserAdvManager[14]) and !isset($conf_nbc_UserAdvManager[15])) and !isset($conf_nbc_UserAdvManager[16]) and !isset($conf_nbc_UserAdvManager[17]))
     146  {
     147    $upgrade_nbc_UserAdvManager = $conf_nbc_UserAdvManager[0].';'.$conf_nbc_UserAdvManager[1].';'.$conf_nbc_UserAdvManager[2].';'.$conf_nbc_UserAdvManager[3].';'.$conf_nbc_UserAdvManager[4].';'.$conf_nbc_UserAdvManager[5].';'.$conf_nbc_UserAdvManager[6].';'.$conf_nbc_UserAdvManager[7].';'.$conf_nbc_UserAdvManager[8].';'.$conf_nbc_UserAdvManager[9].';'.$conf_nbc_UserAdvManager[10].';'.$conf_nbc_UserAdvManager[11].';'.$conf_nbc_UserAdvManager[12].';'.$conf_nbc_UserAdvManager[13].';false;100;false;false';
     148               
     149                $query = '
     150                UPDATE '.CONFIG_TABLE.'
     151                SET value="'.$upgrade_nbc_UserAdvManager.'"
     152                WHERE param="nbc_UserAdvManager"
     153                LIMIT 1
     154                ;';
     155               
     156                pwg_query($query);
     157  }
     158 
     159        $q = "
     160    CREATE TABLE IF NOT EXISTS ".USER_LASTVISIT_TABLE." (
     161      user_id SMALLINT(5) NOT NULL DEFAULT '0',
     162      lastvisit DATETIME NULL DEFAULT NULL,
     163      reminder ENUM('true','false') NULL,
     164      PRIMARY KEY (`user_id`)
     165    )
     166  ;";
     167  pwg_query($q);
    109168}
    110169?>
Note: See TracChangeset for help on using the changeset viewer.