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_8_rc1.php

Zuletzt modifiziert: 09.10.2024, 12:57 - Dateigröße: 4.55 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_8_rc1 extends \phpbb\db\migration\migration
 017  {
 018      public function effectively_installed()
 019      {
 020          return phpbb_version_compare($this->config['version'], '3.0.8-RC1', '>=');
 021      }
 022   
 023      static public function depends_on()
 024      {
 025          return array('\phpbb\db\migration\data\v30x\release_3_0_7_pl1');
 026      }
 027   
 028      public function update_data()
 029      {
 030          return array(
 031              array('custom', array(array(&$this, 'update_file_extension_group_names'))),
 032              array('custom', array(array(&$this, 'update_module_auth'))),
 033              array('custom', array(array(&$this, 'delete_orphan_shadow_topics'))),
 034              array('module.add', array(
 035                  'acp',
 036                  'ACP_MESSAGES',
 037                  array(
 038                      'module_basename'    => 'acp_board',
 039                      'modes'                => array('post'),
 040                  ),
 041              )),
 042              array('config.add', array('load_unreads_search', 1)),
 043              array('config.update_if_equals', array(600, 'queue_interval', 60)),
 044              array('config.update_if_equals', array(50, 'email_package_size', 20)),
 045   
 046              array('config.update', array('version', '3.0.8-RC1')),
 047          );
 048      }
 049   
 050      public function update_file_extension_group_names()
 051      {
 052          // Update file extension group names to use language strings.
 053          $sql = 'SELECT lang_dir
 054              FROM ' . LANG_TABLE;
 055          $result = $this->db->sql_query($sql);
 056   
 057          $extension_groups_updated = array();
 058          while ($lang_dir = $this->db->sql_fetchfield('lang_dir'))
 059          {
 060              $lang_dir = basename($lang_dir);
 061   
 062              // The language strings we need are either in language/.../acp/attachments.php
 063              // in the update package if we're updating to 3.0.8-RC1 or later,
 064              // or they are in language/.../install.php when we're updating from 3.0.7-PL1 or earlier.
 065              // On an already updated board, they can also already be in language/.../acp/attachments.php
 066              // in the board root.
 067              $lang_files = array(
 068                  "{$this->phpbb_root_path}install/update/new/language/$lang_dir/acp/attachments.{$this->php_ext}",
 069                  "{$this->phpbb_root_path}language/$lang_dir/install.{$this->php_ext}",
 070                  "{$this->phpbb_root_path}language/$lang_dir/acp/attachments.{$this->php_ext}",
 071              );
 072   
 073              foreach ($lang_files as $lang_file)
 074              {
 075                  if (!file_exists($lang_file))
 076                  {
 077                      continue;
 078                  }
 079   
 080                  $lang = array();
 081                  include($lang_file);
 082   
 083                  foreach($lang as $lang_key => $lang_val)
 084                  {
 085                      if (isset($extension_groups_updated[$lang_key]) || strpos($lang_key, 'EXT_GROUP_') !== 0)
 086                      {
 087                          continue;
 088                      }
 089   
 090                      $sql_ary = array(
 091                          'group_name'    => substr($lang_key, 10), // Strip off 'EXT_GROUP_'
 092                      );
 093   
 094                      $sql = 'UPDATE ' . EXTENSION_GROUPS_TABLE . '
 095                          SET ' . $this->db->sql_build_array('UPDATE', $sql_ary) . "
 096                          WHERE group_name = '" . $this->db->sql_escape($lang_val) . "'";
 097                      $this->sql_query($sql);
 098   
 099                      $extension_groups_updated[$lang_key] = true;
 100                  }
 101              }
 102          }
 103          $this->db->sql_freeresult($result);
 104      }
 105   
 106      public function update_module_auth()
 107      {
 108          $sql = 'UPDATE ' . MODULES_TABLE . '
 109              SET module_auth = \'cfg_allow_avatar && (cfg_allow_avatar_local || cfg_allow_avatar_remote || cfg_allow_avatar_upload || cfg_allow_avatar_remote_upload)\'
 110              WHERE module_class = \'ucp\'
 111                  AND module_basename = \'profile\'
 112                  AND module_mode = \'avatar\'';
 113          $this->sql_query($sql);
 114      }
 115   
 116      public function delete_orphan_shadow_topics()
 117      {
 118          // Delete shadow topics pointing to not existing topics
 119          $batch_size = 500;
 120   
 121          // Set of affected forums we have to resync
 122          $sync_forum_ids = array();
 123   
 124          $sql_array = array(
 125              'SELECT'    => 't1.topic_id, t1.forum_id',
 126              'FROM'        => array(
 127                  TOPICS_TABLE    => 't1',
 128              ),
 129              'LEFT_JOIN'    => array(
 130                  array(
 131                      'FROM'    => array(TOPICS_TABLE    => 't2'),
 132                      'ON'    => 't1.topic_moved_id = t2.topic_id',
 133                  ),
 134              ),
 135              'WHERE'        => 't1.topic_moved_id <> 0
 136                          AND t2.topic_id IS NULL',
 137          );
 138          $sql = $this->db->sql_build_query('SELECT', $sql_array);
 139          $result = $this->db->sql_query_limit($sql, $batch_size);
 140   
 141          $topic_ids = array();
 142          while ($row = $this->db->sql_fetchrow($result))
 143          {
 144              $topic_ids[] = (int) $row['topic_id'];
 145   
 146              $sync_forum_ids[(int) $row['forum_id']] = (int) $row['forum_id'];
 147          }
 148          $this->db->sql_freeresult($result);
 149   
 150          if (!empty($topic_ids))
 151          {
 152              $sql = 'DELETE FROM ' . TOPICS_TABLE . '
 153                  WHERE ' . $this->db->sql_in_set('topic_id', $topic_ids);
 154              $this->db->sql_query($sql);
 155   
 156              // Sync the forums we have deleted shadow topics from.
 157              sync('forum', 'forum_id', $sync_forum_ids, true, true);
 158   
 159              return false;
 160          }
 161      }
 162  }
 163