mirror of
https://github.com/vrana/adminer.git
synced 2025-08-06 14:46:36 +02:00
Doc-comment: Use type aliases for arrays
Type aliases could be defined either globally (https://phpstan.org/writing-php-code/phpdoc-types#global-type-aliases) or just for a class. I prefer having them at the place where they are created.
This commit is contained in:
@@ -443,7 +443,7 @@ if (!defined('Adminer\DRIVER')) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Connect to the database
|
/** Connect to the database
|
||||||
* @param array [$server, $username, $password]
|
* @param array{string, string, string} [$server, $username, $password]
|
||||||
* @return mixed Db or string for error
|
* @return mixed Db or string for error
|
||||||
*/
|
*/
|
||||||
function connect($credentials) {
|
function connect($credentials) {
|
||||||
@@ -549,7 +549,8 @@ if (!defined('Adminer\DRIVER')) {
|
|||||||
/** Get table status
|
/** Get table status
|
||||||
* @param string
|
* @param string
|
||||||
* @param bool return only "Name", "Engine" and "Comment" fields
|
* @param bool return only "Name", "Engine" and "Comment" fields
|
||||||
* @return array{Name:string, Engine:string, Comment:string, Oid:int, Rows:int, Collation:string, Auto_increment:int, Data_length:int, Index_length:int, Data_free:int}[]
|
* @return TableStatus[]
|
||||||
|
* @phpstan-type TableStatus array{Name:string, Engine:string, Comment:string, Oid:int, Rows:int, Collation:string, Auto_increment:int, Data_length:int, Index_length:int, Data_free:int}
|
||||||
*/
|
*/
|
||||||
function table_status($name = "", $fast = false) {
|
function table_status($name = "", $fast = false) {
|
||||||
$return = array();
|
$return = array();
|
||||||
@@ -577,7 +578,7 @@ if (!defined('Adminer\DRIVER')) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Find out whether the identifier is view
|
/** Find out whether the identifier is view
|
||||||
* @param array
|
* @param TableStatus
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
function is_view($table_status) {
|
function is_view($table_status) {
|
||||||
@@ -585,7 +586,7 @@ if (!defined('Adminer\DRIVER')) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Check if table supports foreign keys
|
/** Check if table supports foreign keys
|
||||||
* @param array result of table_status
|
* @param TableStatus result of table_status1()
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
function fk_support($table_status) {
|
function fk_support($table_status) {
|
||||||
@@ -595,7 +596,8 @@ if (!defined('Adminer\DRIVER')) {
|
|||||||
|
|
||||||
/** Get information about fields
|
/** Get information about fields
|
||||||
* @param string
|
* @param string
|
||||||
* @return array{field:string, full_type:string, type:string, length:int, unsigned:string, default:string, null:bool, auto_increment:bool, on_update:string, collation:string, privileges:int[], comment:string, primary:bool, generated:string}[]
|
* @return Field[]
|
||||||
|
* @phpstan-type Field array{field:string, full_type:string, type:string, length:int, unsigned:string, default:string, null:bool, auto_increment:bool, on_update:string, collation:string, privileges:int[], comment:string, primary:bool, generated:string}
|
||||||
*/
|
*/
|
||||||
function fields($table) {
|
function fields($table) {
|
||||||
global $connection;
|
global $connection;
|
||||||
@@ -651,7 +653,8 @@ if (!defined('Adminer\DRIVER')) {
|
|||||||
/** Get table indexes
|
/** Get table indexes
|
||||||
* @param string
|
* @param string
|
||||||
* @param string Db to use
|
* @param string Db to use
|
||||||
* @return array{type:string, columns:list<string>, lengths:list<int>, descs:list<bool>}[]
|
* @return Index[]
|
||||||
|
* @phpstan-type Index array{type:string, columns:list<string>, lengths:list<int>, descs:list<bool>}
|
||||||
*/
|
*/
|
||||||
function indexes($table, $connection2 = null) {
|
function indexes($table, $connection2 = null) {
|
||||||
$return = array();
|
$return = array();
|
||||||
@@ -667,7 +670,8 @@ if (!defined('Adminer\DRIVER')) {
|
|||||||
|
|
||||||
/** Get foreign keys in table
|
/** Get foreign keys in table
|
||||||
* @param string
|
* @param string
|
||||||
* @return array{db:string, ns:string, table:string, source:list<string>, target:list<string>, on_delete:string, on_update:string}[]
|
* @return ForeignKey[]
|
||||||
|
* @phpstan-type ForeignKey array{db:string, ns:string, table:string, source:list<string>, target:list<string>, on_delete:string, on_update:string}
|
||||||
*/
|
*/
|
||||||
function foreign_keys($table) {
|
function foreign_keys($table) {
|
||||||
global $driver;
|
global $driver;
|
||||||
@@ -807,7 +811,7 @@ if (!defined('Adminer\DRIVER')) {
|
|||||||
/** Run commands to create or alter table
|
/** Run commands to create or alter table
|
||||||
* @param string "" to create
|
* @param string "" to create
|
||||||
* @param string new name
|
* @param string new name
|
||||||
* @param array of [$orig, $process_field, $after]
|
* @param list<array{string, list<string>, string}> of [$orig, $process_field, $after]
|
||||||
* @param list<string>
|
* @param list<string>
|
||||||
* @param string
|
* @param string
|
||||||
* @param string
|
* @param string
|
||||||
@@ -852,7 +856,7 @@ if (!defined('Adminer\DRIVER')) {
|
|||||||
|
|
||||||
/** Run commands to alter indexes
|
/** Run commands to alter indexes
|
||||||
* @param string escaped table name
|
* @param string escaped table name
|
||||||
* @param array[] of ["index type", "name", ["column definition", ...]] or ["index type", "name", "DROP"]
|
* @param array{string, string, 'DROP'|list<string>} of ["index type", "name", ["column definition", ...]] or ["index type", "name", "DROP"]
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
function alter_indexes($table, $alter) {
|
function alter_indexes($table, $alter) {
|
||||||
@@ -958,7 +962,8 @@ if (!defined('Adminer\DRIVER')) {
|
|||||||
|
|
||||||
/** Get information about trigger
|
/** Get information about trigger
|
||||||
* @param string trigger name
|
* @param string trigger name
|
||||||
* @return array{Trigger:string, Timing:string, Event:string, Of:string, Type:string, Statement:string}
|
* @return Trigger
|
||||||
|
* @phpstan-type Trigger array{Trigger:string, Timing:string, Event:string, Of:string, Type:string, Statement:string}
|
||||||
*/
|
*/
|
||||||
function trigger($name) {
|
function trigger($name) {
|
||||||
if ($name == "") {
|
if ($name == "") {
|
||||||
@@ -970,7 +975,7 @@ if (!defined('Adminer\DRIVER')) {
|
|||||||
|
|
||||||
/** Get defined triggers
|
/** Get defined triggers
|
||||||
* @param string
|
* @param string
|
||||||
* @return array{string, string}[]4
|
* @return array{string, string}[]
|
||||||
*/
|
*/
|
||||||
function triggers($table) {
|
function triggers($table) {
|
||||||
$return = array();
|
$return = array();
|
||||||
@@ -994,7 +999,8 @@ if (!defined('Adminer\DRIVER')) {
|
|||||||
/** Get information about stored routine
|
/** Get information about stored routine
|
||||||
* @param string
|
* @param string
|
||||||
* @param string "FUNCTION" or "PROCEDURE"
|
* @param string "FUNCTION" or "PROCEDURE"
|
||||||
* @return array{fields:list<array{field:string, type:string, length:string, unsigned:string, null:bool, full_type:string, inout:string, collation:string}>, comment:string, returns:array, definition:string, language:string}
|
* @return Routine
|
||||||
|
* @phpstan-type Routine array{fields:list<array{field:string, type:string, length:string, unsigned:string, null:bool, full_type:string, inout:string, collation:string}>, comment:string, returns:array, definition:string, language:string}
|
||||||
*/
|
*/
|
||||||
function routine($name, $type) {
|
function routine($name, $type) {
|
||||||
global $driver;
|
global $driver;
|
||||||
@@ -1046,7 +1052,7 @@ if (!defined('Adminer\DRIVER')) {
|
|||||||
|
|
||||||
/** Get routine signature
|
/** Get routine signature
|
||||||
* @param string
|
* @param string
|
||||||
* @param array result of routine()
|
* @param Routine result of routine()
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function routine_id($name, $row) {
|
function routine_id($name, $row) {
|
||||||
@@ -1071,7 +1077,7 @@ if (!defined('Adminer\DRIVER')) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Get approximate number of rows
|
/** Get approximate number of rows
|
||||||
* @param array
|
* @param TableStatus
|
||||||
* @param list<string>
|
* @param list<string>
|
||||||
* @return int or null if approximate number can't be retrieved
|
* @return int or null if approximate number can't be retrieved
|
||||||
*/
|
*/
|
||||||
@@ -1178,7 +1184,7 @@ if (!defined('Adminer\DRIVER')) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Convert field in select and edit
|
/** Convert field in select and edit
|
||||||
* @param array one element from fields()
|
* @param Field one element from fields()
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function convert_field($field) {
|
function convert_field($field) {
|
||||||
@@ -1194,7 +1200,7 @@ if (!defined('Adminer\DRIVER')) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Convert value in edit after applying functions back
|
/** Convert value in edit after applying functions back
|
||||||
* @param array one element from fields()
|
* @param Field one element from fields()
|
||||||
* @param string SQL expression
|
* @param string SQL expression
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
|
@@ -471,7 +471,7 @@ if (isset($_GET["sqlite"])) {
|
|||||||
* @param string[] [$original => idf_escape($new_column)], empty to preserve
|
* @param string[] [$original => idf_escape($new_column)], empty to preserve
|
||||||
* @param string [format_foreign_key()], empty to preserve
|
* @param string [format_foreign_key()], empty to preserve
|
||||||
* @param int set auto_increment to this value, 0 to preserve
|
* @param int set auto_increment to this value, 0 to preserve
|
||||||
* @param array[] [[$type, $name, $columns]], empty to preserve
|
* @param list<array{string, string, list<string>|'DROP'}> [[$type, $name, $columns]], empty to preserve
|
||||||
* @param string CHECK constraint to drop
|
* @param string CHECK constraint to drop
|
||||||
* @param string CHECK constraint to add
|
* @param string CHECK constraint to add
|
||||||
* @return bool
|
* @return bool
|
||||||
|
@@ -159,7 +159,7 @@ class Adminer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Table caption used in navigation and headings
|
/** Table caption used in navigation and headings
|
||||||
* @param array result of SHOW TABLE STATUS
|
* @param TableStatus result of table_status1()
|
||||||
* @return string HTML code, "" to ignore table
|
* @return string HTML code, "" to ignore table
|
||||||
*/
|
*/
|
||||||
function tableName($tableStatus) {
|
function tableName($tableStatus) {
|
||||||
@@ -167,7 +167,7 @@ class Adminer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Field caption used in select and edit
|
/** Field caption used in select and edit
|
||||||
* @param array single field returned from fields()
|
* @param Field single field returned from fields()
|
||||||
* @param int order of column in select
|
* @param int order of column in select
|
||||||
* @return string HTML code, "" to ignore field
|
* @return string HTML code, "" to ignore field
|
||||||
*/
|
*/
|
||||||
@@ -178,7 +178,7 @@ class Adminer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Print links after select heading
|
/** Print links after select heading
|
||||||
* @param array result of SHOW TABLE STATUS
|
* @param TableStatus result of table_status1()
|
||||||
* @param string new item options, NULL for no new item
|
* @param string new item options, NULL for no new item
|
||||||
* @return null
|
* @return null
|
||||||
*/
|
*/
|
||||||
@@ -211,7 +211,7 @@ class Adminer {
|
|||||||
|
|
||||||
/** Get foreign keys for table
|
/** Get foreign keys for table
|
||||||
* @param string
|
* @param string
|
||||||
* @return array[] same format as foreign_keys()
|
* @return ForeignKey[] same format as foreign_keys()
|
||||||
*/
|
*/
|
||||||
function foreignKeys($table) {
|
function foreignKeys($table) {
|
||||||
return foreign_keys($table);
|
return foreign_keys($table);
|
||||||
@@ -220,14 +220,15 @@ class Adminer {
|
|||||||
/** Find backward keys for table
|
/** Find backward keys for table
|
||||||
* @param string
|
* @param string
|
||||||
* @param string
|
* @param string
|
||||||
* @return array{keys:string[][], name:string}[]
|
* @return BackwardKey[]
|
||||||
|
* @phpstan-type BackwardKey array{name:string, keys:string[][]}
|
||||||
*/
|
*/
|
||||||
function backwardKeys($table, $tableName) {
|
function backwardKeys($table, $tableName) {
|
||||||
return array();
|
return array();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Print backward keys for row
|
/** Print backward keys for row
|
||||||
* @param array[] result of $this->backwardKeys()
|
* @param BackwardKey[] result of $this->backwardKeys()
|
||||||
* @param string[]
|
* @param string[]
|
||||||
* @return null
|
* @return null
|
||||||
*/
|
*/
|
||||||
@@ -278,7 +279,7 @@ class Adminer {
|
|||||||
|
|
||||||
/** Get descriptions of selected data
|
/** Get descriptions of selected data
|
||||||
* @param list<string[]> all data to print
|
* @param list<string[]> all data to print
|
||||||
* @param array[]
|
* @param ForeignKey[]
|
||||||
* @return list<string[]>
|
* @return list<string[]>
|
||||||
*/
|
*/
|
||||||
function rowDescriptions($rows, $foreignKeys) {
|
function rowDescriptions($rows, $foreignKeys) {
|
||||||
@@ -287,7 +288,7 @@ class Adminer {
|
|||||||
|
|
||||||
/** Get a link to use in select table
|
/** Get a link to use in select table
|
||||||
* @param string raw value of the field
|
* @param string raw value of the field
|
||||||
* @param array single field returned from fields()
|
* @param Field single field returned from fields()
|
||||||
* @return string or null to create the default link
|
* @return string or null to create the default link
|
||||||
*/
|
*/
|
||||||
function selectLink($val, $field) {
|
function selectLink($val, $field) {
|
||||||
@@ -296,7 +297,7 @@ class Adminer {
|
|||||||
/** Value printed in select table
|
/** Value printed in select table
|
||||||
* @param string HTML-escaped value to print
|
* @param string HTML-escaped value to print
|
||||||
* @param string link to foreign key
|
* @param string link to foreign key
|
||||||
* @param array single field returned from fields()
|
* @param Field single field returned from fields()
|
||||||
* @param string original value before applying editVal() and escaping
|
* @param string original value before applying editVal() and escaping
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
@@ -314,7 +315,7 @@ class Adminer {
|
|||||||
|
|
||||||
/** Value conversion used in select and edit
|
/** Value conversion used in select and edit
|
||||||
* @param string
|
* @param string
|
||||||
* @param array single field returned from fields()
|
* @param Field single field returned from fields()
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function editVal($val, $field) {
|
function editVal($val, $field) {
|
||||||
@@ -322,8 +323,8 @@ class Adminer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Print table structure in tabular format
|
/** Print table structure in tabular format
|
||||||
* @param array[] data about individual fields
|
* @param Field[] data about individual fields
|
||||||
* @param array
|
* @param TableStatus
|
||||||
* @return null
|
* @return null
|
||||||
*/
|
*/
|
||||||
function tableStructurePrint($fields, $tableStatus = null) {
|
function tableStructurePrint($fields, $tableStatus = null) {
|
||||||
@@ -354,7 +355,7 @@ class Adminer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Print list of indexes on table in tabular format
|
/** Print list of indexes on table in tabular format
|
||||||
* @param array[] data about all indexes on a table
|
* @param Index[] data about all indexes on a table
|
||||||
* @return null
|
* @return null
|
||||||
*/
|
*/
|
||||||
function tableIndexesPrint($indexes) {
|
function tableIndexesPrint($indexes) {
|
||||||
@@ -403,7 +404,7 @@ class Adminer {
|
|||||||
/** Print search box in select
|
/** Print search box in select
|
||||||
* @param list<string> result of selectSearchProcess()
|
* @param list<string> result of selectSearchProcess()
|
||||||
* @param string[] selectable columns
|
* @param string[] selectable columns
|
||||||
* @param array[]
|
* @param Index[]
|
||||||
* @return null
|
* @return null
|
||||||
*/
|
*/
|
||||||
function selectSearchPrint($where, $columns, $indexes) {
|
function selectSearchPrint($where, $columns, $indexes) {
|
||||||
@@ -439,7 +440,7 @@ class Adminer {
|
|||||||
/** Print order box in select
|
/** Print order box in select
|
||||||
* @param list<string> result of selectOrderProcess()
|
* @param list<string> result of selectOrderProcess()
|
||||||
* @param string[] selectable columns
|
* @param string[] selectable columns
|
||||||
* @param array[]
|
* @param Index[]
|
||||||
* @return null
|
* @return null
|
||||||
*/
|
*/
|
||||||
function selectOrderPrint($order, $columns, $indexes) {
|
function selectOrderPrint($order, $columns, $indexes) {
|
||||||
@@ -481,7 +482,7 @@ class Adminer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Print action box in select
|
/** Print action box in select
|
||||||
* @param array[]
|
* @param Index[]
|
||||||
* @return null
|
* @return null
|
||||||
*/
|
*/
|
||||||
function selectActionPrint($indexes) {
|
function selectActionPrint($indexes) {
|
||||||
@@ -531,7 +532,7 @@ class Adminer {
|
|||||||
|
|
||||||
/** Process columns box in select
|
/** Process columns box in select
|
||||||
* @param string[] selectable columns
|
* @param string[] selectable columns
|
||||||
* @param array[]
|
* @param Index[]
|
||||||
* @return list<list<string>> [[select_expressions], [group_expressions]]
|
* @return list<list<string>> [[select_expressions], [group_expressions]]
|
||||||
*/
|
*/
|
||||||
function selectColumnsProcess($columns, $indexes) {
|
function selectColumnsProcess($columns, $indexes) {
|
||||||
@@ -550,8 +551,8 @@ class Adminer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Process search box in select
|
/** Process search box in select
|
||||||
* @param array[]
|
* @param Field[]
|
||||||
* @param array[]
|
* @param Index[]
|
||||||
* @return list<string> expressions to join by AND
|
* @return list<string> expressions to join by AND
|
||||||
*/
|
*/
|
||||||
function selectSearchProcess($fields, $indexes) {
|
function selectSearchProcess($fields, $indexes) {
|
||||||
@@ -604,8 +605,8 @@ class Adminer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Process order box in select
|
/** Process order box in select
|
||||||
* @param array[]
|
* @param Field[]
|
||||||
* @param array[]
|
* @param Index[]
|
||||||
* @return list<string> expressions to join by comma
|
* @return list<string> expressions to join by comma
|
||||||
*/
|
*/
|
||||||
function selectOrderProcess($fields, $indexes) {
|
function selectOrderProcess($fields, $indexes) {
|
||||||
@@ -636,7 +637,7 @@ class Adminer {
|
|||||||
|
|
||||||
/** Process extras in select form
|
/** Process extras in select form
|
||||||
* @param string[] AND conditions
|
* @param string[] AND conditions
|
||||||
* @param array[]
|
* @param ForeignKey[]
|
||||||
* @return bool true if processed, false to process other parts of form
|
* @return bool true if processed, false to process other parts of form
|
||||||
*/
|
*/
|
||||||
function selectEmailProcess($where, $foreignKeys) {
|
function selectEmailProcess($where, $foreignKeys) {
|
||||||
@@ -698,7 +699,7 @@ class Adminer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Functions displayed in edit form
|
/** Functions displayed in edit form
|
||||||
* @param array single field from fields()
|
* @param Field single field from fields()
|
||||||
* @return list<string>
|
* @return list<string>
|
||||||
*/
|
*/
|
||||||
function editFunctions($field) {
|
function editFunctions($field) {
|
||||||
@@ -725,7 +726,7 @@ class Adminer {
|
|||||||
|
|
||||||
/** Get options to display edit field
|
/** Get options to display edit field
|
||||||
* @param string table name
|
* @param string table name
|
||||||
* @param array single field from fields()
|
* @param Field single field from fields()
|
||||||
* @param string attributes to use inside the tag
|
* @param string attributes to use inside the tag
|
||||||
* @param string
|
* @param string
|
||||||
* @return string custom input field or empty string for default
|
* @return string custom input field or empty string for default
|
||||||
@@ -742,7 +743,7 @@ class Adminer {
|
|||||||
|
|
||||||
/** Get hint for edit field
|
/** Get hint for edit field
|
||||||
* @param string table name
|
* @param string table name
|
||||||
* @param array single field from fields()
|
* @param Field single field from fields()
|
||||||
* @param string
|
* @param string
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
@@ -751,7 +752,7 @@ class Adminer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Process sent input
|
/** Process sent input
|
||||||
* @param array single field from fields()
|
* @param Field single field from fields()
|
||||||
* @param string
|
* @param string
|
||||||
* @param string
|
* @param string
|
||||||
* @return string expression to use in a query
|
* @return string expression to use in a query
|
||||||
@@ -1051,7 +1052,7 @@ class Adminer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Set up syntax highlight for code and <textarea>
|
/** Set up syntax highlight for code and <textarea>
|
||||||
* @param array[] result of table_status('', true)
|
* @param TableStatus[] result of table_status('', true)
|
||||||
*/
|
*/
|
||||||
function syntaxHighlighting($tables) {
|
function syntaxHighlighting($tables) {
|
||||||
global $connection;
|
global $connection;
|
||||||
@@ -1116,7 +1117,7 @@ class Adminer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Print table list in menu
|
/** Print table list in menu
|
||||||
* @param array result of table_status('', true)
|
* @param TableStatus[] result of table_status('', true)
|
||||||
* @return null
|
* @return null
|
||||||
*/
|
*/
|
||||||
function tablesPrint($tables) {
|
function tablesPrint($tables) {
|
||||||
|
@@ -60,14 +60,14 @@ abstract class SqlDriver {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Get enum values
|
/** Get enum values
|
||||||
* @param array
|
* @param Field
|
||||||
* @return string or null
|
* @return string or null
|
||||||
*/
|
*/
|
||||||
function enumLength($field) {
|
function enumLength($field) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Function used to convert the value inputted by user
|
/** Function used to convert the value inputted by user
|
||||||
* @param array
|
* @param Field
|
||||||
* @return string or null
|
* @return string or null
|
||||||
*/
|
*/
|
||||||
function unconvertFunction($field) {
|
function unconvertFunction($field) {
|
||||||
@@ -194,8 +194,8 @@ abstract class SqlDriver {
|
|||||||
|
|
||||||
/** Convert column to be searchable
|
/** Convert column to be searchable
|
||||||
* @param string escaped column name
|
* @param string escaped column name
|
||||||
* @param array ["op" => , "val" => ]
|
* @param array{op:string, val:string}
|
||||||
* @param array
|
* @param Field
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function convertSearch($idf, $val, $field) {
|
function convertSearch($idf, $val, $field) {
|
||||||
@@ -212,7 +212,7 @@ abstract class SqlDriver {
|
|||||||
|
|
||||||
/** Convert value returned by database to actual value
|
/** Convert value returned by database to actual value
|
||||||
* @param string
|
* @param string
|
||||||
* @param array
|
* @param Field
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function value($val, $field) {
|
function value($val, $field) {
|
||||||
@@ -260,7 +260,7 @@ abstract class SqlDriver {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Check whether table supports indexes
|
/** Check whether table supports indexes
|
||||||
* @param array result of table_status1()
|
* @param TableStatus result of table_status1()
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
function supportsIndex($table_status) {
|
function supportsIndex($table_status) {
|
||||||
|
@@ -102,7 +102,7 @@ function select($result, $connection2 = null, $orgtables = array(), $limit = 0)
|
|||||||
|
|
||||||
/** Get referencable tables with single column primary key except self
|
/** Get referencable tables with single column primary key except self
|
||||||
* @param string
|
* @param string
|
||||||
* @return array[] [$table_name => $field]
|
* @return Field[] [$table_name => $field]
|
||||||
*/
|
*/
|
||||||
function referencable_primary($self) {
|
function referencable_primary($self) {
|
||||||
$return = array(); // table_name => field
|
$return = array(); // table_name => field
|
||||||
@@ -178,9 +178,9 @@ function json_row($key, $val = null) {
|
|||||||
|
|
||||||
/** Print table columns for type edit
|
/** Print table columns for type edit
|
||||||
* @param string
|
* @param string
|
||||||
* @param list<string>[]
|
* @param Field
|
||||||
* @param array[]
|
* @param list<string>
|
||||||
* @param array[] returned by referencable_primary()
|
* @param Field[] returned by referencable_primary()
|
||||||
* @param list<string> extra types to prepend
|
* @param list<string> extra types to prepend
|
||||||
* @return null
|
* @return null
|
||||||
*/
|
*/
|
||||||
@@ -246,7 +246,7 @@ function process_length($length) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Create SQL string from field type
|
/** Create SQL string from field type
|
||||||
* @param array
|
* @param Field
|
||||||
* @param string
|
* @param string
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
@@ -260,8 +260,8 @@ function process_type($field, $collate = "COLLATE") {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Create SQL string from field
|
/** Create SQL string from field
|
||||||
* @param array basic field information
|
* @param Field basic field information
|
||||||
* @param array information about field type
|
* @param Field information about field type
|
||||||
* @return list<string> ["field", "type", "NULL", "DEFAULT", "ON UPDATE", "COMMENT", "AUTO_INCREMENT"]
|
* @return list<string> ["field", "type", "NULL", "DEFAULT", "ON UPDATE", "COMMENT", "AUTO_INCREMENT"]
|
||||||
*/
|
*/
|
||||||
function process_field($field, $type_field) {
|
function process_field($field, $type_field) {
|
||||||
@@ -281,7 +281,7 @@ function process_field($field, $type_field) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Get default value clause
|
/** Get default value clause
|
||||||
* @param array
|
* @param Field
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function default_value($field) {
|
function default_value($field) {
|
||||||
@@ -317,10 +317,10 @@ function type_class($type) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Print table interior for fields editing
|
/** Print table interior for fields editing
|
||||||
* @param array[]
|
* @param Field[]
|
||||||
* @param list<string>[]
|
* @param list<string>[]
|
||||||
* @param string TABLE or PROCEDURE
|
* @param string TABLE or PROCEDURE
|
||||||
* @param array[] returned by referencable_primary()
|
* @param Field[] returned by referencable_primary()
|
||||||
* @return null
|
* @return null
|
||||||
*/
|
*/
|
||||||
function edit_fields($fields, $collations, $type = "TABLE", $foreign_keys = array()) {
|
function edit_fields($fields, $collations, $type = "TABLE", $foreign_keys = array()) {
|
||||||
@@ -382,7 +382,7 @@ function edit_fields($fields, $collations, $type = "TABLE", $foreign_keys = arra
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Move fields up and down or add field
|
/** Move fields up and down or add field
|
||||||
* @param array[]
|
* @param Field[]
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
function process_fields(&$fields) {
|
function process_fields(&$fields) {
|
||||||
@@ -487,7 +487,7 @@ function drop_create($drop, $create, $drop_created, $test, $drop_test, $location
|
|||||||
|
|
||||||
/** Generate SQL query for creating trigger
|
/** Generate SQL query for creating trigger
|
||||||
* @param string
|
* @param string
|
||||||
* @param array result of trigger()
|
* @param Trigger result of trigger()
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function create_trigger($on, $row) {
|
function create_trigger($on, $row) {
|
||||||
@@ -534,7 +534,7 @@ function remove_definer($query) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Format foreign key to use in SQL query
|
/** Format foreign key to use in SQL query
|
||||||
* @param array ["db" => string, "ns" => string, "table" => string, "source" => array, "target" => array, "on_delete" => one of $on_actions, "on_update" => one of $on_actions]
|
* @param ForeignKey
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function format_foreign_key($foreign_key) {
|
function format_foreign_key($foreign_key) {
|
||||||
|
@@ -262,7 +262,7 @@ function get_rows($query, $connection2 = null, $error = "<p class='error'>") {
|
|||||||
|
|
||||||
/** Find unique identifier of a row
|
/** Find unique identifier of a row
|
||||||
* @param string[]
|
* @param string[]
|
||||||
* @param array[] result of indexes()
|
* @param Index[] result of indexes()
|
||||||
* @return string[] or null if there is no unique identifier
|
* @return string[] or null if there is no unique identifier
|
||||||
*/
|
*/
|
||||||
function unique_array($row, $indexes) {
|
function unique_array($row, $indexes) {
|
||||||
@@ -292,8 +292,8 @@ function escape_key($key) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Create SQL condition from parsed query string
|
/** Create SQL condition from parsed query string
|
||||||
* @param array parsed query string
|
* @param array{where:string[], null:list<string>} parsed query string
|
||||||
* @param array[]
|
* @param Field[]
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function where($where, $fields = array()) {
|
function where($where, $fields = array()) {
|
||||||
@@ -321,7 +321,7 @@ function where($where, $fields = array()) {
|
|||||||
|
|
||||||
/** Create SQL condition from query string
|
/** Create SQL condition from query string
|
||||||
* @param string
|
* @param string
|
||||||
* @param array[]
|
* @param Field[]
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function where_check($val, $fields = array()) {
|
function where_check($val, $fields = array()) {
|
||||||
@@ -343,7 +343,7 @@ function where_link($i, $column, $value, $operator = "=") {
|
|||||||
|
|
||||||
/** Get select clause for convertible fields
|
/** Get select clause for convertible fields
|
||||||
* @param string[]
|
* @param string[]
|
||||||
* @param array[]
|
* @param Field[]
|
||||||
* @param list<string>
|
* @param list<string>
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
@@ -701,7 +701,7 @@ function friendly_url($val) {
|
|||||||
/** Get status of a single table and fall back to name on error
|
/** Get status of a single table and fall back to name on error
|
||||||
* @param string
|
* @param string
|
||||||
* @param bool
|
* @param bool
|
||||||
* @return array one element from table_status()
|
* @return TableStatus one element from table_status()
|
||||||
*/
|
*/
|
||||||
function table_status1($table, $fast = false) {
|
function table_status1($table, $fast = false) {
|
||||||
$return = table_status($table, $fast);
|
$return = table_status($table, $fast);
|
||||||
@@ -724,7 +724,7 @@ function column_foreign_keys($table) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Compute fields() from $_POST edit data
|
/** Compute fields() from $_POST edit data
|
||||||
* @return array[] same as fields()
|
* @return Field[] same as fields()
|
||||||
*/
|
*/
|
||||||
function fields_from_edit() {
|
function fields_from_edit() {
|
||||||
global $driver;
|
global $driver;
|
||||||
@@ -892,7 +892,7 @@ function rand_string() {
|
|||||||
/** Format value to use in select
|
/** Format value to use in select
|
||||||
* @param string
|
* @param string
|
||||||
* @param string
|
* @param string
|
||||||
* @param array
|
* @param Field
|
||||||
* @param int
|
* @param int
|
||||||
* @return string HTML
|
* @return string HTML
|
||||||
*/
|
*/
|
||||||
@@ -953,7 +953,7 @@ function is_url($string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Check if field should be shortened
|
/** Check if field should be shortened
|
||||||
* @param array
|
* @param Field
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
function is_shortable($field) {
|
function is_shortable($field) {
|
||||||
|
@@ -229,7 +229,7 @@ function hidden_fields_get() {
|
|||||||
/** Print enum or set input field
|
/** Print enum or set input field
|
||||||
* @param string "radio"|"checkbox"
|
* @param string "radio"|"checkbox"
|
||||||
* @param string
|
* @param string
|
||||||
* @param array
|
* @param Field
|
||||||
* @param mixed string|array
|
* @param mixed string|array
|
||||||
* @param string
|
* @param string
|
||||||
* @return null
|
* @return null
|
||||||
@@ -247,7 +247,7 @@ function enum_input($type, $attrs, $field, $value, $empty = null) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Print edit input field
|
/** Print edit input field
|
||||||
* @param array one field from fields()
|
* @param Field one field from fields()
|
||||||
* @param mixed
|
* @param mixed
|
||||||
* @param string
|
* @param string
|
||||||
* @param bool
|
* @param bool
|
||||||
@@ -426,7 +426,7 @@ function on_help($command, $side = 0) {
|
|||||||
|
|
||||||
/** Print edit data form
|
/** Print edit data form
|
||||||
* @param string
|
* @param string
|
||||||
* @param array[]
|
* @param Field[]
|
||||||
* @param mixed
|
* @param mixed
|
||||||
* @param bool
|
* @param bool
|
||||||
* @return null
|
* @return null
|
||||||
|
@@ -15,7 +15,7 @@ function email_header($header) {
|
|||||||
* @param string
|
* @param string
|
||||||
* @param string
|
* @param string
|
||||||
* @param string
|
* @param string
|
||||||
* @param array[]
|
* @param array{error:list<int>, type:list<string>, name:list<string>}
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
function send_mail($email, $subject, $message, $from = "", $files = array()) {
|
function send_mail($email, $subject, $message, $from = "", $files = array()) {
|
||||||
@@ -47,7 +47,7 @@ function send_mail($email, $subject, $message, $from = "", $files = array()) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Check whether the column looks like boolean
|
/** Check whether the column looks like boolean
|
||||||
* @param array single field returned from fields()
|
* @param Field single field returned from fields()
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
function like_bool($field) {
|
function like_bool($field) {
|
||||||
|
@@ -555,7 +555,7 @@ if (isset($_GET["elastic"])) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Drop types
|
/** Drop types
|
||||||
* @param array
|
* @param list<string>
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
function drop_tables($tables) {
|
function drop_tables($tables) {
|
||||||
|
@@ -10,7 +10,7 @@ class AdminerLoginServers {
|
|||||||
protected $servers;
|
protected $servers;
|
||||||
|
|
||||||
/** Set supported servers
|
/** Set supported servers
|
||||||
* @param array[] [$description => ["server" => , "driver" => "server|pgsql|sqlite|..."]]
|
* @param array{server:string, driver:string}[] [$description => ["server" => , "driver" => "server|pgsql|sqlite|..."]]
|
||||||
*/
|
*/
|
||||||
function __construct($servers) {
|
function __construct($servers) {
|
||||||
$this->servers = $servers;
|
$this->servers = $servers;
|
||||||
|
@@ -9,7 +9,7 @@
|
|||||||
class AdminerTableIndexesStructure {
|
class AdminerTableIndexesStructure {
|
||||||
|
|
||||||
/** Print table structure in tabular format
|
/** Print table structure in tabular format
|
||||||
* @param array[] data about all indexes on a table
|
* @param Index[] data about all indexes on a table
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
function tableIndexesPrint($indexes) {
|
function tableIndexesPrint($indexes) {
|
||||||
|
@@ -9,7 +9,7 @@
|
|||||||
class AdminerTableStructure {
|
class AdminerTableStructure {
|
||||||
|
|
||||||
/** Print table structure in tabular format
|
/** Print table structure in tabular format
|
||||||
* @param array[] data about individual fields
|
* @param Field[] data about individual fields
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
function tableStructurePrint($fields, $tableStatus = null) {
|
function tableStructurePrint($fields, $tableStatus = null) {
|
||||||
|
Reference in New Issue
Block a user