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

teampage.php

Zuletzt modifiziert: 09.10.2024, 12:57 - Dateigröße: 2.56 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\v310;
 015   
 016  class teampage extends \phpbb\db\migration\migration
 017  {
 018      public function effectively_installed()
 019      {
 020          return $this->db_tools->sql_table_exists($this->table_prefix . 'teampage');
 021      }
 022   
 023      static public function depends_on()
 024      {
 025          return array('\phpbb\db\migration\data\v310\dev');
 026      }
 027   
 028      public function update_schema()
 029      {
 030          return array(
 031              'add_tables'        => array(
 032                  $this->table_prefix . 'teampage'    => array(
 033                      'COLUMNS'        => array(
 034                          'teampage_id'        => array('UINT', null, 'auto_increment'),
 035                          'group_id'            => array('UINT', 0),
 036                          'teampage_name'        => array('VCHAR_UNI:255', ''),
 037                          'teampage_position'    => array('UINT', 0),
 038                          'teampage_parent'    => array('UINT', 0),
 039                      ),
 040                      'PRIMARY_KEY'        => 'teampage_id',
 041                  ),
 042              ),
 043              'drop_columns'        => array(
 044                  $this->table_prefix . 'groups'        => array(
 045                      'group_teampage',
 046                  ),
 047              ),
 048          );
 049      }
 050   
 051      public function revert_schema()
 052      {
 053          return array(
 054              'drop_tables'        => array(
 055                  $this->table_prefix . 'teampage',
 056              ),
 057              'add_columns'        => array(
 058                  $this->table_prefix . 'groups'        => array(
 059                      'group_teampage'    => array('UINT', 0, 'after' => 'group_legend'),
 060                  ),
 061              ),
 062          );
 063      }
 064   
 065      public function update_data()
 066      {
 067          return array(
 068              array('custom', array(array($this, 'add_groups_teampage'))),
 069          );
 070      }
 071   
 072      public function add_groups_teampage()
 073      {
 074          $sql = 'SELECT teampage_id
 075              FROM ' . TEAMPAGE_TABLE;
 076          $result = $this->db->sql_query_limit($sql, 1);
 077          $added_groups_teampage = (bool) $this->db->sql_fetchfield('teampage_id');
 078          $this->db->sql_freeresult($result);
 079   
 080          if (!$added_groups_teampage)
 081          {
 082              $sql = 'SELECT *
 083                  FROM ' . GROUPS_TABLE . '
 084                  WHERE group_type = ' . GROUP_SPECIAL . "
 085                      AND (group_name = 'ADMINISTRATORS'
 086                          OR group_name = 'GLOBAL_MODERATORS')
 087                  ORDER BY group_name ASC";
 088              $result = $this->db->sql_query($sql);
 089   
 090              $teampage_entries = array();
 091              while ($row = $this->db->sql_fetchrow($result))
 092              {
 093                  $teampage_entries[] = array(
 094                      'group_id'            => (int) $row['group_id'],
 095                      'teampage_name'        => '',
 096                      'teampage_position'    => sizeof($teampage_entries) + 1,
 097                      'teampage_parent'    => 0,
 098                  );
 099              }
 100              $this->db->sql_freeresult($result);
 101   
 102              if (sizeof($teampage_entries))
 103              {
 104                  $this->db->sql_multi_insert(TEAMPAGE_TABLE, $teampage_entries);
 105              }
 106              unset($teampage_entries);
 107          }
 108   
 109      }
 110  }
 111