Commit Graph

55 Commits

Author SHA1 Message Date
Maurício Meneghini Fauth
9f076774e5
Remove table-light CSS classes
These classes were added by 6408b7179a.
However they aren't exactly the same as thead-light classes that exists
in Bootstrap 4.

Related to https://github.com/phpmyadmin/phpmyadmin/issues/17455.

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2022-05-14 17:31:31 -03:00
William Desportes
4bea65e29a
Merge branch 'QA_5_1' into QA_5_2
Signed-off-by: William Desportes <williamdes@wdes.fr>
2022-02-03 13:47:51 +01:00
William Desportes
fdf5fb6271
Fix #17331 - MariaDB has no support for "disabled_storage_engines"
Fixes: #17331

Signed-off-by: William Desportes <williamdes@wdes.fr>
2022-02-03 01:31:53 +01:00
Kamil Tekiela
47a039d70c Implement ResultInterface & MysqliResult
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2021-12-31 23:59:24 +00:00
Maurício Meneghini Fauth
44fe103b9c
Remove @access annotations
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-12-22 11:43:45 -03:00
Kamil Tekiela
56a832948c
Refactor DatabaseInterface.php (#17209)
* Use str_starts_with()

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

* Remove redundant !empty()

!empty() on a declared variable is redundant.

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

* Replace loop with array_column()

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

* Simpify assignment by removing temporary variable

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

* Remove redundant if statements and array_merge

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

* Remove temporary variable

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

* Unindent code

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

* Add helper method fetchByMode()

This is done to avoid calling methods through variables. It is the same
in terms of performance.

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

* Move if statements to where they are relevant

I had a choice to either move the while loop out of the if statements
or move the if statements inside. I decided it made more sense to move
them inside.

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

* Add NULL to phpdoc for the two parameters that can be null

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

* Simplify return statement

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

* Improve performance and simplify code

Since we are always using STORE mode then we can use data_seek() method.
This will allow us to get rid of the loop and use fetchByMode() method.

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

* Inline value defaulting

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

* Remove redundant check

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

* [bugfix] getColumnNames() should return an array of strings

There were multiple issues here. If we are selecting only a certain
column from the SQL then let's use the handy function instead of
array_keys. We will never get anything other than an array so checking
if it is not an array makes no sense. Returning null only to cast it to
an array is pointless. If really necessary, we could still check for an
empty array. The ColumnController returned the value without even
casting it to an array. I am not sure how jQuery/JavaScript dealt with it.

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

* Refactor getColumnMapFromSql and add type hint

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

* Refactor getVirtualTables

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

* Remove redundant loop

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

* Remove redundant usage of freeResult()

If there was no chance for the object to leak the scope and it is the
end of the scope then there's no reason to call this method.

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

* Replace dynamic variable with declare one

It's always the same name. If we were creating more than one, we could
use associative array, but in this case there seems to be absolutely no
need for any of this. Dynamic variables make it harder to debug the code.

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

* Update psalm-baseline.xml

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

* Widen the condition per williamdes suggestion

This will allow value such as '' and '0' to pass through. Previously
`if(! empty($database))` and `if($database)` dissallowed them.

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

* fetchResult() should return only arrays

Tests fixed to return arrays. Non-empty in case of true, empty in case
of false.
Fixed a lot of Psalm issues where the condition was always true.

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2021-11-26 20:17:46 -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
9f3510d11a
Add bool return type where possible
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-09-14 20:11:51 -03:00
William Desportes
10fca6b03f
Ref #16945 - Fix a coding standard mistake
Pull-request: #16945

Signed-off-by: William Desportes <williamdes@wdes.fr>
2021-07-13 21:39:51 +02:00
William Desportes
05f134c91b
Documentation and typo fixes
Signed-off-by: William Desportes <williamdes@wdes.fr>
2021-07-11 22:05:30 +02:00
Josep Sanz
de1c381f23
Add suport to the Mroonga engine: with this patch you can see the size
of the Mroonga's tables

Apply an optimization suggested

In reality, I have applied 2 optimizations, the first consists in filter by the object type as @williamdes suggested to me and the second is because we don't need to store all data of each mroonga object, we only need the name of the object that is used to compare with the tables names, thanks @williamdes by the optimization idea

Signed-off-by: Josep Sanz <josep.sanz@saltos.org>
2021-07-11 21:22:06 +02:00
Maurício Meneghini Fauth
1d29432dff
Use class constants for StorageEngine constants
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-06-24 19:08:34 -03:00
Maurício Meneghini Fauth
21431578db
Fix some errors found by PHPStan and Psalm
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-06-24 18:03:14 -03:00
Maurício Meneghini Fauth
1c084de30b
Fix coding standard errors
Related to 62f142c9fa.

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-06-03 16:50:33 -03:00
Maurício Meneghini Fauth
9928882de3
Fix some errors found by Psalm
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-05-23 00:24:59 -03:00
Maurício Meneghini Fauth
8d0c2a339c
Move both operands of an assignment to the same line
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-04-20 22:35:21 -03:00
Maurício Meneghini Fauth
d83abf63e7
Use PSR-12 for control structures spacing
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-03-05 15:27:03 -03:00
Maurício Meneghini Fauth
0b8edc5bde
Use PSR-12 for namespace use statements
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-03-05 14:18:35 -03:00
Maurício Meneghini Fauth
6408b7179a
Fix renamed Bootstrap 5 classes
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2020-12-21 15:28:39 -03:00
Maurício Meneghini Fauth
36c1eaa93c
Use Bootstrap's table style for server/engines pages
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2020-11-30 23:04:46 -03:00
Maurício Meneghini Fauth
c64b77abe1
Move HTML's table CSS to the pma-table class
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2020-11-16 16:36:16 -03:00
Maurício Meneghini Fauth
e4e274976e Extract cache methods from Util to SessionCache class
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2020-10-25 22:45:56 -03:00
Maurício Meneghini Fauth
ac9bccf67d Replace $GLOBALS['dbi'] with global $dbi
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2020-10-11 09:24:21 -03:00
Maurício Meneghini Fauth
3b285ff17e Use identical operator for non-empty strings
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2020-07-10 18:06:29 -03:00
Maurício Meneghini Fauth
f4582e083e Use early exit when possible
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2020-05-27 00:35:24 -03:00
Maurício Meneghini Fauth
2d02a15de3 Add static to closures that don't use $this
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2020-05-26 18:30:57 -03:00
Maurício Meneghini Fauth
3baad2eb1c Fix some coding standard issues
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2020-05-25 22:42:37 -03:00
Maurício Meneghini Fauth
a64393e7f5 Fix some coding standard issues
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2020-05-13 00:23:28 -03:00
Maurício Meneghini Fauth
558226d78e Extract HTML from StorageEngine::getHtmlSelect()
Renames the method to StorageEngine::getArray().

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2020-03-27 19:31:35 -03:00
Maurício Meneghini Fauth
6584b01824 Use short versions of scalar types in PHP docs
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2020-01-23 12:20:04 -03:00
Maurício Meneghini Fauth
676f48349a Reference global funcs and consts via use statement
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2020-01-21 22:13:36 -03:00
Maurício Meneghini Fauth
42166cac37 Remove use statements within the same namespace
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2020-01-21 19:47:56 -03:00
Maurício Meneghini Fauth
f80d3e3bd4 Remove unnecessary annotations
@package, @subpackage and others.

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2020-01-20 17:35:56 -03:00
Maurício Meneghini Fauth
6283caaabf Use one line for comments with a single line
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2020-01-20 16:04:09 -03:00
Maurício Meneghini Fauth
c231652c67 Remove useless comments in PHP docs
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2020-01-20 14:38:49 -03:00
Maurício Meneghini Fauth
8ec4209002 Fix some coding standard issues
- Inverts yoda comparisons
- Removes parentheses from return
- Removes useless ternary operators
- Adds paretheses to new instances
- Adds trailing array comma

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2020-01-20 00:38:34 -03:00
Maurício Meneghini Fauth
39f42f848b Remove some useless docblock comments
Fixes docblock spacing

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2019-12-13 21:15:00 -03:00
Maurício Meneghini Fauth
f6a17433a2 Use null coalesce operator when possible
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2019-12-11 20:16:58 -03:00
Maurício Meneghini Fauth
dd06cd38f8 Defines rules for double quote usage
Makes sure that any use of double quotes strings are warranted.

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2019-12-01 14:10:07 -03:00
Hugues Peccatte
3255e4ad7b Split Util class regarding the responsabilities (#15567)
PhpMyAdmin\Util is a very huge class with a lot of responsabilities.

There is a lot of work to split it, but this may be just a small start, waiting for a more normalized code.

* Split Util class regarding the responsabilities
* Split the buttonOrImage function

Signed-off-by: Hugues Peccatte <hugues.peccatte@gmail.com>
2019-11-21 20:20:05 -03:00
Maurício Meneghini Fauth
1a14b3e4d3 Remove vim modelines
These settings are no longer required as they are guaranteed through
other coding standard tools.

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2019-09-02 09:43:21 -03:00
Hugues Peccatte
41164d2904 Improve function calls order
Signed-off-by: Hugues Peccatte <hugues.peccatte@gmail.com>
2019-07-16 23:21:25 -03:00
William Desportes
6cc352ac12
phpstan level 3 fixes
21 errors left

Signed-off-by: William Desportes <williamdes@wdes.fr>
2019-06-22 14:37:38 +02:00
Hugues Peccatte
9406e922cc Update PHPDoc
Signed-off-by: Hugues Peccatte <hugues.peccatte@gmail.com>
2019-01-13 09:52:46 +01:00
William Desportes
3d28438949
Merge branch 'QA_4_8'
Signed-off-by: William Desportes <williamdes@wdes.fr>
2018-12-19 11:04:28 +01:00
William Desportes
3d2a2066f2
Fix #14786 - Table level Operations functions missing
Fixes: #14786 - Table level Operations functions missing
Signed-off-by: William Desportes <williamdes@wdes.fr>
2018-12-19 10:56:10 +01:00
Maurício Meneghini Fauth
2005cca77f Fix methods and properties visibility issues
Signed-off-by: Maurício Meneghini Fauth <mauriciofauth@gmail.com>
2018-05-30 21:02:26 -03:00
Maurício Meneghini Fauth
285e38e931 Fix some PSR-2 coding standard errors
Signed-off-by: Maurício Meneghini Fauth <mauriciofauth@gmail.com>
2018-05-30 09:07:56 -03:00
Maurício Meneghini Fauth
b9c0463d96 Use short array syntax instead of long array syntax
Replaces array() with [].

Signed-off-by: Maurício Meneghini Fauth <mauriciofauth@gmail.com>
2018-05-30 01:42:21 -03:00