Verzeichnisstruktur phpBB-3.2.0


Veröffentlicht
06.01.2017

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