Commit Graph

76 Commits

Author SHA1 Message Date
Maurício Meneghini Fauth
dd885dc7b8
Use single-line arrays when possible
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2023-03-27 17:39:17 -03:00
Maurício Meneghini Fauth
e5698c85e9
Require single line for function calls
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2023-03-26 23:10:10 -03:00
Maurício Meneghini Fauth
437215cab2
Rename variables to use camel case format
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2023-03-26 21:47:50 -03:00
Maurício Meneghini Fauth
8972c0ec22
Merge branch 'QA_5_2'
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2023-03-24 18:15:47 -03:00
Kamil Tekiela
555c6798eb Add native param types
Includes TypeHints.UnionTypeHintFormat

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2023-03-17 12:45:18 +00:00
Kamil Tekiela
e9b9c120af Fix getTablesFull() and related tests
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2023-03-15 19:59:35 +00:00
Kamil Tekiela
3db245f462 Optimize export of many tables
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2023-03-15 19:59:35 +00:00
Kamil Tekiela
142f15f373
Use quoteString in controllers (#18191)
* CreateController

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* FindReplaceController

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* SetVariableController

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* GetVariableController

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* UserGroupsFormController

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* TablesController

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

---------

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2023-03-03 17:40:45 -03:00
Kamil Tekiela
df9d76e2a2 Use quoteString in Events
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2023-03-03 17:37:44 -03:00
Kamil Tekiela
0bdcaba2d2
Add native property types (#18143)
* Add native property types

Includes TypeHints.UnionTypeHintFormat

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Set some default values for properties

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Format and promote properties

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Remove redundant asserts

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Redundant cast

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* $tmanager->theme is never null

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Redundant variable

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Fix empty on $statementInfo bool

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Redundant casts

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Redundant issets

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* getPacked() returns nullable string

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Redundant if

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* $this->content can be null

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Simplify ThemeManager::getInstance()

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Use isset for checking if property is initialized

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Use nullable instead of uninitialized property

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* password is no longer nullable

I can't verify that none of the globals ever tried to set it to null, but the variable should never be nullable.

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Update baselines

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* $same_wide_width param can be float or int

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Update Message.php

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Cast Sub_part to int

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Fix one line doc comments

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

---------

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2023-02-26 23:30:41 -03:00
Maurício Meneghini Fauth
556594b4cd
Fix coding standard spacing issues
- Fixes one line doc comments
- Fixes parent call spacing
- Fixes constant spacing

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2023-02-24 21:06:17 -03:00
Maurício Meneghini Fauth
77957a69a5
Add trailing comma for multi-line functions
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2023-02-24 20:48:46 -03:00
Kamil Tekiela
902d1a1e77
Add native return type hints (#18126)
* Add remaining native return type hints to flush out bugs

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Cast the mixed value to int

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Fix tests

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* getAutoIncrement() is supposed to return string

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Cast values to string in DummyResult

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Make getCollation() return non-nullable string

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Cast seqInIndex to int

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Cast $cardinality to int

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* createFile may return false

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Remove redundant cast

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Update baselines

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

---------

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2023-02-23 15:43:36 -03:00
Maurício Meneghini Fauth
4ff3724c3f
Use union with null instead of short nullable type
Since union type are now possible, using union with null makes more
clear that it is a union type.

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2023-02-20 21:48:19 -03:00
Kamil Tekiela
cfe54a501b Add union types
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2023-02-15 15:23:28 +00:00
Kamil Tekiela
2b35303aae
Remove redundant code (#18063)
PHPStorm has been a little annoying with showing all these code issues. I took some time to analyse most of them and fix whichever were easy to fix. This kind of change should improve future maintenance as developers do not need to wonder what a line of code does. Code that has no impact on functionality should be removed.

* Remove redundant variables
* Invert condition for better clarity
* Remove some of the redundant casts
* Replace switch with an if
* Fix foreach variable
* Remove redundant variable concat
* Remove redundant concats
* Replace for loop with str_repeat
* Remove always true param
* Turn property $position into local var
* Turn Pdf properties into local vars
* Remove unused properties in Pdf
* Change ternary into condition
* Remove redundant assignments
   They are immediately overwritten with a different value.
* Redundant array append
* Collapse if statements into assignments
* Use boolean constants instead of variables
* Remove unneeded parameter
* Remove null-coalesce
* Unnecessary assignment
* Remove redundant isset
* Remove readOnly flag for InsertEdit fields
* Remove function_exists and $mode var
* Remove duplicate condition
* Remove redundant elseif
* Remove redundant isset
* Use hasBodyParam()
* Simplify isRoutesCacheFileValid()
   Psalm complains but is wrong.

https://github.com/phpmyadmin/phpmyadmin/pull/18063

---------

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2023-02-15 09:11:05 -03:00
Kamil Tekiela
b6f0da1c09 Convert to first class callables
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2023-02-14 14:18:23 +00:00
Kamil Tekiela
7a22334167
Designer controller globals (#17985)
* Remove globals from DesignerController
* Remove $GLOBALS['params'] in ManageController
* Remove $GLOBALS['params']
* Remove $GLOBALS['total_num_tables']
* Remove $GLOBALS['tooltip_truename']
* Remove $GLOBALS['tooltip_aliasname']
* Remove $GLOBALS['pos']
* Remove $GLOBALS['tables'] (partially)
* Remove $GLOBALS['num_tables'] (partially)
* Remove redundant calls to Util::getDbInfo()
* Move unrelated functionality out of getDbInfo()
* Extract new method getTableListPosition()
* Code style changes
* Update phpstan-baseline.neon

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2023-01-26 22:58:24 -03:00
Maurício Meneghini Fauth
93c77c3784
Merge branch 'QA_5_2'
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2023-01-24 11:23:53 -03:00
William Desportes
6d482de7b8
Add back UUID and UUID_SHORT to functions on MySQL and all MariaDB versions
Ref: https://github.com/phpmyadmin/phpmyadmin/pull/17767

It was a mistake to remove the UUID functions, they are not the UUID type

Signed-off-by: William Desportes <williamdes@wdes.fr>
2023-01-20 20:18:55 +04:00
Kamil Tekiela
29a055b497 Remove redundant cast during concat
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2022-12-14 17:23:44 +00:00
Maurício Meneghini Fauth
e6f8623e1f
Merge pull request #17921 from kamil-tekiela/like
Clean up LIKE escaping
2022-11-30 14:27:14 -03:00
Maurício Meneghini Fauth
95c9fa430c
Merge pull request #17889 from kamil-tekiela/Index-controllers
Refactor Index controllers
2022-11-30 13:58:56 -03:00
Kamil Tekiela
dd699f348d Clean up LIKE escaping
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2022-11-25 00:06:52 +00:00
William Desportes
655c5e1541
Merge branch 'QA_5_2'
Signed-off-by: William Desportes <williamdes@wdes.fr>
2022-11-20 18:16:02 +01:00
William Desportes
e28bc2d8f6
Fix #17446 - Missing option for STORED virtual column and lower the check to MySQL>=5.7.6. Nothing is supported on 5.7.5.
Fixes: #17446

Signed-off-by: William Desportes <williamdes@wdes.fr>
2022-11-20 18:08:35 +01:00
Kamil Tekiela
2f769c00c3 Move getAddIndexSql() to Generator
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2022-11-12 15:22:30 +00:00
Kamil Tekiela
3b49a5bedb Implement quoteString()
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2022-11-06 19:06:48 +00:00
Kamil Tekiela
95a93ba909
Minor stylistic changes (#17865)
* Stylistic changes to make refactoring easier
* Parameter $where was unnecessarily nullable
* Refactor Routines::getDetails()
* Refactor Events::getDetails()
* Refactor Triggers::getDetails()
* Split up QueryGenerator::getInformationSchemaColumnsFullRequest

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2022-11-05 12:55:44 -03:00
Maurício Meneghini Fauth
3890d11dd8
Fix some coding style issues
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2022-10-16 17:18:54 -03:00
William Desportes
6da193304f
Merge branch 'QA_5_2'
Signed-off-by: William Desportes <williamdes@wdes.fr>
2022-10-13 20:13:48 +02:00
Mo Sureerat
7dc3607581 Improve code & comment
Signed-off-by: Mo Sureerat <sureemo@gmail.com>
2022-10-11 19:23:22 +07:00
Mo Sureerat
a07474f997 Handle array re-index + fix setVersion logic + hardcode version int
Signed-off-by: Mo Sureerat <sureemo@gmail.com>
2022-10-11 17:32:03 +07:00
Mo Sureerat
8c93351647 Relocate method and fix unit test fail
Signed-off-by: Mo Sureerat <sureemo@gmail.com>
2022-10-11 01:18:52 +07:00
Maurício Meneghini Fauth
9cdf0b1cd9
Merge branch 'QA_5_2'
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2022-10-03 21:00:20 -03:00
William Desportes
70a067ad09
Move compatibility logic into the Compatibility class
Signed-off-by: William Desportes <williamdes@wdes.fr>
2022-09-30 23:26:54 +02:00
William Desportes
9757b09dc8
Merge branch 'QA_5_2'
Signed-off-by: William Desportes <williamdes@wdes.fr>
2022-08-15 18:05:35 +02:00
William Desportes
d0093468d0
Fix escaping of SQL query and errors for debug console
Signed-off-by: William Desportes <williamdes@wdes.fr>
2022-08-15 13:20:09 +02:00
Maurício Meneghini Fauth
1438cb211e
Replace global keyword with $GLOBALS
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2022-03-07 17:31:11 -03:00
Maurício Meneghini Fauth
7b1dd0ea6c
Merge branch 'QA_5_1' into QA_5_2
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2022-02-12 11:42:17 -03:00
William Desportes
0c890adb60
Fix #17287 - Sorting Database List on "Data" Column creates a PHP type error
Signed-off-by: William Desportes <williamdes@wdes.fr>
2022-02-11 22:24:45 +01:00
Kamil Tekiela
b8f6fce3ef Fix parameter types
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2022-01-09 23:09:56 +00:00
Maurício Meneghini Fauth
feca48cc76
Change return type of DatabaseInterface::getError method
Now, it returns last error message or an empty string instead of false
if no errors occurred.

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-12-27 14:43:14 -03:00
Maurício Meneghini Fauth
3e0856c77b
Remove useless string concatenations
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-09-27 21:40:22 -03:00
Maurício Meneghini Fauth
f00d70cccb
Remove useless whitespaces
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-09-15 17:05:40 -03:00
Maurício Meneghini Fauth
f7fc4177af
Add support for account locking
- https://dev.mysql.com/doc/refman/en/account-locking.html
- https://mariadb.com/kb/en/account-locking/

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-08-21 00:55:33 -03:00
William Desportes
72800e2524
Merge branch 'QA_5_1'
Signed-off-by: William Desportes <williamdes@wdes.fr>
2021-08-15 00:52:33 +02:00
William Desportes
d804e60820
Fix broken docs link after FK types mismatch error
See: https://web.archive.org/web/20200921164945/https://dev.mysql.com/doc/refman/8.0/en/innodb-foreign-key-constraints.html

Signed-off-by: William Desportes <williamdes@wdes.fr>
2021-08-14 15:28:55 +02:00
William Desportes
1b2f0626c7
Ref #16842 - Remove the function Compatibility::isMySql because only Compatibility::isMySqlOrPerconaDb should be used
Signed-off-by: William Desportes <williamdes@wdes.fr>
2021-07-22 18:47:30 +02:00
Fawzi E. Abdulfattah
9954c47577
Fix #16138 - ignore the length of integer types, and show a warning
Fixes: #16138

Signed-off-by: Fawzi E. Abdulfattah <iifawzie@gmail.com>
2021-07-13 15:42:57 +02:00