[ Index ]

PHP Cross Reference of MyBB

title

Body

[close]

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

   1  <?php
   2  /**
   3   * MyBB 1.6
   4   * Copyright 2010 MyBB Group, All Rights Reserved
   5   *
   6   * Website: http://www.mybboard.com
   7   * License: http://mybb.com/about/license
   8   *
   9   * $Id$
  10   */
  11  
  12  /**
  13   * Upgrade Script: 1.6.4
  14   */
  15  
  16  $upgrade_detail = array(
  17      "revert_all_templates" => 0,
  18      "revert_all_themes" => 0,
  19      "revert_all_settings" => 0
  20  );
  21  
  22  @set_time_limit(0);
  23  
  24  function upgrade21_dbchanges()
  25  {
  26      global $cache, $db, $output, $mybb;
  27  
  28      $output->print_header("Updating Database");
  29  
  30      echo "<p>Performing necessary upgrade queries...</p>";
  31  
  32      $db->delete_query("settings", "name = 'standardheaders'");
  33  
  34      if($db->field_exists('showinbirthdaylist', 'usergroups'))
  35      {
  36          $db->drop_column("usergroups", "showinbirthdaylist");
  37      }
  38  
  39      if($db->field_exists('canoverridepm', 'usergroups'))
  40      {
  41          $db->drop_column("usergroups", "canoverridepm");
  42      }
  43  
  44      if($db->field_exists('canusesig', 'usergroups'))
  45      {
  46          $db->drop_column("usergroups", "canusesig");
  47      }
  48  
  49      if($db->field_exists('canusesigxposts', 'usergroups'))
  50      {
  51          $db->drop_column("usergroups", "canusesigxposts");
  52      }
  53  
  54      if($db->field_exists('signofollow', 'usergroups'))
  55      {
  56          $db->drop_column("usergroups", "signofollow");
  57      }
  58  
  59      if($db->field_exists('postnum', 'profilefields'))
  60      {
  61          $db->drop_column("profilefields", "postnum");
  62      }
  63  
  64      switch($db->type)
  65      {
  66          case "pgsql":
  67          case "sqlite":
  68              $db->add_column("profilefields", "postnum", "bigint NOT NULL default '0'");
  69              $db->add_column("usergroups", "showinbirthdaylist", "int NOT NULL default '0'");
  70              $db->add_column("usergroups", "canoverridepm", "int NOT NULL default '0'");
  71              $db->add_column("usergroups", "canusesig", "int NOT NULL default '0'");
  72              $db->add_column("usergroups", "canusesigxposts", "bigint NOT NULL default '0'");
  73              $db->add_column("usergroups", "signofollow", "int NOT NULL default '0'");
  74              break;
  75          default:
  76              $db->add_column("profilefields", "postnum", "bigint(30) NOT NULL default '0'");
  77              $db->add_column("usergroups", "showinbirthdaylist", "int(1) NOT NULL default '0'");
  78              $db->add_column("usergroups", "canoverridepm", "int(1) NOT NULL default '0'");
  79              $db->add_column("usergroups", "canusesig", "int(1) NOT NULL default '0'");
  80              $db->add_column("usergroups", "canusesigxposts", "bigint(30) NOT NULL default '0'");
  81              $db->add_column("usergroups", "signofollow", "int(1) NOT NULL default '0'");
  82              break;
  83      }
  84  
  85      // Update all usergroups to show in the birthday list
  86      $db->update_query("usergroups", array("showinbirthdaylist" => 1));
  87  
  88      // Update our nice usergroups to use a signature
  89      $groups = $cache->read("usergroups");
  90  
  91      foreach($groups as $group)
  92      {
  93          $disallowed_array = array(1, 5, 7);
  94          if(in_array($group['gid'], $disallowed_array) || $group['isbannedgroup'] == 1)
  95          {
  96              continue;
  97          }
  98  
  99          $db->update_query("usergroups", array("canusesig" => 1), "gid = '{$group['gid']}'");
 100      }
 101  
 102      $output->print_contents("<p>Click next to continue with the upgrade process.</p>");
 103      $output->print_footer("21_done");
 104  }
 105  
 106  ?>


Generated: Tue Oct 8 19:19:50 2013 Cross-referenced by PHPXref 0.7.1