[ Index ]

PHP Cross Reference of MyBB 1.8.40

title

Body

[close]

/install/resources/ -> upgrade52.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.24, 1.8.25 or 1.8.26
  13   */
  14  
  15   $upgrade_detail = array(
  16       "revert_all_templates" => 0,
  17       "revert_all_themes" => 0,
  18       "revert_all_settings" => 0
  19  );
  20  
  21  function upgrade52_dbchanges()
  22  {
  23      global $output, $cache, $db, $mybb;
  24  
  25      $output->print_header("Updating Database");
  26  
  27      echo "<p>Performing necessary upgrade queries...</p>";
  28      flush();
  29  
  30      // Add new setting for new usergroup permission if group members can hide online status
  31      if(!$db->field_exists('canbeinvisible', 'usergroups'))
  32      {
  33          switch($db->type)
  34          {
  35              case "pgsql":
  36                  $db->add_column("usergroups", "canbeinvisible", "smallint NOT NULL default '1' AFTER canusercp");
  37                  break;
  38  
  39              default:
  40                  $db->add_column("usergroups", "canbeinvisible", "tinyint(1) NOT NULL default '1' AFTER canusercp");
  41                  break;
  42          }
  43      }
  44  
  45      // Add new setting for attachments force download
  46      if(!$db->field_exists('forcedownload', 'attachtypes'))
  47      {
  48          switch($db->type)
  49          {
  50              case "pgsql":
  51                  $db->add_column("attachtypes", "forcedownload", "smallint NOT NULL default '0' AFTER enabled");
  52                  break;
  53  
  54              default:
  55                  $db->add_column("attachtypes", "forcedownload", "tinyint(1) NOT NULL default '0' AFTER enabled");
  56                  break;
  57          }
  58      }
  59  
  60      // Change default values for these settings for the guest group only
  61      $db->update_query('usergroups', array(
  62          'caneditposts' => 0,
  63          'candeleteposts' => 0,
  64          'candeletethreads' => 0,
  65          'caneditattachments' => 0,
  66          'canviewdeletionnotice' => 0
  67      ), "gid = 1");
  68  
  69      $cache->update_usergroups();
  70    
  71      $added_tasks = sync_tasks();
  72  
  73      echo "<p>Added {$added_tasks} new tasks.</p>";
  74  
  75      $output->print_contents("<p>Click next to continue with the upgrade process.</p>");
  76      $output->print_footer("52_done");
  77  }


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