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

helper.php

Zuletzt modifiziert: 09.10.2024, 12:54 - Dateigröße: 1.84 KiB


 01  <?php
 02  /**
 03  *
 04  * This file is part of the phpBB Forum Software package.
 05  *
 06  * @copyright (c) phpBB Limited <https://www.phpbb.com>
 07  * @license GNU General Public License, version 2 (GPL-2.0)
 08  *
 09  * For full copyright and license information, please see
 10  * the docs/CREDITS.txt file.
 11  *
 12  */
 13   
 14  namespace phpbb\db\migration;
 15   
 16  /**
 17  * The migrator is responsible for applying new migrations in the correct order.
 18  */
 19  class helper
 20  {
 21      /**
 22       * Get the schema steps from an array of schema changes
 23       *
 24       * This splits up $schema_changes into individual changes so that the
 25       * changes can be chunked
 26       *
 27       * @param array $schema_changes from migration
 28       * @return array
 29       */
 30      public function get_schema_steps($schema_changes)
 31      {
 32          $steps = array();
 33   
 34          // Nested level of data (only supports 1/2 currently)
 35          $nested_level = array(
 36              'drop_tables'        => 1,
 37              'add_tables'        => 1,
 38              'change_columns'    => 2,
 39              'add_columns'        => 2,
 40              'drop_keys'            => 2,
 41              'drop_columns'        => 2,
 42              'add_primary_keys'    => 2, // perform_schema_changes only uses one level, but second is in the function
 43              'add_unique_index'    => 2,
 44              'add_index'            => 2,
 45          );
 46   
 47          foreach ($nested_level as $change_type => $data_depth)
 48          {
 49              if (!empty($schema_changes[$change_type]))
 50              {
 51                  foreach ($schema_changes[$change_type] as $key => $value)
 52                  {
 53                      if ($data_depth === 1)
 54                      {
 55                          $steps[] = array(
 56                              'dbtools.perform_schema_changes', array(array(
 57                                      $change_type    => array(
 58                                          (!is_int($key)) ? $key : 0    => $value,
 59                                  ),
 60                              )),
 61                          );
 62                      }
 63                      else if ($data_depth === 2)
 64                      {
 65                          foreach ($value as $key2 => $value2)
 66                          {
 67                              $steps[] = array(
 68                                  'dbtools.perform_schema_changes', array(array(
 69                                      $change_type    => array(
 70                                          $key => array(
 71                                              $key2    => $value2,
 72                                          ),
 73                                      ),
 74                                  )),
 75                              );
 76                          }
 77                      }
 78                  }
 79              }
 80          }
 81   
 82          return $steps;
 83      }
 84  }
 85