Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove global variables #19503

Merged
merged 63 commits into from
Jan 11, 2025
Merged

Conversation

MauricioFauth
Copy link
Member

@MauricioFauth MauricioFauth commented Jan 8, 2025

Removes almost all global variables and replaces them with static properties.

Signed-off-by: Maurício Meneghini Fauth <mauricio@mfauth.net>
Signed-off-by: Maurício Meneghini Fauth <mauricio@mfauth.net>
Signed-off-by: Maurício Meneghini Fauth <mauricio@mfauth.net>
Signed-off-by: Maurício Meneghini Fauth <mauricio@mfauth.net>
Signed-off-by: Maurício Meneghini Fauth <mauricio@mfauth.net>
Replace it with ResponseRenderer::$reload static property.

Signed-off-by: Maurício Meneghini Fauth <mauricio@mfauth.net>
Replaces it with Export::$asFile static property.

Signed-off-by: Maurício Meneghini Fauth <mauricio@mfauth.net>
Replaces it with the Import\Ajax::SESSION_KEY constant.

Signed-off-by: Maurício Meneghini Fauth <mauricio@mfauth.net>
Replaces it with Import::$importText static property.

Signed-off-by: Maurício Meneghini Fauth <mauricio@mfauth.net>
Replaces it with Export::$saveOnServer static property.

Signed-off-by: Maurício Meneghini Fauth <mauricio@mfauth.net>
Replaces it with Export::$outputCharsetConversion static property.

Signed-off-by: Maurício Meneghini Fauth <mauricio@mfauth.net>
Replaces it with Export::$bufferNeeded static property.

Signed-off-by: Maurício Meneghini Fauth <mauricio@mfauth.net>
Replaces it with Export::$outputKanjiConversion static property.

Signed-off-by: Maurício Meneghini Fauth <mauricio@mfauth.net>
Replaces it with Current::$whereClause static property.

Signed-off-by: Maurício Meneghini Fauth <mauricio@mfauth.net>
Signed-off-by: Maurício Meneghini Fauth <mauricio@mfauth.net>
Replaces it with Export::$singleTable static property.

Signed-off-by: Maurício Meneghini Fauth <mauricio@mfauth.net>
Replaces it with AuthenticationCookie::$connectionError static property.

Signed-off-by: Maurício Meneghini Fauth <mauricio@mfauth.net>
Copy link

codecov bot commented Jan 8, 2025

Codecov Report

Attention: Patch coverage is 46.61922% with 150 lines in your changes missing coverage. Please review.

Project coverage is 60.13%. Comparing base (91fe474) to head (99c70e3).
Report is 36 commits behind head on master.

Files with missing lines Patch % Lines
src/Controllers/Server/PrivilegesController.php 33.33% 24 Missing ⚠️
src/Export/Export.php 13.63% 19 Missing ⚠️
src/Controllers/Import/ImportController.php 37.03% 17 Missing ⚠️
src/Controllers/Export/ExportController.php 80.95% 8 Missing ⚠️
src/Import/Import.php 20.00% 8 Missing ⚠️
src/Plugins/Auth/AuthenticationCookie.php 76.19% 5 Missing ⚠️
src/Controllers/Database/ExportController.php 0.00% 4 Missing ⚠️
...rollers/Database/Structure/DropTableController.php 0.00% 4 Missing ⚠️
src/Controllers/Server/ExportController.php 0.00% 4 Missing ⚠️
src/Import/Ajax.php 0.00% 4 Missing ⚠️
... and 25 more
Additional details and impacted files
@@            Coverage Diff            @@
##             master   #19503   +/-   ##
=========================================
  Coverage     60.12%   60.13%           
+ Complexity    15881    15873    -8     
=========================================
  Files           676      675    -1     
  Lines         61188    61159   -29     
=========================================
- Hits          36791    36778   -13     
+ Misses        24397    24381   -16     
Flag Coverage Δ
dbase-extension ?
unit-8.2-ubuntu-latest ?
unit-8.3-ubuntu-latest ?
unit-8.4-ubuntu-latest ?
unit-8.5-ubuntu-latest 60.13% <46.61%> (+0.08%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Replaces it with Current::$displayQuery static property.

Signed-off-by: Maurício Meneghini Fauth <mauricio@mfauth.net>
Replaces it with DatabaseInterface::$errorNumber static property.

Signed-off-by: Maurício Meneghini Fauth <mauricio@mfauth.net>
Replaces it with Current::$charset static property.

Signed-off-by: Maurício Meneghini Fauth <mauricio@mfauth.net>
Replaces it with AuthenticationCookie::$authServer static property.

Signed-off-by: Maurício Meneghini Fauth <mauricio@mfauth.net>
Replaces it with a property.

Signed-off-by: Maurício Meneghini Fauth <mauricio@mfauth.net>
Replaces it with Current::$completeQuery static property.

Signed-off-by: Maurício Meneghini Fauth <mauricio@mfauth.net>
Replaces it with Export::$compression static property.

Signed-off-by: Maurício Meneghini Fauth <mauricio@mfauth.net>
Replaces it with Export::$fileHandle static property.

Signed-off-by: Maurício Meneghini Fauth <mauricio@mfauth.net>
Replaces it with AuthenticationCookie::$fromCookie static property.

Signed-off-by: Maurício Meneghini Fauth <mauricio@mfauth.net>
Replaces it with Export::$kanjiEncoding static property.

Signed-off-by: Maurício Meneghini Fauth <mauricio@mfauth.net>
Replaces it with Export::$maxSize static property.

Signed-off-by: Maurício Meneghini Fauth <mauricio@mfauth.net>
Replaces it with Export::$memoryLimit static property.

Signed-off-by: Maurício Meneghini Fauth <mauricio@mfauth.net>
Replaces it with a static property.

Signed-off-by: Maurício Meneghini Fauth <mauricio@mfauth.net>
Replaces it with a static property.

Signed-off-by: Maurício Meneghini Fauth <mauricio@mfauth.net>
Replaces it with ImportShp::$eof static property.

Signed-off-by: Maurício Meneghini Fauth <mauricio@mfauth.net>
Signed-off-by: Maurício Meneghini Fauth <mauricio@mfauth.net>
Signed-off-by: Maurício Meneghini Fauth <mauricio@mfauth.net>
Replaces it with a static property.

Signed-off-by: Maurício Meneghini Fauth <mauricio@mfauth.net>
Replaces it with a local variable.

Signed-off-by: Maurício Meneghini Fauth <mauricio@mfauth.net>
Signed-off-by: Maurício Meneghini Fauth <mauricio@mfauth.net>
@phpmyadmin-bot
Copy link
Contributor

This pull requests contains too many commits, in most cases it is caused by wrong merge target. In case you have forked master branch you should also ask merging to master branch. See GitHub documentation for more details.

1 similar comment
@phpmyadmin-bot
Copy link
Contributor

This pull requests contains too many commits, in most cases it is caused by wrong merge target. In case you have forked master branch you should also ask merging to master branch. See GitHub documentation for more details.

@MauricioFauth MauricioFauth changed the title Remove some global variables Remove global variables Jan 10, 2025
@phpmyadmin-bot
Copy link
Contributor

This pull requests contains too many commits, in most cases it is caused by wrong merge target. In case you have forked master branch you should also ask merging to master branch. See GitHub documentation for more details.

@MauricioFauth MauricioFauth marked this pull request as ready for review January 10, 2025 21:31
@phpmyadmin-bot
Copy link
Contributor

This pull requests contains too many commits, in most cases it is caused by wrong merge target. In case you have forked master branch you should also ask merging to master branch. See GitHub documentation for more details.

Copy link
Contributor

@kamil-tekiela kamil-tekiela left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with the core concept, but I am not sure if I want to review it in detail. My web browser is lagging. The test is failing though.

Copy link
Member

@williamdes williamdes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have no more globals after this PR ?

Signed-off-by: Maurício Meneghini Fauth <mauricio@mfauth.net>
@phpmyadmin-bot
Copy link
Contributor

This pull requests contains too many commits, in most cases it is caused by wrong merge target. In case you have forked master branch you should also ask merging to master branch. See GitHub documentation for more details.

@MauricioFauth
Copy link
Member Author

I agree with the core concept, but I am not sure if I want to review it in detail. My web browser is lagging. The test is failing though.

Sorry about this huge pull request. I hyper-focused on this and it end up bigger than I expected.
I basically changed as little as possible to not change behavior. So there's some static properties that don't make much sense and need a refactor. But it's easier to catch these cases now.

Do we have no more globals after this PR ?

There are only a few globals now. That should be removed in another PR.

There's no need for it anymore.

Signed-off-by: Maurício Meneghini Fauth <mauricio@mfauth.net>
@phpmyadmin-bot
Copy link
Contributor

This pull requests contains too many commits, in most cases it is caused by wrong merge target. In case you have forked master branch you should also ask merging to master branch. See GitHub documentation for more details.

@MauricioFauth MauricioFauth merged commit 605e56b into phpmyadmin:master Jan 11, 2025
42 checks passed
@MauricioFauth MauricioFauth deleted the globals-removal branch January 11, 2025 19:00
@MauricioFauth MauricioFauth self-assigned this Jan 11, 2025
@phpmyadmin-bot
Copy link
Contributor

This pull requests contains too many commits, in most cases it is caused by wrong merge target. In case you have forked master branch you should also ask merging to master branch. See GitHub documentation for more details.

@MauricioFauth MauricioFauth added this to the 6.0.0 milestone Jan 11, 2025
@phpmyadmin-bot
Copy link
Contributor

This pull requests contains too many commits, in most cases it is caused by wrong merge target. In case you have forked master branch you should also ask merging to master branch. See GitHub documentation for more details.

@williamdes
Copy link
Member

PS: I have a work in progress to fix the bot, will try to finish it. So it stops commenting again and again

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants