[ Index ]

PHP Cross Reference of MyBB 1.8.38

title

Body

[close]

/install/resources/ -> upgrade32.php (source)

   1  <?php
   2  /**
   3   * MyBB 1.8
   4   * Copyright 2014 MyBB Group, All Rights Reserved
   5   *
   6   * Website: http://www.mybb.com
   7   * License: http://www.mybb.com/about/license
   8   *
   9   */
  10  
  11  /**
  12   * Upgrade Script: 1.8.1, 1.8.2 or 1.8.3
  13   */
  14  
  15  $upgrade_detail = array(
  16      "revert_all_templates" => 0,
  17      "revert_all_themes" => 0,
  18      "revert_all_settings" => 0
  19  );
  20  
  21  @set_time_limit(0);
  22  
  23  function upgrade32_dbchanges()
  24  {
  25      global $db, $output;
  26      
  27      // Unset old ACP cookies from front-end since they're not needed anymore
  28      my_unsetcookie('adminsid');
  29      my_unsetcookie('acploginattempts');
  30      my_unsetcookie('acp_view');
  31      my_unsetcookie('inlinemod_useracp');
  32  
  33      $output->print_header("Updating Database");
  34      echo "<p>Performing necessary upgrade queries...</p>";
  35      flush();
  36  
  37      if($db->field_exists('candeletereputations', 'usergroups'))
  38      {
  39          $db->drop_column("usergroups", "candeletereputations");
  40      }
  41  
  42      if($db->field_exists('authsecret', 'adminoptions'))
  43      {
  44          $db->drop_column("adminoptions", "authsecret");
  45      }
  46  
  47      if($db->field_exists('recovery_codes', 'adminoptions'))
  48      {
  49          $db->drop_column("adminoptions", "recovery_codes");
  50      }
  51  
  52      if($db->field_exists('authenticated', 'adminsessions'))
  53      {
  54          $db->drop_column("adminsessions", "authenticated");
  55      }
  56  
  57      switch($db->type)
  58      {
  59          case "pgsql":
  60              $db->add_column("usergroups", "candeletereputations", "smallint NOT NULL default '0' AFTER cangivereputations");
  61              $db->add_column("adminoptions", "authsecret", "varchar(16) NOT NULL default ''");
  62              $db->add_column("adminoptions", "recovery_codes", "varchar(177) NOT NULL default ''");
  63              $db->add_column("adminsessions", "authenticated", "smallint NOT NULL default '0'");
  64              break;
  65          case "sqlite":
  66              $db->add_column("usergroups", "candeletereputations", "tinyint(1) NOT NULL default '0'");
  67              $db->add_column("adminoptions", "authsecret", "varchar(16) NOT NULL default ''");
  68              $db->add_column("adminoptions", "recovery_codes", "varchar(177) NOT NULL default ''");
  69              $db->add_column("adminsessions", "authenticated", "tinyint(1) NOT NULL default '0'");
  70              break;
  71          default:
  72              $db->add_column("usergroups", "candeletereputations", "tinyint(1) NOT NULL default '0' AFTER cangivereputations");
  73              $db->add_column("adminoptions", "authsecret", "varchar(16) NOT NULL default ''");
  74              $db->add_column("adminoptions", "recovery_codes", "varchar(177) NOT NULL default ''");
  75              $db->add_column("adminsessions", "authenticated", "tinyint(1) NOT NULL default '0'");
  76              break;
  77      }
  78  
  79      // Delete forumpermissions belonging to a deleted forum
  80      $db->delete_query("forumpermissions", "fid NOT IN(SELECT fid FROM {$db->table_prefix}forums)");
  81  
  82      $db->update_query("settings", array('optionscode' => 'select\r\n0=No CAPTCHA\r\n1=MyBB Default CAPTCHA\r\n2=reCAPTCHA\r\n3=Are You a Human\r\n4=NoCAPTCHA reCAPTCHA'), "name='captchaimage'");
  83      
  84      $output->print_contents("<p>Click next to continue with the upgrade process.</p>");
  85      $output->print_footer("32_done");
  86  }


2005 - 2021 © MyBB.de | Alle Rechte vorbehalten! | Sponsor: netcup Cross-referenced by PHPXref