Commit Graph

328 Commits

Author SHA1 Message Date
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
Maurício Meneghini Fauth
785f8c1c00
Use constructor property promotion where possible
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2023-02-20 19:39:02 -03:00
Maurício Meneghini Fauth
613678f8f5
Replace assignments with null coalesce equal operator
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2023-02-20 17:03:05 -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
8a1d6f1eaa Convert var annotations to typed properties
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2023-02-12 21:31:04 +00:00
Kamil Tekiela
f7524fd3b9
Minor code refactoring of Privileges.php (#17993)
* Small fixes
* Replace escapeString with quoteString
This also fixes bug with $_POST['old_username'].
* Add userExists() method
* Merge if statements
* Use ServerRequest for $initial
* Extract getExportPageTitle from getExportUserDefinitionTextarea
* Update baselines
* Complete redesign of getCurrentAuthenticationPlugin()
* Add method getEmptyUserNotice()
* Remove redundant variable sets and unsets
* Add method checkStructureOfPrivilegeTable()
* Remove testGetHtmlForViewUsersError()
* Privatize getAddUserHtmlFieldset
* Improve tests for mysql.user table checks

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2023-01-28 20:40:30 -03: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
Kamil Tekiela
55a6f09ce8
Server privileges controller globals removal (#17986)
* $GLOBALS['url_dbname']
* $GLOBALS['grants'], $GLOBALS['one_grant']
* $GLOBALS['export']
* $GLOBALS['title']
* $GLOBALS['itemType']
* $GLOBALS['_add_user_error']
* $GLOBALS['queries_for_display']
* $GLOBALS['ret_queries']
* $GLOBALS['ret_message']
* $GLOBALS['queries']
* Remove redundant code
* $GLOBALS['password']
* $GLOBALS['dbname_is_wildcard']
* $GLOBALS['db_and_table']
* $GLOBALS['routinename']
* $GLOBALS['tablename']
* $GLOBALS['post_patterns']
* Update psalm-baseline.xml

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2023-01-26 11:46:20 -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
305fe52d9e
Fix #18019 - Error: "Call to a member function fetchAssoc() on bool" with SQL mode ONLY_FULL_GROUP_BY
Fixes: #18019

Signed-off-by: William Desportes <williamdes@wdes.fr>
2023-01-20 19:36:52 +04:00
Maurício Meneghini Fauth
41dec1effc
Extract connection type constants to the Connection class
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2023-01-17 02:21:27 -03:00
Maurício Meneghini Fauth
1d37607132
Update PHPStan/Psalm baselines
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2023-01-11 00:22:48 -03:00
ru-asdx
87bd27621e
Ref #17769 - replace superglobals with serverrequest in server/ controllers (#17978)
* replace superglobals with serverrequest in server/ controllers
* replace $_POST['param'] ?? $_GET['value'] with $request->getParam

Signed-off-by: Evgeny Skorlov <eugene@skorlov.name>
2023-01-10 21:22:04 -03:00
ru-asdx
3663fed7ad
Ref #17769 - Replace superglobals with serverrequest in PrivilegesController (#17977)
* replace superglobals with serverrequest

Signed-off-by: Evgeny Skorlov <eugene@skorlov.name>
2023-01-10 21:15:39 -03:00
Maurício Meneghini Fauth
fdf474abf9
Merge pull request #17981 from kamil-tekiela/getTables-investigation
Improve some type inference in various places

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2022-12-24 13:44:45 -03:00
Kamil Tekiela
2bda275524 Add better type inference
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2022-12-20 18:55:03 +00:00
Kamil Tekiela
65ab1608f8 Remove dependency in DatabasesController
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2022-12-16 20:58:48 +00:00
Kamil Tekiela
b29eccd70b Remove $params
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2022-11-30 22:20:19 +00:00
ru-asdx
eff7e23b60
Ref #17769 - Replace superglobals with ServerRequest in Server/Status (#17912)
* Replace superglobals with ServerRequest in Server/Status

Signed-off-by: Evgeny Skorlov <eugene@skorlov.name>
2022-11-30 14:30:46 -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
Maurício Meneghini Fauth
ca489f3b41
Improve type of DatabaseInterface::getLowerCaseNames()
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2022-11-19 15:50:14 -03:00
Maurício Meneghini Fauth
d0d90551c3 Remove the dblist global variable
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2022-11-13 21:08:00 -03:00
Maurício Meneghini Fauth
aeb237f629
Fix TypeError in Server\ReplicationController class
Fixes https://github.com/phpmyadmin/phpmyadmin/issues/17875

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2022-11-10 21:44:25 -03:00
Kamil Tekiela
656ddda704 Refactor BinlogController.php
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2022-11-08 11:59:05 +00:00
Maurício Meneghini Fauth
97aac39a40
Remove the sub_part global variable
It's only used inside Util::getDbInfo() for pagination when not
exporting.

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2022-11-07 22:06:59 -03:00
Maurício Meneghini Fauth
456be438ea
Merge pull request #17872 from kamil-tekiela/Remove-$params-2
Refactoring of Processes.php
2022-11-06 17:01:07 -03:00
Kamil Tekiela
94ba7d69d2 Remove $params array
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2022-11-05 21:24:10 +00:00
Kamil Tekiela
aa3b4ed737 Refactoring of Processes.php
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2022-11-05 21:13:12 +00:00
Kamil Tekiela
7ee4c77036 Fix Replica bugs
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2022-11-02 15:47:31 +00:00
William Desportes
81e67d2aa3
Fix type hint on replication controller
See: bfd75d04a4 (r87525137)

Signed-off-by: William Desportes <williamdes@wdes.fr>
2022-10-29 20:24:22 +02:00
Luca Perna
cca381a415
#17769 Use ServerRequest Object to access POST-vars (#17819)
* 17769 - use Request object instead of SuperGlobals

Signed-off-by: Luca Perna <luca@perna.rocks>
2022-10-29 11:57:47 -03:00
William Desportes
25c13d667b
Merge branch 'QA_5_2'
Signed-off-by: William Desportes <williamdes@wdes.fr>
2022-10-26 12:22:38 +02:00
Luca Perna
d1b5cb6987
16276 - Reduce the usage of SuperGlobals (#17795)
Signed-off-by: Luca Perna <luca@perna.rocks>
2022-10-20 01:52:38 -03:00
William Desportes
df4e8d2221
Fix broken createProfilingChart on monitor analyse query
JQPlotChartFactory was undefined

Signed-off-by: William Desportes <williamdes@wdes.fr>
2022-10-19 17:41:29 +02:00
Maurício Meneghini Fauth
4bda7899ab
Fix coding standard issues after #17794 merge
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2022-10-14 08:44:52 -03:00
Luca Perna
40adf927c5
Move superglobals access to controllers (#17794)
Related to #16276

Signed-off-by: Luca Perna <luca@perna.rocks>
2022-10-14 08:34:42 -03:00
Maurício Meneghini Fauth
3c618c22a9
Add ServerRequest parameter to all controllers
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2022-07-28 01:00:08 -03:00
Maurício Meneghini Fauth
905214ae0b
Merge branch 'QA_5_2'
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2022-06-11 14:13:30 -03:00
Maurício Meneghini Fauth
bf084233ea
Add ChangeLog entry for #17586
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2022-06-11 14:04:58 -03:00
Maurício Meneghini Fauth
eb3703882b
Move Routing::getCurrentRoute to ServerRequest
The route is retrieved from the request, so it makes sense to move the
method to the Http\ServerRequest class.

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2022-06-06 23:36:57 -03:00
Liviu-Mihail Concioiu
479f8472b3 Fix statistics
Signed-off-by: Liviu-Mihail Concioiu <liviu.concioiu@gmail.com>
2022-06-06 21:12:47 +02:00
Maurício Meneghini Fauth
d58057daec
Extract Database\PrivilegesController from Server\PrivilegesController
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2022-05-27 17:13:23 -03:00
Maurício Meneghini Fauth
dc5bf0074c
Extract Table\PrivilegesController from Server\PrivilegesController
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2022-05-27 16:25:39 -03:00
Maurício Meneghini Fauth
6201c7f2ba
Merge branch 'QA_5_2'
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2022-05-27 13:27:59 -03:00
Maurício Meneghini Fauth
229d99bb81
Fix checking db and table privileges when case is sensitive
Fixes https://github.com/phpmyadmin/phpmyadmin/issues/17558

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2022-05-26 16:05:58 -03:00
Maurício Meneghini Fauth
6dc859cbc2
Merge branch 'QA_5_2'
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2022-04-28 15:56:18 -03:00
Maurício Meneghini Fauth
54df014550
Remove stickyfilljs JavaScript dependency
This polyfill is not needed anymore.

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2022-04-27 19:47:31 -03:00
Maurício Meneghini Fauth
5950693fb3
Fix possible undefined globals
Related to https://github.com/phpmyadmin/phpmyadmin/pull/17427.

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2022-03-10 18:05:21 -03: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