phpmyadmin/libraries
Kamil Tekiela 51f4017b32
Refactor destroy controller (#17194)
* Remove redundant conditions

They were always true. First, the variable is set to -1.
If the variable is -1, then set it to Message.
If the variable is Message then set the JSON array. All of this is
redundant.

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

* $sqlQuery is not used anywhere

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

* Enforce $selected to be an array

I can't remove it as it is a global. Previously, it was set to a POST
variable. Since we validate that the variable is set and is not null,
we can use the value from $params. If we validate that it's also an
array we can replace for loop with foreach.
There is no passing by reference, so this change should be safe.

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

* Replace $rebuildDatabaseList with input validation

The validation message says 'No databases selected.' so I assume that
we should check that we actually got at least one entry in the list.
If that is true, then the $rebuildDatabaseList is not needed and the
condition redundant.

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

* drop_selected_dbs is always set and is redundant

I am not sure if this is necessary. The AJAX request sends a value of "1"
but the code doesn't really do anything with it other than checking if
it is actually set. Is there some other path possible?

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

* Flatten the array with a single element

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

* Remove redundant isset

The variable is set, so !isset === is_null. Why check for null if we can
check just for !is_array.

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

* Update psalm-baseline.xml

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

* Adhere to the coding standard

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2021-11-19 14:26:04 -03:00
..
cache Add new cache directory 2020-03-28 10:38:11 +01:00
classes Refactor destroy controller (#17194) 2021-11-19 14:26:04 -03:00
.gitignore
advisory_rules_generic.php Remove useless string concatenations 2021-09-27 21:40:22 -03:00
advisory_rules_mysql_before80003.php Fix gettext incorrectly detection string as php-format 2020-08-31 19:02:11 -03:00
config.default.php Merge branch 'QA_5_1' 2021-07-22 14:57:54 +02:00
config.values.php Remove useless whitespaces 2021-09-15 17:05:40 -03:00
routes.php Use only callable controllers 2021-09-11 15:20:46 -03:00
services_controllers.php Create the RelationParameters value object 2021-11-14 18:22:36 -03:00
services_loader.php Add void return type where possible 2021-09-13 15:29:11 -03:00
services.php Extract IndexesController::doSaveData method 2021-09-11 14:38:44 -03:00
vendor_config.php Extract some common checks from common.inc.php 2021-07-06 13:27:14 -03:00