[ Index ]

PHP Cross Reference of MyBB 1.8.38

title

Body

[close]

/install/resources/ -> upgrade41.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.12
  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 upgrade41_dbchanges()
  22  {
  23      global $db, $output;
  24  
  25      $output->print_header("Updating Database");
  26  
  27      // Remove Blekko Spider, Insert Modern Spiders
  28      $db->delete_query('spiders', "name IN('Blekko', 'Discord', 'Applebot', 'CheckHost', 'Pingdom', 'DuckDuckGo', 'UptimeRobot')");
  29  
  30      $db->insert_query_multiple('spiders', array(
  31          array("name" => "Discord", "useragent" => "Discordbot"),
  32          array("name" => "Applebot", "useragent" => "Applebot"),
  33          array("name" => "CheckHost", "useragent" => "CheckHost"),
  34          array("name" => "Pingdom", "useragent" => "Pingdom.com_bot"),
  35          array("name" => "DuckDuckGo", "useragent" => "DuckDuckBot"),
  36          array("name" => "UptimeRobot", "useragent" => "UptimeRobot"),
  37      ));
  38  
  39      $output->print_contents("<p>Click next to continue with the upgrade process.</p>");
  40      $output->print_footer("41_dbchanges2");
  41  }
  42  
  43  function upgrade41_dbchanges2()
  44  {
  45      global $db, $output;
  46  
  47      $output->print_header("Updating Database");
  48  
  49      // Remove backslashes from last 1,000 log files.
  50      $query = $db->simple_select('moderatorlog', 'tid, action', "action LIKE '%\\\\\\\\%'", array(
  51          "order_by" => 'tid',
  52          "order_dir" => 'DESC',
  53          "limit" => 1000
  54      ));
  55  
  56      while($row = $db->fetch_array($query))
  57      {
  58          $original = $row['action'];
  59          $stripped = stripslashes($original);
  60  
  61          if($stripped !== $original)
  62          {
  63              $db->update_query("moderatorlog", array(
  64                  "action" => $db->escape_string($stripped),
  65              ), "tid = '".$row['tid']."'");
  66          }
  67      }
  68  
  69      // Add Google reCAPTCHA invisible
  70      $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\r\n5=reCAPTCHA invisible'), "name='captchaimage'");
  71  
  72      $output->print_contents("<p>Click next to continue with the upgrade process.</p>");
  73      $output->print_footer("41_dbchanges3");
  74  }
  75  
  76  function upgrade41_dbchanges3()
  77  {
  78      global $db, $output, $mybb;
  79  
  80      $output->print_header("Updating Database");
  81  
  82      echo "<p>Performing necessary upgrade queries...</p>";
  83      flush();
  84  
  85      $guestlangs = array();
  86      $templang = new MyLanguage();
  87      $templang->set_path(MYBB_ROOT."inc/languages");
  88      $langs = array_keys($templang->get_languages());
  89  
  90      foreach($langs as $langname)
  91      {
  92          unset($templang);
  93          $templang = new MyLanguage();
  94          $templang->set_path(MYBB_ROOT."inc/languages");
  95          $templang->set_language($langname);
  96          $templang->load("global");
  97          if(isset($templang->guest))
  98          {
  99              $guestlangs[] = $db->escape_string($templang->guest);
 100          }
 101      }
 102  
 103      unset($templang);
 104      $guestlangs = implode("', '", $guestlangs);
 105  
 106      $db->update_query('posts', array('username' => ''), "uid = 0 AND username IN ('{$guestlangs}')");
 107      $db->update_query('threads', array('username' => ''), "uid = 0 AND username IN ('{$guestlangs}')");
 108  
 109      $output->print_contents("<p>Click next to continue with the upgrade process.</p>");
 110      $output->print_footer("41_done");
 111  }


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