Verzeichnisstruktur phpBB-3.3.16


Veröffentlicht
27.04.2026

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

remove_profilefield_aol.php

Zuletzt modifiziert: 01.05.2026, 11:27 - Dateigröße: 3.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\v33x;
 015   
 016  class remove_profilefield_aol extends \phpbb\db\migration\migration
 017  {
 018      public function effectively_installed()
 019      {
 020          return !$this->db_tools->sql_column_exists($this->table_prefix . 'profile_fields_data', 'pf_phpbb_aol');
 021      }
 022   
 023      static public function depends_on()
 024      {
 025          return [
 026              '\phpbb\db\migration\data\v33x\v331',
 027          ];
 028      }
 029   
 030      public function update_schema()
 031      {
 032          return [
 033              'drop_columns'    => [
 034                  $this->table_prefix . 'profile_fields_data'            => [
 035                      'pf_phpbb_aol',
 036                  ],
 037              ],
 038          ];
 039      }
 040   
 041      public function revert_schema()
 042      {
 043          return [
 044              'add_columns'    => [
 045                  $this->table_prefix . 'profile_fields_data'            => [
 046                      'pf_phpbb_aol'        => ['VCHAR', ''],
 047                  ],
 048              ],
 049          ];
 050      }
 051   
 052      public function update_data()
 053      {
 054          return [
 055              ['custom', [[$this, 'delete_custom_profile_field_data']]],
 056          ];
 057      }
 058   
 059      public function revert_data()
 060      {
 061          return [
 062              ['custom', [[$this, 'create_custom_field']]],
 063          ];
 064      }
 065   
 066      public function delete_custom_profile_field_data()
 067      {
 068          $sql = 'SELECT field_id
 069              FROM ' . PROFILE_FIELDS_TABLE . "
 070              WHERE field_name = 'phpbb_aol'";
 071          $result = $this->db->sql_query($sql);
 072          $field_id = (int) $this->db->sql_fetchfield('field_id');
 073          $this->db->sql_freeresult($result);
 074   
 075          $sql = 'DELETE FROM ' . PROFILE_FIELDS_TABLE . '
 076              WHERE field_id = ' . (int) $field_id;
 077          $this->db->sql_query($sql);
 078   
 079          $sql = 'DELETE FROM ' . PROFILE_LANG_TABLE . '
 080              WHERE field_id = ' . (int) $field_id;
 081          $this->db->sql_query($sql);
 082   
 083          $sql = 'DELETE FROM ' . PROFILE_FIELDS_LANG_TABLE . '
 084              WHERE field_id = ' . (int) $field_id;
 085          $this->db->sql_query($sql);
 086      }
 087   
 088      public function create_custom_field()
 089      {
 090          $sql = 'SELECT MAX(field_order) as max_field_order
 091              FROM ' . PROFILE_FIELDS_TABLE;
 092          $result = $this->db->sql_query($sql);
 093          $max_field_order = (int) $this->db->sql_fetchfield('max_field_order');
 094          $this->db->sql_freeresult($result);
 095   
 096          $sql_ary = [
 097              'field_name'            => 'phpbb_aol',
 098              'field_type'            => 'profilefields.type.string',
 099              'field_ident'            => 'phpbb_aol',
 100              'field_length'            => '40',
 101              'field_minlen'            => '5',
 102              'field_maxlen'            => '255',
 103              'field_novalue'            => '',
 104              'field_default_value'    => '',
 105              'field_validation'        => '.*',
 106              'field_required'        => 0,
 107              'field_show_novalue'    => 0,
 108              'field_show_on_reg'        => 0,
 109              'field_show_on_pm'        => 1,
 110              'field_show_on_vt'        => 1,
 111              'field_show_on_ml'        => 0,
 112              'field_show_profile'    => 1,
 113              'field_hide'            => 0,
 114              'field_no_view'            => 0,
 115              'field_active'            => 1,
 116              'field_is_contact'        => 1,
 117              'field_contact_desc'    => '',
 118              'field_contact_url'        => '',
 119              'field_order'            => $max_field_order + 1,
 120          ];
 121   
 122          $sql = 'INSERT INTO ' . PROFILE_FIELDS_TABLE . ' ' . $this->db->sql_build_array('INSERT', $sql_ary);
 123          $this->db->sql_query($sql);
 124          $field_id = (int) $this->db->sql_nextid();
 125   
 126          $insert_buffer = new \phpbb\db\sql_insert_buffer($this->db, PROFILE_LANG_TABLE);
 127   
 128          $sql = 'SELECT lang_id
 129              FROM ' . LANG_TABLE;
 130          $result = $this->db->sql_query($sql);
 131          $lang_name = 'AOL';
 132          while ($lang_id = (int) $this->db->sql_fetchfield('lang_id'))
 133          {
 134              $insert_buffer->insert([
 135                  'field_id'                => (int) $field_id,
 136                  'lang_id'                => (int) $lang_id,
 137                  'lang_name'                => $lang_name,
 138                  'lang_explain'            => '',
 139                  'lang_default_value'    => '',
 140              ]);
 141          }
 142          $this->db->sql_freeresult($result);
 143   
 144          $insert_buffer->flush();
 145      }
 146  }
 147