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

Zuletzt modifiziert: 09.10.2024, 12:57 - Dateigröße: 3.52 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_4_rc1 extends \phpbb\db\migration\migration
017  {
018      public function effectively_installed()
019      {
020          return phpbb_version_compare($this->config['version'], '3.0.4-RC1', '>=');
021      }
022   
023      static public function depends_on()
024      {
025          return array('\phpbb\db\migration\data\v30x\release_3_0_3');
026      }
027   
028      public function update_schema()
029      {
030          return array(
031              'add_columns' => array(
032                  $this->table_prefix . 'profile_fields' => array(
033                      'field_show_profile' => array('BOOL', 0),
034                  ),
035              ),
036              'change_columns' => array(
037                  $this->table_prefix . 'styles' => array(
038                      'style_id' => array('UINT', NULL, 'auto_increment'),
039                      'template_id' => array('UINT', 0),
040                      'theme_id' => array('UINT', 0),
041                      'imageset_id' => array('UINT', 0),
042                  ),
043                  $this->table_prefix . 'styles_imageset' => array(
044                      'imageset_id' => array('UINT', NULL, 'auto_increment'),
045                  ),
046                  $this->table_prefix . 'styles_imageset_data' => array(
047                      'image_id' => array('UINT', NULL, 'auto_increment'),
048                      'imageset_id' => array('UINT', 0),
049                  ),
050                  $this->table_prefix . 'styles_theme' => array(
051                      'theme_id' => array('UINT', NULL, 'auto_increment'),
052                  ),
053                  $this->table_prefix . 'styles_template' => array(
054                      'template_id' => array('UINT', NULL, 'auto_increment'),
055                  ),
056                  $this->table_prefix . 'styles_template_data' => array(
057                      'template_id' => array('UINT', 0),
058                  ),
059                  $this->table_prefix . 'forums' => array(
060                      'forum_style' => array('UINT', 0),
061                  ),
062                  $this->table_prefix . 'users' => array(
063                      'user_style' => array('UINT', 0),
064                  ),
065              ),
066          );
067      }
068   
069      public function revert_schema()
070      {
071          return array(
072              'drop_columns' => array(
073                  $this->table_prefix . 'profile_fields' => array(
074                      'field_show_profile',
075                  ),
076              ),
077          );
078      }
079   
080      public function update_data()
081      {
082          return array(
083              array('custom', array(array(&$this, 'update_custom_profile_fields'))),
084   
085              array('config.update', array('version', '3.0.4-RC1')),
086          );
087      }
088   
089      public function update_custom_profile_fields()
090      {
091          // Update the Custom Profile Fields based on previous settings to the new \format
092          $sql = 'SELECT field_id, field_required, field_show_on_reg, field_hide
093                  FROM ' . PROFILE_FIELDS_TABLE;
094          $result = $this->db->sql_query($sql);
095   
096          while ($row = $this->db->sql_fetchrow($result))
097          {
098              $sql_ary = array(
099                  'field_required'    => 0,
100                  'field_show_on_reg'    => 0,
101                  'field_hide'        => 0,
102                  'field_show_profile'=> 0,
103              );
104   
105              if ($row['field_required'])
106              {
107                  $sql_ary['field_required'] = $sql_ary['field_show_on_reg'] = $sql_ary['field_show_profile'] = 1;
108              }
109              else if ($row['field_show_on_reg'])
110              {
111                  $sql_ary['field_show_on_reg'] = $sql_ary['field_show_profile'] = 1;
112              }
113              else if ($row['field_hide'])
114              {
115                  // Only administrators and moderators can see this CPF, if the view is enabled, they can see it, otherwise just admins in the acp_users module
116                  $sql_ary['field_hide'] = 1;
117              }
118              else
119              {
120                  // equivelant to "none", which is the "Display in user control panel" option
121                  $sql_ary['field_show_profile'] = 1;
122              }
123   
124              $this->sql_query('UPDATE ' . $this->table_prefix . 'profile_fields SET ' . $this->db->sql_build_array('UPDATE', $sql_ary) . ' WHERE field_id = ' . $row['field_id'], $errored, $error_ary);
125          }
126   
127          $this->db->sql_freeresult($result);
128      }
129  }
130