importer 모듈에서 규칙에 맞지 않는 아이디 등이 누락되지 않도록 수정#2271
Merged
1 commit merged intoJul 17, 2018
Merged
Conversation
bjrambo
reviewed
Jun 29, 2018
| if(!preg_match('/^[\w-]+((?:\.|\+|\~)[\w-]+)*@[\w-]+(\.[\w-]+)+$/', $obj->email_address)) | ||
| { | ||
| $obj->email_address = $obj->user_id . '@example.com'; | ||
| } |
Contributor
There was a problem hiding this comment.
이 코드가 반복적인데, 따로 함수를 만들어서 밖으로 도출 시키는 것은 별로 인가요?
dorami
added a commit
to daolcms/daolcms
that referenced
this pull request
Aug 9, 2018
dorami
added a commit
to daolcms/daolcms
that referenced
this pull request
Aug 10, 2018
This pull request was closed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
마이그레이션 툴을 사용하여 다른 CMS에서 가져온 데이터를 importer 모듈로 들여오려고 하면 아무런 에러가 나지 않았음에도 불구하고 일부 회원이나 게시물이 누락되는 경우가 있습니다.
원인을 추적해 보니 다른 CMS들은 아이디나 메일 주소에 들어갈 수 있는 글자, 닉네임 중복 가능 여부 등을 XE처럼 엄격하게 따지지 않아서, 데이터 추출시 XE 규칙에 맞지 않는 아이디나 메일 주소, 중복되는 닉네임 등이 발생하고 있었습니다. 이러면
insertMember,insertDocument,insertComment쿼리가 오류를 뿜습니다. 그러나 오류가 발생하더라도 그대로 진행하기 때문에 해당 회원이나 게시물은 누락됩니다.닉네임 중복 여부를 체크하는 조건이 이미 있지만, 중복된 경우가 아니라 쿼리 오류가 발생한 경우를 감지하도록 되어 있어서ㅡ.ㅡ;; 무용지물이더군요.
마이그레이션 툴과 importer 모듈의 일반적인 사용자층과 사용 방법을 고려할 때, 에러를 뿜고 중단하는 것도 좋은 방법은 아니라고 생각됩니다. 그래서 잘못된 형식의 데이터를 일부 변형하더라도 가능하면 모두 들여올 수 있도록 수정했습니다. 아이디나 메일 주소가 변형되어 로그인이 안 되는 회원이 발생하더라도 사이트 운영자가 조치해 주면 그만이니까요.
't' + member_srl형태로 강제 지정합니다.아이디 + '@example.com'형태로 강제 지정합니다. 특히 구버전의 그누보드에서는 메일 주소를 아무렇게나 입력해도 받아주었기 때문에 엉망으로 저장되어 있는 회원정보가 많더군요.member_srl을 덧붙여 중복되지 않는 닉네임을 생성하는 코드가 정상 작동하도록 고치고, 아이디와 메일 주소에도 동일하게 적용합니다.Validator클래스에서 사용하는 정규식을 그대로 사용합니다.