Commit Graph

110 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
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
33d711215d
Remove the PMA_VERSION constant
Uses the PhpMyAdmin\Version::VERSION constant instead.

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-03-08 22:22:55 -03:00
William Desportes
ad0ef8ba8e
Merge branch 'QA_5_1'
Signed-off-by: William Desportes <williamdes@wdes.fr>
2021-03-05 20:01:07 +01: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
Dimitris Tsamitros
4bfc1aff83
Quote strings even when they are numeric on Yaml exports
Signed-off-by: Dimitris Tsamitros <dst@alternet.gr>
2021-03-05 18:09:20 +01:00
Maurício Meneghini Fauth
59a0a59d65
Remove dbi mock from ExportCodegenTest
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-03-04 19:55:47 -03:00
Maurício Meneghini Fauth
27cebd42aa
Remove dbi mock from ExportCsvTest
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-03-04 19:55:47 -03:00
Maurício Meneghini Fauth
c46da9d7ca
Remove some dbi mock from ExportHtmlwordTest
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-03-04 19:55:47 -03:00
Maurício Meneghini Fauth
51594d6ad8
Remove dbi mock from ExportJsonTest
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-03-04 19:55:33 -03:00
Maurício Meneghini Fauth
db65efcccd
Remove dbi mock from ExportLatexTest::testExportData
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-03-04 19:55:33 -03:00
Maurício Meneghini Fauth
8a321c3a7c
Remove some dbi mock from ExportOdtTest
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-03-04 19:55:33 -03:00
Maurício Meneghini Fauth
989b7291bf
Remove dbi mock from ExportPhparrayTest
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-03-04 19:54:58 -03:00
Maurício Meneghini Fauth
1335c15b85
Remove some dbi mock from ExportSqlTest
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-03-04 19:54:58 -03:00
Maurício Meneghini Fauth
1751c787fd
Remove some dbi mock from ExportTexytextTest
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-03-04 19:54:08 -03:00
Maurício Meneghini Fauth
4f334c7cea
Remove dbi mock from ExportXmlTest::testExportData
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-03-04 19:52:05 -03:00
Maurício Meneghini Fauth
c416bc6866
Remove dbi mock from ExportMediawikiTest
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-03-04 19:52:04 -03:00
William Desportes
76803f9422
Replace deprecated ->setMethods by ->onlyMethods
See: https://github.com/sebastianbergmann/phpunit/pull/3687
Signed-off-by: William Desportes <williamdes@wdes.fr>
2021-03-04 23:24:25 +01:00
Maurício Meneghini Fauth
f8b727a0fc
Remove dbi mock from ExportMediawikiTest::testExportData
Related to https://github.com/phpmyadmin/phpmyadmin/issues/16332

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-03-02 23:21:33 -03:00
William Desportes
c5155ecae9
Refactor field flags to use an object an not strpos
Signed-off-by: William Desportes <williamdes@wdes.fr>
2021-02-24 23:56:33 +01:00
Maurício Meneghini Fauth
6f97180b6d
Remove Plugins\Export\Helpers\Pdf::setAttributes method
Signed-off-by: Maurício Meneghini Fauth <mauricio@php.net>
2021-02-22 22:25:30 -03:00
Maurício Meneghini Fauth
b43e351668
Fix broken tests related to #16486
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2020-11-16 21:35:04 -03:00
Maurício Meneghini Fauth
cb842fd079
Fix some errors found by PHPStan
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2020-11-14 14:44:05 -03:00
Maurício Meneghini Fauth
db3da81056 Remove some useless comments
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2020-10-13 19:56:56 -03:00
Maurício Meneghini Fauth
f2e49a92c6 Fix some type errors detected by PHPStan
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2020-09-30 19:23:01 -03:00
Maurício Meneghini Fauth
ba09c84a05 Fix PHPStan errors for PHPUnit assert methods
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2020-08-10 16:20:53 -03:00
William Desportes
cce4bc993c
Fixes #16278 - Fix tests
Signed-off-by: William Desportes <williamdes@wdes.fr>
2020-08-06 15:48:08 +02:00