Verzeichnisstruktur phpBB-3.1.0


Veröffentlicht
27.10.2014

So funktioniert es


Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück

Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis.
Auf den Verzeichnisnamen klicken, dies zeigt nur das Verzeichnis mit Inhalt an

(Beispiel Datei-Icons)

Auf das Icon klicken um den Quellcode anzuzeigen

release_3_0_5_rc1.php

Zuletzt modifiziert: 09.10.2024, 12:57 - Dateigröße: 4.01 KiB


001  <?php
002  /**
003  *
004  * This file is part of the phpBB Forum Software package.
005  *
006  * @copyright (c) phpBB Limited <https://www.phpbb.com>
007  * @license GNU General Public License, version 2 (GPL-2.0)
008  *
009  * For full copyright and license information, please see
010  * the docs/CREDITS.txt file.
011  *
012  */
013   
014  namespace phpbb\db\migration\data\v30x;
015   
016  class release_3_0_5_rc1 extends \phpbb\db\migration\migration
017  {
018      public function effectively_installed()
019      {
020          return phpbb_version_compare($this->config['version'], '3.0.5-RC1', '>=');
021      }
022   
023      static public function depends_on()
024      {
025          return array('\phpbb\db\migration\data\v30x\release_3_0_4');
026      }
027   
028      public function update_schema()
029      {
030          return array(
031              'change_columns' => array(
032                  $this->table_prefix . 'forums' => array(
033                      'forum_style' => array('UINT', 0),
034                  ),
035              ),
036          );
037      }
038   
039      public function update_data()
040      {
041          $search_indexing_state = $this->config['search_indexing_state'];
042   
043          return array(
044              array('config.add', array('captcha_gd_wave', 0)),
045              array('config.add', array('captcha_gd_3d_noise', 1)),
046              array('config.add', array('captcha_gd_fonts', 1)),
047              array('config.add', array('confirm_refresh', 1)),
048              array('config.add', array('max_num_search_keywords', 10)),
049              array('config.remove', array('search_indexing_state')),
050              array('config.add', array('search_indexing_state', $search_indexing_state, true)),
051              array('custom', array(array(&$this, 'hash_old_passwords'))),
052              array('custom', array(array(&$this, 'update_ichiro_bot'))),
053          );
054      }
055   
056      public function hash_old_passwords()
057      {
058          global $phpbb_container;
059   
060          $passwords_manager = $phpbb_container->get('passwords.manager');
061          $sql = 'SELECT user_id, user_password
062                  FROM ' . $this->table_prefix . 'users
063                  WHERE user_pass_convert = 1';
064          $result = $this->db->sql_query($sql);
065   
066          while ($row = $this->db->sql_fetchrow($result))
067          {
068              if (strlen($row['user_password']) == 32)
069              {
070                  $sql_ary = array(
071                      'user_password'    => '$CP$' . $passwords_manager->hash($row['user_password'], 'passwords.driver.salted_md5'),
072                  );
073   
074                  $this->sql_query('UPDATE ' . $this->table_prefix . 'users SET ' . $this->db->sql_build_array('UPDATE', $sql_ary) . ' WHERE user_id = ' . $row['user_id']);
075              }
076          }
077          $this->db->sql_freeresult($result);
078      }
079   
080      public function update_ichiro_bot()
081      {
082          // Adjust bot entry
083          $sql = 'UPDATE ' . $this->table_prefix . "bots
084              SET bot_agent = 'ichiro/'
085              WHERE bot_agent = 'ichiro/2'";
086          $this->sql_query($sql);
087      }
088   
089      public function remove_duplicate_auth_options()
090      {
091          // Before we are able to add a unique key to auth_option, we need to remove duplicate entries
092          $sql = 'SELECT auth_option
093              FROM ' . $this->table_prefix . 'acl_options
094              GROUP BY auth_option
095              HAVING COUNT(*) >= 2';
096          $result = $this->db->sql_query($sql);
097   
098          $auth_options = array();
099          while ($row = $this->db->sql_fetchrow($result))
100          {
101              $auth_options[] = $row['auth_option'];
102          }
103          $this->db->sql_freeresult($result);
104   
105          // Remove specific auth options
106          if (!empty($auth_options))
107          {
108              foreach ($auth_options as $option)
109              {
110                  // Select auth_option_ids... the largest id will be preserved
111                  $sql = 'SELECT auth_option_id
112                      FROM ' . ACL_OPTIONS_TABLE . "
113                      WHERE auth_option = '" . $db->sql_escape($option) . "'
114                      ORDER BY auth_option_id DESC";
115                  // sql_query_limit not possible here, due to bug in postgresql layer
116                  $result = $this->db->sql_query($sql);
117   
118                  // Skip first row, this is our original auth option we want to preserve
119                  $row = $this->db->sql_fetchrow($result);
120   
121                  while ($row = $this->db->sql_fetchrow($result))
122                  {
123                      // Ok, remove this auth option...
124                      $this->sql_query('DELETE FROM ' . ACL_OPTIONS_TABLE . ' WHERE auth_option_id = ' . $row['auth_option_id']);
125                      $this->sql_query('DELETE FROM ' . ACL_ROLES_DATA_TABLE . ' WHERE auth_option_id = ' . $row['auth_option_id']);
126                      $this->sql_query('DELETE FROM ' . ACL_GROUPS_TABLE . ' WHERE auth_option_id = ' . $row['auth_option_id']);
127                      $this->sql_query('DELETE FROM ' . ACL_USERS_TABLE . ' WHERE auth_option_id = ' . $row['auth_option_id']);
128                  }
129                  $this->db->sql_freeresult($result);
130              }
131          }
132      }
133  }
134