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

Database interface cleanups #13770

Merged
merged 14 commits into from Oct 25, 2017

Conversation

Projects
None yet
2 participants
@nijel
Member

nijel commented Oct 23, 2017

Moving some variables from globals to DatabaseInterface class and interface simplification.

Before submitting pull request, please check that every commit:

  • Has proper Signed-Off-By
  • Has commit message which describes it
  • Is needed on it's own, if you have just minor fixes to previous commits, you can squash them
  • Any new functionality is covered by tests

@nijel nijel self-assigned this Oct 23, 2017

@codecov

This comment has been minimized.

Show comment
Hide comment
@codecov

codecov bot Oct 23, 2017

Codecov Report

Merging #13770 into master will increase coverage by 0.02%.
The diff coverage is 59.92%.

@@            Coverage Diff             @@
##           master   #13770      +/-   ##
==========================================
+ Coverage   53.89%   53.91%   +0.02%     
==========================================
  Files         487      487              
  Lines       82336    82307      -29     
==========================================
+ Hits        44374    44379       +5     
+ Misses      37962    37928      -34

codecov bot commented Oct 23, 2017

Codecov Report

Merging #13770 into master will increase coverage by 0.02%.
The diff coverage is 59.92%.

@@            Coverage Diff             @@
##           master   #13770      +/-   ##
==========================================
+ Coverage   53.89%   53.91%   +0.02%     
==========================================
  Files         487      487              
  Lines       82336    82307      -29     
==========================================
+ Hits        44374    44379       +5     
+ Misses      37962    37928      -34

nijel added some commits Oct 23, 2017

Remember MySQL links internally in the database interface
This should replace $GLOBALS['userlink']/$GLOBALS['controllink'].

Signed-off-by: Michal Čihař <michal@cihar.com>
Remove usage of $GLOBALS['userlink']
The links are internal to DatabaseInterface and user link is default.

Signed-off-by: Michal Čihař <michal@cihar.com>
Correctly handle fallback control user connection using user parameters
Remember it as CONNECT_CONTROL and avoid running post connect handler.

Signed-off-by: Michal Čihař <michal@cihar.com>
Simplify condition for checking link existence
As the control link is same as user link if none is defined
we can check only if user is logged in.

Signed-off-by: Michal Čihař <michal@cihar.com>
Always define PMA_Config in tests
It is needed for template rendering, so most tests need it.

Signed-off-by: Michal Čihař <michal@cihar.com>
Remove usage of $GLOBALS['controllink']
This is now stored internally inside DatabaseInterface instance.

Signed-off-by: Michal Čihař <michal@cihar.com>
Simplify DatabaseInterface link parameter handling
- check validy only when invoking low level calls
- avoid too early array usage

Signed-off-by: Michal Čihař <michal@cihar.com>
Avoid poluting user cache without database connection
Returning false is obviously faster than dealing with the cache.

Signed-off-by: Michal Čihař <michal@cihar.com>
Return calculated value from isUserType
There is no need to hit the cache again to read the value.

Signed-off-by: Michal Čihař <michal@cihar.com>
Correctly define connection type
Signed-off-by: Michal Čihař <michal@cihar.com>
Move link parameter as last in getTablesFull
It is currently not used here, so move it to the end.

Signed-off-by: Michal Čihař <michal@cihar.com>
Fix documentation for DatabaseInterface::getDefinition
Signed-off-by: Michal Čihař <michal@cihar.com>
Always define correct connection type
Signed-off-by: Michal Čihař <michal@cihar.com>
Fix setting variable
Signed-off-by: Michal Čihař <michal@cihar.com>

@nijel nijel merged commit 701a885 into phpmyadmin:master Oct 25, 2017

6 checks passed

DCO All commits have a DCO sign-off from the author
Scrutinizer Analysis: 2 new issues, 2 updated code elements – Tests: passed
Details
codacy/pr Good work! A positive pull request.
Details
codecov/patch 59.92% of diff hit (target 53.89%)
Details
codecov/project 53.91% (+0.02%) compared to ad178f2
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@nijel nijel deleted the nijel:dbi branch Oct 25, 2017

@mauriciofauth

This comment has been minimized.

Show comment
Hide comment
@mauriciofauth

mauriciofauth Nov 10, 2017

Member

This line causes #13805.
$GLOBALS['dbi'] is null because url.php defines PMA_MINIMUM_COMMON to true.

Member

mauriciofauth commented on libraries/classes/Header.php in 60c1b32 Nov 10, 2017

This line causes #13805.
$GLOBALS['dbi'] is null because url.php defines PMA_MINIMUM_COMMON to true.

This comment has been minimized.

Show comment
Hide comment
@nijel

nijel Nov 13, 2017

Member

Thanks for spotting, fixed in 895ee14.

Member

nijel replied Nov 13, 2017

Thanks for spotting, fixed in 895ee14.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment