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

Set empty authtoken names to 'none' #30815

Merged
merged 1 commit into from
Mar 23, 2018
Merged

Conversation

IljaN
Copy link
Member

@IljaN IljaN commented Mar 19, 2018

Description

Empty authtokens names were allowed in earlier versions, but are now disallowed. This results in a crash during login when empty authokens are encountered from previous version

This migration sets all empty authtoken names to 'none'.

Related Issue

#30792

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

@IljaN IljaN added this to the development milestone Mar 19, 2018
@IljaN IljaN self-assigned this Mar 19, 2018
@IljaN
Copy link
Member Author

IljaN commented Mar 19, 2018

  • Backport

@PVince81 PVince81 added the p1-urgent Critical issue, need to consider hotfix with just that issue label Mar 19, 2018

public function sql(IDBConnection $connection) {
$q = $connection->getQueryBuilder();
$q->automaticTablePrefix(true);
Copy link
Contributor

Choose a reason for hiding this comment

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

we never used this before I hope it doesn't break 🙈

Copy link
Member Author

Choose a reason for hiding this comment

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

Is there a better way to get the table prefix? I saw that migration kind "schema" injects prefix trough a param. But this is not the case here...

Copy link
Member Author

Choose a reason for hiding this comment

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

Or do you mean query builder?

Copy link
Contributor

Choose a reason for hiding this comment

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

ah now I remember: you don't need to bother about table prefix. Just remove line 15 and that's it.


$q->update('authtoken')
->set('name', '(none)')
->where("name = ''")
Copy link
Member

Choose a reason for hiding this comment

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

use expression builder

$q->update('authtoken')
->set('name', '(none)')
->where("name = ''")
->orWhere('name IS NULL')
Copy link
Member

Choose a reason for hiding this comment

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

use expression builder

@IljaN IljaN force-pushed the set_empty_authtoken_names branch from ce25085 to cbdc4be Compare March 22, 2018 16:14
@codecov
Copy link

codecov bot commented Mar 22, 2018

Codecov Report

Merging #30815 into master will decrease coverage by <.01%.
The diff coverage is 0%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #30815      +/-   ##
============================================
- Coverage     62.25%   62.25%   -0.01%     
- Complexity    18205    18206       +1     
============================================
  Files          1140     1141       +1     
  Lines         68043    68050       +7     
  Branches       1230     1230              
============================================
  Hits          42362    42362              
- Misses        25318    25325       +7     
  Partials        363      363
Flag Coverage Δ Complexity Δ
#javascript 51.99% <ø> (ø) 0 <ø> (ø) ⬇️
#phpunit 63.41% <0%> (-0.01%) 18206 <1> (+1)
Impacted Files Coverage Δ Complexity Δ
core/Migrations/Version20180319102121.php 0% <0%> (ø) 1 <1> (?)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b2da060...9947d69. Read the comment docs.

@IljaN IljaN force-pushed the set_empty_authtoken_names branch from cbdc4be to 9947d69 Compare March 22, 2018 16:59
@IljaN
Copy link
Member Author

IljaN commented Mar 23, 2018

@DeepDiver1975 Plz merge :)

Copy link
Contributor

@PVince81 PVince81 left a comment

Choose a reason for hiding this comment

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

👍

@PVince81 PVince81 merged commit 979ac6c into master Mar 23, 2018
@PVince81 PVince81 deleted the set_empty_authtoken_names branch March 23, 2018 16:33
@PVince81
Copy link
Contributor

@IljaN please backport

@lock
Copy link

lock bot commented Jul 31, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Jul 31, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
2 - Developing p1-urgent Critical issue, need to consider hotfix with just that issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants