[ Index ]

PHP Cross Reference of MyBB 1.8.38

title

Body

[close]

/install/resources/ -> upgrade21.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.6.4
  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 upgrade21_dbchanges()
  24  {
  25      global $cache, $db, $output, $mybb;
  26  
  27      $output->print_header("Updating Database");
  28  
  29      echo "<p>Performing necessary upgrade queries...</p>";
  30  
  31      $db->delete_query("settings", "name = 'standardheaders'");
  32  
  33      if($db->field_exists('showinbirthdaylist', 'usergroups'))
  34      {
  35          $db->drop_column("usergroups", "showinbirthdaylist");
  36      }
  37  
  38      if($db->field_exists('canoverridepm', 'usergroups'))
  39      {
  40          $db->drop_column("usergroups", "canoverridepm");
  41      }
  42  
  43      if($db->field_exists('canusesig', 'usergroups'))
  44      {
  45          $db->drop_column("usergroups", "canusesig");
  46      }
  47  
  48      if($db->field_exists('canusesigxposts', 'usergroups'))
  49      {
  50          $db->drop_column("usergroups", "canusesigxposts");
  51      }
  52  
  53      if($db->field_exists('signofollow', 'usergroups'))
  54      {
  55          $db->drop_column("usergroups", "signofollow");
  56      }
  57  
  58      if($db->field_exists('postnum', 'profilefields'))
  59      {
  60          $db->drop_column("profilefields", "postnum");
  61      }
  62  
  63      switch($db->type)
  64      {
  65          case "pgsql":
  66          case "sqlite":
  67              $db->add_column("profilefields", "postnum", "bigint NOT NULL default '0'");
  68              $db->add_column("usergroups", "showinbirthdaylist", "int NOT NULL default '0'");
  69              $db->add_column("usergroups", "canoverridepm", "int NOT NULL default '0'");
  70              $db->add_column("usergroups", "canusesig", "int NOT NULL default '0'");
  71              $db->add_column("usergroups", "canusesigxposts", "bigint NOT NULL default '0'");
  72              $db->add_column("usergroups", "signofollow", "int NOT NULL default '0'");
  73              break;
  74          default:
  75              $db->add_column("profilefields", "postnum", "bigint(30) NOT NULL default '0'");
  76              $db->add_column("usergroups", "showinbirthdaylist", "int(1) NOT NULL default '0'");
  77              $db->add_column("usergroups", "canoverridepm", "int(1) NOT NULL default '0'");
  78              $db->add_column("usergroups", "canusesig", "int(1) NOT NULL default '0'");
  79              $db->add_column("usergroups", "canusesigxposts", "bigint(30) NOT NULL default '0'");
  80              $db->add_column("usergroups", "signofollow", "int(1) NOT NULL default '0'");
  81              break;
  82      }
  83  
  84      // Update all usergroups to show in the birthday list
  85      $db->update_query("usergroups", array("showinbirthdaylist" => 1));
  86  
  87      // Update our nice usergroups to use a signature
  88      $groups = $cache->read("usergroups");
  89  
  90      foreach($groups as $group)
  91      {
  92          $disallowed_array = array(1, 5, 7);
  93          if(in_array($group['gid'], $disallowed_array) || $group['isbannedgroup'] == 1)
  94          {
  95              continue;
  96          }
  97  
  98          $db->update_query("usergroups", array("canusesig" => 1), "gid = '{$group['gid']}'");
  99      }
 100  
 101      $output->print_contents("<p>Click next to continue with the upgrade process.</p>");
 102      $output->print_footer("21_done");
 103  }
 104  


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