[ Index ]

PHP Cross Reference of MyBB

title

Body

[close]

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

   1  <?php
   2  /**
   3   * MyBB 1.6
   4   * Copyright 2010 MyBB Group, All Rights Reserved
   5   *
   6   * Website: http://mybb.com
   7   * License: http://mybb.com/about/license
   8   *
   9   * $Id$
  10   */
  11  
  12  /**
  13   * Upgrade Script: Preview Release 2
  14   */
  15  
  16  $upgrade_detail = array(
  17      "revert_all_templates" => 0,
  18      "revert_all_themes" => 0,
  19      "revert_all_settings" => 1,
  20      "requires_deactivated_plugins" => 1,
  21  );
  22  
  23  @set_time_limit(0);
  24  
  25  function upgrade4_dbchanges()
  26  {
  27      global $db, $output;
  28  
  29      $output->print_header("Performing Queries");
  30  
  31      echo "<p>Performing necessary upgrade queries..</p>";
  32  
  33      $db->write_query("UPDATE ".TABLE_PREFIX."users SET style='0' WHERE style='-1';");
  34      $db->write_query("UPDATE ".TABLE_PREFIX."users SET displaygroup='0' WHERE displaygroup='-1';");
  35      $db->write_query("UPDATE ".TABLE_PREFIX."forums SET style='0' WHERE style='-1';");
  36      $query = $db->simple_select("adminoptions", "uid='0'");
  37      $test = $db->fetch_array($query);
  38      if(!isset($test['uid']))
  39      {
  40          $db->write_query("UPDATE ".TABLE_PREFIX."adminoptions SET uid='0' WHERE uid='-1';");
  41      }
  42  
  43      if($db->field_exists('messageindex', "threads"))
  44      {
  45          $db->write_query("ALTER TABLE ".TABLE_PREFIX."threads DROP messageindex;");
  46      }
  47      if($db->field_exists('subjectindex', "threads"))
  48      {
  49          $db->write_query("ALTER TABLE ".TABLE_PREFIX."threads DROP subjectindex;");
  50      }
  51      if($db->field_exists('moderators', "forums"))
  52      {
  53          $db->write_query("ALTER TABLE ".TABLE_PREFIX."forums DROP moderators;");
  54      }
  55  
  56      if($db->field_exists('version', "templates"))
  57      {
  58          $db->write_query("ALTER TABLE ".TABLE_PREFIX."templates DROP version;");
  59      }
  60      $db->write_query("ALTER TABLE ".TABLE_PREFIX."templates ADD version varchar(20) NOT NULL default '0';");
  61      
  62      if($db->field_exists('status', "templates"))
  63      {
  64          $db->write_query("ALTER TABLE ".TABLE_PREFIX."templates DROP status;");
  65      }
  66      $db->write_query("ALTER TABLE ".TABLE_PREFIX."templates ADD status varchar(10) NOT NULL default '';");
  67      
  68      if($db->field_exists('dateline', "templates"))
  69      {
  70          $db->write_query("ALTER TABLE ".TABLE_PREFIX."templates DROP dateline;");
  71      }
  72      $db->write_query("ALTER TABLE ".TABLE_PREFIX."templates ADD dateline int(10) NOT NULL default '0';");
  73      
  74      $db->write_query("UPDATE ".TABLE_PREFIX."templates SET version='100.06' WHERE sid>0");
  75  
  76      echo "Done</p>";
  77      
  78      $contents .= "Click next to continue with the upgrade process.</p>";
  79      $output->print_contents($contents);
  80      $output->print_footer("4_done");
  81  }
  82  
  83  ?>


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