Verzeichnisstruktur phpBB-3.2.0


Veröffentlicht
06.01.2017

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

tools_interface.php

Zuletzt modifiziert: 09.10.2024, 12:54 - Dateigröße: 6.37 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\tools;
015   
016  /**
017   * Interface for a Database Tools for handling cross-db actions such as altering columns, etc.
018   */
019  interface tools_interface
020  {
021      /**
022       * Handle passed database update array.
023       * Expected structure...
024       * Key being one of the following
025       *    drop_tables: Drop tables
026       *    add_tables: Add tables
027       *    change_columns: Column changes (only type, not name)
028       *    add_columns: Add columns to a table
029       *    drop_keys: Dropping keys
030       *    drop_columns: Removing/Dropping columns
031       *    add_primary_keys: adding primary keys
032       *    add_unique_index: adding an unique index
033       *    add_index: adding an index (can be column:index_size if you need to provide size)
034       *
035       * The values are in this format:
036       *        {TABLE NAME}        => array(
037       *            {COLUMN NAME}        => array({COLUMN TYPE}, {DEFAULT VALUE}, {OPTIONAL VARIABLES}),
038       *            {KEY/INDEX NAME}    => array({COLUMN NAMES}),
039       *        )
040       *
041       *
042       * @param array $schema_changes
043       * @return null
044       */
045      public function perform_schema_changes($schema_changes);
046   
047      /**
048       * Gets a list of tables in the database.
049       *
050       * @return array        Array of table names  (all lower case)
051       */
052      public function sql_list_tables();
053   
054      /**
055       * Check if table exists
056       *
057       * @param string    $table_name    The table name to check for
058       * @return bool true if table exists, else false
059       */
060      public function sql_table_exists($table_name);
061   
062      /**
063       * Create SQL Table
064       *
065       * @param string    $table_name        The table name to create
066       * @param array        $table_data        Array containing table data.
067       * @return array|true    Statements to run, or true if the statements have been executed
068       */
069      public function sql_create_table($table_name, $table_data);
070   
071      /**
072       * Drop Table
073       *
074       * @param string    $table_name        The table name to drop
075       * @return array|true    Statements to run, or true if the statements have been executed
076       */
077      public function sql_table_drop($table_name);
078   
079      /**
080       * Gets a list of columns of a table.
081       *
082       * @param string $table_name    Table name
083       * @return array        Array of column names (all lower case)
084       */
085      public function sql_list_columns($table_name);
086   
087      /**
088       * Check whether a specified column exist in a table
089       *
090       * @param string    $table_name        Table to check
091       * @param string    $column_name    Column to check
092       * @return bool        True if column exists, false otherwise
093       */
094      public function sql_column_exists($table_name, $column_name);
095   
096      /**
097       * Add new column
098       *
099       * @param string    $table_name        Table to modify
100       * @param string    $column_name    Name of the column to add
101       * @param array        $column_data    Column data
102       * @param bool        $inline            Whether the query should actually be run,
103       *                        or return a string for adding the column
104       * @return array|true    Statements to run, or true if the statements have been executed
105       */
106      public function sql_column_add($table_name, $column_name, $column_data, $inline = false);
107   
108      /**
109       * Change column type (not name!)
110       *
111       * @param string    $table_name        Table to modify
112       * @param string    $column_name    Name of the column to modify
113       * @param array        $column_data    Column data
114       * @param bool        $inline            Whether the query should actually be run,
115       *                        or return a string for modifying the column
116       * @return array|true    Statements to run, or true if the statements have been executed
117       */
118      public function sql_column_change($table_name, $column_name, $column_data, $inline = false);
119   
120      /**
121       * Drop column
122       *
123       * @param string    $table_name        Table to modify
124       * @param string    $column_name    Name of the column to drop
125       * @param bool        $inline            Whether the query should actually be run,
126       *                        or return a string for deleting the column
127       * @return array|true    Statements to run, or true if the statements have been executed
128       */
129      public function sql_column_remove($table_name, $column_name, $inline = false);
130   
131      /**
132       * List all of the indices that belong to a table
133       *
134       * NOTE: does not list
135       * - UNIQUE indices
136       * - PRIMARY keys
137       *
138       * @param string    $table_name        Table to check
139       * @return array        Array with index names
140       */
141      public function sql_list_index($table_name);
142   
143      /**
144       * Check if a specified index exists in table. Does not return PRIMARY KEY and UNIQUE indexes.
145       *
146       * @param string    $table_name        Table to check the index at
147       * @param string    $index_name        The index name to check
148       * @return bool            True if index exists, else false
149       */
150      public function sql_index_exists($table_name, $index_name);
151   
152      /**
153       * Add index
154       *
155       * @param string    $table_name        Table to modify
156       * @param string    $index_name        Name of the index to create
157       * @param string|array    $column        Either a string with a column name, or an array with columns
158       * @return array|true    Statements to run, or true if the statements have been executed
159       */
160      public function sql_create_index($table_name, $index_name, $column);
161   
162      /**
163       * Drop Index
164       *
165       * @param string    $table_name        Table to modify
166       * @param string    $index_name        Name of the index to delete
167       * @return array|true    Statements to run, or true if the statements have been executed
168       */
169      public function sql_index_drop($table_name, $index_name);
170   
171      /**
172       * Check if a specified index exists in table.
173       *
174       * NOTE: Does not return normal and PRIMARY KEY indexes
175       *
176       * @param string    $table_name        Table to check the index at
177       * @param string    $index_name        The index name to check
178       * @return bool True if index exists, else false
179       */
180      public function sql_unique_index_exists($table_name, $index_name);
181   
182      /**
183       * Add unique index
184       *
185       * @param string    $table_name        Table to modify
186       * @param string    $index_name        Name of the unique index to create
187       * @param string|array    $column        Either a string with a column name, or an array with columns
188       * @return array|true    Statements to run, or true if the statements have been executed
189       */
190      public function sql_create_unique_index($table_name, $index_name, $column);
191   
192      /**
193       * Add primary key
194       *
195       * @param string    $table_name        Table to modify
196       * @param string|array    $column        Either a string with a column name, or an array with columns
197       * @param bool        $inline            Whether the query should actually be run,
198       *                        or return a string for creating the key
199       * @return array|true    Statements to run, or true if the statements have been executed
200       */
201      public function sql_create_primary_key($table_name, $column, $inline = false);
202  }
203