Commit Graph

662 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
1967a2511f Change nonUnique prop to be bool
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2023-02-20 12:30:53 +00:00
Kamil Tekiela
80c4db7253 Use strict check when type is known
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2023-02-19 23:19:54 +00:00
Maurício Meneghini Fauth
05963de7a8
Fix unused variable after merge
Introduced by 0819043d0e.

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2023-02-15 15:58:20 -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
8433f66447 Remove unused variable in catch
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2023-02-14 12:10:23 +00: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
d76b240176 Remove redundant pass-by-ref
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2023-02-10 16:30:12 -03:00
Maurício Meneghini Fauth
0819043d0e
Merge branch 'QA_5_2'
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2023-02-08 14:09:59 -03:00
William Desportes
9d92dafdcb
Merge #17923 - Fix #17766 - Allow to open in a new tab copy and edit row actions
Pull-request: #17923
Fixes: #17766

Signed-off-by: William Desportes <williamdes@wdes.fr>
2023-02-08 13:13:39 +01: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
e3e351c676 Remove dead code
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2023-01-25 00:59:43 +00:00
Maurício Meneghini Fauth
7cde53ed0d
Merge branch 'QA_5_2'
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2023-01-09 18:41:44 -03:00
Liviu-Mihail Concioiu
38deec06cd Fix uuid column move
Signed-off-by: Liviu-Mihail Concioiu <liviu.concioiu@gmail.com>
2023-01-07 18:05:14 +01:00
Maurício Meneghini Fauth
f4f933df8b
Merge pull request #17968 from kamil-tekiela/Remove-dependencies
Remove unused class dependencies

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2022-12-24 13:09:00 -03:00
Kamil Tekiela
6264f6f1ea
Various refactorings 2 (#17965)
* Remove extra blank lines
* Remove useless param annotations
* Refactor Index::singleton
* Refactor Config.php
* Refactor Header::addRecentTable()
* Collapse return statement into a single line
* Refactor Message.php
* Convert $getUniqueCondition into a scalar
* Code style
* Fix invalid return phpdoc
* Remove unused variable
* Remove redundant empty array checks
* Refactor Export::closeFile()
* Simplify else statement
* Remove redundant else
* Refactor TablePartitionDefinition::getDetails
* Simpler returns
* Add types for getCellContent()
* Remove useless method mngInsideStructComm

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2022-12-24 12:54:23 -03:00
Kamil Tekiela
6735938f12 Remove dependancy in Table/StructureController
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2022-12-16 20:58:48 +00:00
Kamil Tekiela
f174282442 Remove temporary var $column_names
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2022-12-14 17:23:44 +00:00
Kamil Tekiela
1c51769b32 Simplify for statement into foreach
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2022-12-14 17:23:44 +00: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
Maurício Meneghini Fauth
49865fe647
Remove Indexes object from the Window global object
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2022-11-29 14:39:16 -03:00
William Desportes
b9c593c67d
Fix #17766 - Allow to open in a new tab copy and edit row actions
Signed-off-by: William Desportes <williamdes@wdes.fr>
2022-11-25 19:55:53 +01: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
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
ff2e7f6334 Move methods to Indexes.php
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2022-11-11 22:24:27 +00:00
Kamil Tekiela
0131d39fe8 Extract executeAddIndexSql()
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2022-11-11 22:02:50 +00:00
Kamil Tekiela
a56a44b2cc Extract getAddIndexSql()
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2022-11-11 22:02:50 +00:00
Kamil Tekiela
3581f28c7f AbstractIndexController
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2022-11-11 21:37:32 +00:00
Maurício Meneghini Fauth
5df50f6a11
Refactor Tracking export download to remove exit
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2022-11-10 16:18:26 -03:00
Tobias Speicher
0f215ed0f6
Fix broken single column change page introduced by #17862
Signed-off-by: Tobias Speicher <rootcommander@gmail.com>
2022-11-09 11:06:02 +01:00
Maurício Meneghini Fauth
a0e4afff04
Replace $_POST with ServerRequest object in Table\OperationsController
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2022-11-09 02:11:16 -03:00
Maurício Meneghini Fauth
2cc3bf4778
Merge pull request #17881 from kamil-tekiela/Refactor-PrimaryController.php
Redesign PrimaryController
2022-11-08 22:26:31 -03:00
Maurício Meneghini Fauth
f103bdc1e2
Replace $_REQUEST with ServerRequest in Util::getDbInfo()
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2022-11-08 00:06:25 -03: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
Kamil Tekiela
ba41957e5f Redesign PrimaryController
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2022-11-08 00:31:47 +00:00
Maurício Meneghini Fauth
a1c8769fab
Refactor $dateFrom and $dateTo to use DateTimeImmutable
Uses the DateTimeImmutable object to validate the datetime values of the
$dateFrom and $dateTo variables in the Tracking class.

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2022-11-07 16:50:18 -03:00
Maurício Meneghini Fauth
d9fcd3555b
Remove filter_ts_* global variables
Replaces them with $dateFrom and $dateTo variables.

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2022-11-07 16:03:22 -03:00
Maurício Meneghini Fauth
17d9855420
Remove $_POST variables from Table\TrackingController
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2022-11-06 14:25:09 -03:00
Maurício Meneghini Fauth
4044c3bc3c
Remove unnecessary global variable 'data'
Replaces it with a regular varible.

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2022-11-06 13:22:46 -03:00
Maurício Meneghini Fauth
789a7e441d
Remove usage of $_POST['logtype']
- Replaces with variable get from ServerRequest object
- Renames it log_type for readability

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2022-11-06 11:45:07 -03:00
Maurício Meneghini Fauth
0f2ff29d9d
Remove tracking's selection_* global variables
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2022-11-05 17:24:18 -03:00
Maurício Meneghini Fauth
db75ac370d
Add method to validate logtype request param
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2022-11-05 16:46:48 -03:00
Maurício Meneghini Fauth
0cc6340d29
Fix error after #17819 merge
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2022-11-05 15:37:45 -03:00
Kamil Tekiela
959849f446
Introduce ServerRequest::hasBodyParam() (#17870)
* Drop Sql::setUiProp()
* Remove ternary operator
* Improve array guard
* Remove redundant isset
* Implement hasBodyParam()
* Add has() and hasQueryParam()

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2022-11-05 13:04:45 -03:00
Kamil Tekiela
b3d97a47ef Refactor ChangeController and use ServerRequest
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2022-11-02 21:57:31 +00:00
Maurício Meneghini Fauth
66e2650e06
Replace Core::fatalError() calls in controllers
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2022-10-31 20:25:55 -03:00