Commit Graph

262 Commits

Author SHA1 Message Date
Kamil Tekiela
ade85420a8 Inline runQueryPost()
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

import
2022-03-17 20:45:31 +00: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
Kamil Tekiela
6e1221ce62 Drop stripslashes
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2022-02-07 18:07:27 +00:00
William Desportes
65c9f49c1e
Merge branch 'QA_5_1' into QA_5_2
Signed-off-by: William Desportes <williamdes@wdes.fr>
2022-02-06 15:45:57 +01:00
William Desportes
4e68f548f9
Ref #17298, #17344 - fix ODS import tests
Signed-off-by: William Desportes <williamdes@wdes.fr>
2022-02-06 14:20:59 +01:00
Maurício Meneghini Fauth
76bb42957e
Fix failing tests
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2022-01-26 15:02:39 -03:00
Maurício Meneghini Fauth
411bacf613
Use Sodium for auth cookies encryption
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2022-01-13 18:46:04 -03:00
Maurício Meneghini Fauth
7aaab24463
Remove the phpseclib dependency
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2022-01-13 17:43:50 -03:00
Kamil Tekiela
f5bb90ebb9 Move queryAsControlUser - Dbal refactoring pt.3
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2022-01-06 19:31:27 +00: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
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
d84af02945
Create VO classes for each RelationParameters features
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-12-26 19:17:58 -03: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
Maurício Meneghini Fauth
bf49480160
Populate relation Session with RelationParameters class
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-12-17 12:09:15 -03:00
Maurício Meneghini Fauth
c411121fd8
Move Relation classes into the ConfigStorage namespace
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-12-17 12:09:13 -03:00
Maurício Meneghini Fauth
c4575fd48b
Add methods to check for RelationParameters features
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-12-11 08:10:40 -03:00
William Desportes
7b469f57e1
Update testExportRoutines test after sql-parser 5.5.0
Signed-off-by: William Desportes <williamdes@wdes.fr>
2021-12-09 18:28:43 +01:00
Kamil Tekiela
a42803297c
Psalm fixes 3 (#17221)
* Update psalm-baseline.xml

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

* Small bug fixes

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

* non-falsy-string is always true

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

* currentSearch property is nullable

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

* Remove unusued parameter $columnIndex

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

* Use parameters instead of globals in sendEditor()

The two globals in this method are read-only. There is an unused
parameter in the signature. Let's add one more and use them instead of globals.

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

* Remove unusued parameter $crlf

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2021-12-03 12:40:19 -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
b2a51c4d84
Create the RelationParameters value object
Replaces the $cfgRelation array with the RelationParameters value
object.

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-11-14 18:22:36 -03:00
Maurício Meneghini Fauth
d49c243469
Use @requires annotation for required extensions
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-10-07 13:40:50 -03:00
Maurício Meneghini Fauth
67e96cf40c
Get default config values from Config\Settings classes
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-09-30 12:04:47 -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
53dd6f11b0
Refactor setProperties method of Plugin classes
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-08-28 16:50:08 -03:00
William Desportes
2c28a715b4
Add methods to DbiDummy and AbstractTestCase to control changing databases
Signed-off-by: William Desportes <williamdes@wdes.fr>
2021-08-24 02:01:00 +02:00
William Desportes
fa88ce2f00
Merge branch 'QA_5_1'
Signed-off-by: William Desportes <williamdes@wdes.fr>
2021-08-10 15:39:23 +02:00
William Desportes
9249951f51
Fix test after #17014
Pull-request: #17064
Ref: #17014

This commit is the proof that the PR was right and that it works

Signed-off-by: William Desportes <williamdes@wdes.fr>
2021-08-10 14:48:55 +02:00
William Desportes
0f05c686e4
Add tests for #17014
Signed-off-by: William Desportes <williamdes@wdes.fr>
2021-08-10 14:44:47 +02:00
William Desportes
587536b766
Remove non used variables
Running: composer run psalm -- --alter --issues=UnusedVariable
And removing the false positives I reported upstream

Signed-off-by: William Desportes <williamdes@wdes.fr>
2021-07-16 02:13:27 +02:00
Maurício Meneghini Fauth
355f6d9d20
Remove PhpMyAdmin\Config::enableBc method
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-07-09 13:59:04 -03:00
Maurício Meneghini Fauth
e8c28d1883
Remove some globals from Config::enableBc method
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-07-08 19:49:26 -03:00
Maurício Meneghini Fauth
9adaa912e1
Rename Response class to ResponseRenderer
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-06-30 12:35:22 -03:00
Maurício Meneghini Fauth
c8a5cd4065
Fix some errors founf by PHPStan and Psalm
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-06-23 16:11:13 -03:00
Maurício Meneghini Fauth
8319f88ecf
Fix some errors found by PHPStan
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-06-22 17:12:02 -03:00
Maurício Meneghini Fauth
1ed9ab5dda
Fix failing unit test
Random Seeds: 1623610942, 1623612011, 1623680984

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-06-14 12:41:49 -03:00
Maurício Meneghini Fauth
f3b79d83c0
Add PHPUnit's Covers annotation on test classes
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-06-04 23:39:26 -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
704154572b
Fix coding standard error
[ci skip]

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-05-28 18:57:18 -03:00
William Desportes
f5f636ef3b
Merge branch 'QA_5_1'
Signed-off-by: William Desportes <williamdes@wdes.fr>
2021-05-28 21:43:28 +02:00
William Desportes
790c09084c
Add tests for #16920 - Uncaught TypeError: PhpMyAdmin\Import::detectType(): Argument #2 ($cell) must be of type ?string, float given
Signed-off-by: William Desportes <williamdes@wdes.fr>
2021-05-28 21:36:39 +02:00
Maurício Meneghini Fauth
669a60c8ae
Merge branch 'QA_5_1'
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-05-25 22:17:13 -03:00
Utkarsh Gupta
c309b96edd Skip testImportOsm and testDoImport on 32-bit/s390x arch
These two tests fail on s390x machines, looks like some
32-bit issues we already have. Probably worth skipping
these on 32-bit/s390x arch.

Signed-off-by: Utkarsh Gupta <utkarsh@debian.org>
2021-05-24 19:44:59 +05:30
Maurício Meneghini Fauth
cd1b8a9b77
Fix some errors found by PHPStan and Psalm
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-05-22 15:14:24 -03:00
Maurício Meneghini Fauth
95fdd35e2f
Remove the .pma-table CSS class
Replaces with equivalent Bootstrap classes.

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-05-15 17:16:22 -03:00
William Desportes
6649d99517
Fix "Retry to connect" button style
Signed-off-by: William Desportes <williamdes@wdes.fr>
2021-04-28 23:14:23 +02:00
William Desportes
d82e85f852
Merge branch 'QA_5_1'
Signed-off-by: William Desportes <williamdes@wdes.fr>
2021-04-23 18:46:05 +02:00
William Desportes
cbd35c9fa8
Ref #16847 - Fix JSON export code duplicated and not following rules in raw query export mode
Signed-off-by: William Desportes <williamdes@wdes.fr>
2021-04-23 17:48:14 +02:00
William Desportes
60225212da
Fix #16847 - Export JSON blob and binary data & fix binary nullable JSON export
Signed-off-by: William Desportes <williamdes@wdes.fr>
2021-04-23 16:20:20 +02:00
Maurício Meneghini Fauth
f6f4af1efe
Change log-in page to use Bootstrap format
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-04-22 22:02:34 -03:00