{"action":"created","comment":{"url":"https://api.github.com/repos/Wikia/app/pulls/comments/207471657","pull_request_review_id":143090011,"id":207471657,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwNzQ3MTY1Nw==","diff_hunk":"@@ -404,51 +402,58 @@ public function execute() {\n \t\t/**\n \t\t * check if not additional domain was used (then we redirect anyway)\n \t\t */\n-\t\t$cond2 = $this->mAlternativeDomainUsed && ( $url['host'] != $this->mOldServerName );\n+\t\t$cond2 = $this->mAlternativeDomainUsed &&\n+\t\t\t( $url['host'] != WikiFactory::normalizeHost( $this->mOldServerName ) );\n \n \t\t$redirectUrl = WikiFactory::getLocalEnvURL( $this->mCityUrl );\n \t\t$shouldUseHttps = ( $wgEnableHTTPSForAnons || !empty( $_SERVER['HTTP_FASTLY_SSL'] ) ) &&\n \t\t\twfHttpsAllowedForURL( $redirectUrl ) &&\n \t\t\t!empty( $_SERVER['HTTP_FASTLY_FF'] );\t// don't redirect internal clients\n \t\t$shouldUpgradeToHttps = $shouldUseHttps && empty( $_SERVER['HTTP_FASTLY_SSL'] );\n \n-\t\tif ( ( $cond1 || $cond2 || $shouldUpgradeToHttps ) &&  $wgWikiFactoryRedirectForAlternateDomains ) {\n+\t\tif ( $cond1 || $cond2 || $shouldUpgradeToHttps ) {\n \t\t\tif ( $shouldUseHttps ) {\n \t\t\t\t$redirectUrl = wfHttpToHttps( $redirectUrl );\n \t\t\t}\n-\t\t\t$target = rtrim( $redirectUrl, '/' ) . '/' . $this->pathParams;\n-\n-\t\t\t$queryParams = $_GET;\n-\t\t\t$localArticlePathClean = str_replace( '$1', '', $wgArticlePath );\n-\t\t\tif ( !empty( $localArticlePathClean ) &&\n-\t\t\t\t!empty( $queryParams['title'] ) &&\n-\t\t\t\tstartsWith( $this->pathParams,  ltrim( $localArticlePathClean, '/' ) ) ) {\n-\t\t\t\t// skip the 'title' which is part of the $target, but append remaining parameters\n-\t\t\t\tunset( $queryParams['title'] );\n+\t\t\tif ( isset( $this->parsedUrl['path'] ) ) {\n+\t\t\t\t$redirectUrl .= $this->parsedUrl['path'];\n \t\t\t}\n-\n-\t\t\tif ( !empty( $queryParams ) ) {\n-\t\t\t\t$target .= '?' . http_build_query( $queryParams );\n+\t\t\tif ( isset( $this->parsedUrl['query'] ) ) {\n+\t\t\t\t$redirectUrl .= '?' . $this->parsedUrl['query'];\n+\t\t\t}\n+\t\t\tif ( isset( $this->parsedUrl['fragment'] ) ) {\n+\t\t\t\t$redirectUrl .= '#' . $this->parsedUrl['fragment'];\n \t\t\t}\n \n-\t\t\theader( \"X-Redirected-By-WF: NotPrimary\" );\n-\t\t\theader( 'Vary: Cookie,Accept-Encoding' );\n-\n-\t\t\tglobal $wgCookiePrefix;\n-\t\t\t$hasAuthCookie = !empty( $_COOKIE[\\Wikia\\Service\\User\\Auth\\CookieHelper::ACCESS_TOKEN_COOKIE_NAME] ) ||\n-\t\t\t\t!empty( $_COOKIE[session_name()] ) ||\n-\t\t\t\t!empty( $_COOKIE[\"{$wgCookiePrefix}Token\"] ) ||\n-\t\t\t\t!empty( $_COOKIE[\"{$wgCookiePrefix}UserID\"] );\n+\t\t\t$redirectedBy = [];\n+\t\t\tif ( $shouldUpgradeToHttps ) $redirectedBy[] = 'AnonsHTTPSUpgrade';\n+\t\t\tif ( $cond1 ) $redirectedBy[] = 'NotPrimary';\n+\t\t\tif ( $cond2 ) $redirectedBy[] = 'AlternativeDomain';\n+\t\t\t$redirectedBy = join( ' ', $redirectedBy );\n \n-\t\t\tif ( $hasAuthCookie ) {\n-\t\t\t\theader( 'Cache-Control: private, must-revalidate, max-age=0' );\n+\t\t\tglobal $wgWFLRedirect;","path":"extensions/wikia/WikiFactory/Loader/WikiFactoryLoader.php","position":141,"original_position":141,"commit_id":"f61694b2ff07db46e94402ef23f2a1373064e2e5","original_commit_id":"f61694b2ff07db46e94402ef23f2a1373064e2e5","user":{"login":"themech","id":150686,"node_id":"MDQ6VXNlcjE1MDY4Ng==","avatar_url":"https://avatars1.githubusercontent.com/u/150686?v=4","gravatar_id":"","url":"https://api.github.com/users/themech","html_url":"https://github.com/themech","followers_url":"https://api.github.com/users/themech/followers","following_url":"https://api.github.com/users/themech/following{/other_user}","gists_url":"https://api.github.com/users/themech/gists{/gist_id}","starred_url":"https://api.github.com/users/themech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/themech/subscriptions","organizations_url":"https://api.github.com/users/themech/orgs","repos_url":"https://api.github.com/users/themech/repos","events_url":"https://api.github.com/users/themech/events{/privacy}","received_events_url":"https://api.github.com/users/themech/received_events","type":"User","site_admin":false},"body":"Note: replace with a hook call, name is something like `WikiFactoryLoaderRedirect`","created_at":"2018-08-03T08:12:01Z","updated_at":"2018-08-03T08:12:01Z","html_url":"https://github.com/Wikia/app/pull/15828#discussion_r207471657","pull_request_url":"https://api.github.com/repos/Wikia/app/pulls/15828","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/Wikia/app/pulls/comments/207471657"},"html":{"href":"https://github.com/Wikia/app/pull/15828#discussion_r207471657"},"pull_request":{"href":"https://api.github.com/repos/Wikia/app/pulls/15828"}}},"pull_request":{"url":"https://api.github.com/repos/Wikia/app/pulls/15828","id":204818543,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA0ODE4NTQz","html_url":"https://github.com/Wikia/app/pull/15828","diff_url":"https://github.com/Wikia/app/pull/15828.diff","patch_url":"https://github.com/Wikia/app/pull/15828.patch","issue_url":"https://api.github.com/repos/Wikia/app/issues/15828","number":15828,"state":"open","locked":false,"title":"PLATFORM-3567: merge WFL and MediaWiki redirects - poc","user":{"login":"themech","id":150686,"node_id":"MDQ6VXNlcjE1MDY4Ng==","avatar_url":"https://avatars1.githubusercontent.com/u/150686?v=4","gravatar_id":"","url":"https://api.github.com/users/themech","html_url":"https://github.com/themech","followers_url":"https://api.github.com/users/themech/followers","following_url":"https://api.github.com/users/themech/following{/other_user}","gists_url":"https://api.github.com/users/themech/gists{/gist_id}","starred_url":"https://api.github.com/users/themech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/themech/subscriptions","organizations_url":"https://api.github.com/users/themech/orgs","repos_url":"https://api.github.com/users/themech/repos","events_url":"https://api.github.com/users/themech/events{/privacy}","received_events_url":"https://api.github.com/users/themech/received_events","type":"User","site_admin":false},"body":"Major changes:\r\n* WFL redirects can be intercepted and merged later with Main page/Title redirects\r\n* X-Redirected-By header can include several space-separated values\r\n* WFL redirects preserve query parameters and url fragments\r\n","created_at":"2018-07-30T14:14:41Z","updated_at":"2018-08-03T08:12:01Z","closed_at":null,"merged_at":null,"merge_commit_sha":"bf1e8b22d3fb8bc990e759bce6f300763aaea031","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":294430747,"node_id":"MDU6TGFiZWwyOTQ0MzA3NDc=","url":"https://api.github.com/repos/Wikia/app/labels/Don't%20merge","name":"Don't merge","color":"e11d21","default":false},{"id":294431082,"node_id":"MDU6TGFiZWwyOTQ0MzEwODI=","url":"https://api.github.com/repos/Wikia/app/labels/Work%20in%20progress","name":"Work in progress","color":"207de5","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/Wikia/app/pulls/15828/commits","review_comments_url":"https://api.github.com/repos/Wikia/app/pulls/15828/comments","review_comment_url":"https://api.github.com/repos/Wikia/app/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Wikia/app/issues/15828/comments","statuses_url":"https://api.github.com/repos/Wikia/app/statuses/f61694b2ff07db46e94402ef23f2a1373064e2e5","head":{"label":"Wikia:PLATFORM-3567","ref":"PLATFORM-3567","sha":"f61694b2ff07db46e94402ef23f2a1373064e2e5","user":{"login":"Wikia","id":1171011,"node_id":"MDEyOk9yZ2FuaXphdGlvbjExNzEwMTE=","avatar_url":"https://avatars3.githubusercontent.com/u/1171011?v=4","gravatar_id":"","url":"https://api.github.com/users/Wikia","html_url":"https://github.com/Wikia","followers_url":"https://api.github.com/users/Wikia/followers","following_url":"https://api.github.com/users/Wikia/following{/other_user}","gists_url":"https://api.github.com/users/Wikia/gists{/gist_id}","starred_url":"https://api.github.com/users/Wikia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Wikia/subscriptions","organizations_url":"https://api.github.com/users/Wikia/orgs","repos_url":"https://api.github.com/users/Wikia/repos","events_url":"https://api.github.com/users/Wikia/events{/privacy}","received_events_url":"https://api.github.com/users/Wikia/received_events","type":"Organization","site_admin":false},"repo":{"id":5532313,"node_id":"MDEwOlJlcG9zaXRvcnk1NTMyMzEz","name":"app","full_name":"Wikia/app","owner":{"login":"Wikia","id":1171011,"node_id":"MDEyOk9yZ2FuaXphdGlvbjExNzEwMTE=","avatar_url":"https://avatars3.githubusercontent.com/u/1171011?v=4","gravatar_id":"","url":"https://api.github.com/users/Wikia","html_url":"https://github.com/Wikia","followers_url":"https://api.github.com/users/Wikia/followers","following_url":"https://api.github.com/users/Wikia/following{/other_user}","gists_url":"https://api.github.com/users/Wikia/gists{/gist_id}","starred_url":"https://api.github.com/users/Wikia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Wikia/subscriptions","organizations_url":"https://api.github.com/users/Wikia/orgs","repos_url":"https://api.github.com/users/Wikia/repos","events_url":"https://api.github.com/users/Wikia/events{/privacy}","received_events_url":"https://api.github.com/users/Wikia/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Wikia/app","description":"Wikia Application Code","fork":false,"url":"https://api.github.com/repos/Wikia/app","forks_url":"https://api.github.com/repos/Wikia/app/forks","keys_url":"https://api.github.com/repos/Wikia/app/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Wikia/app/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Wikia/app/teams","hooks_url":"https://api.github.com/repos/Wikia/app/hooks","issue_events_url":"https://api.github.com/repos/Wikia/app/issues/events{/number}","events_url":"https://api.github.com/repos/Wikia/app/events","assignees_url":"https://api.github.com/repos/Wikia/app/assignees{/user}","branches_url":"https://api.github.com/repos/Wikia/app/branches{/branch}","tags_url":"https://api.github.com/repos/Wikia/app/tags","blobs_url":"https://api.github.com/repos/Wikia/app/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Wikia/app/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Wikia/app/git/refs{/sha}","trees_url":"https://api.github.com/repos/Wikia/app/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Wikia/app/statuses/{sha}","languages_url":"https://api.github.com/repos/Wikia/app/languages","stargazers_url":"https://api.github.com/repos/Wikia/app/stargazers","contributors_url":"https://api.github.com/repos/Wikia/app/contributors","subscribers_url":"https://api.github.com/repos/Wikia/app/subscribers","subscription_url":"https://api.github.com/repos/Wikia/app/subscription","commits_url":"https://api.github.com/repos/Wikia/app/commits{/sha}","git_commits_url":"https://api.github.com/repos/Wikia/app/git/commits{/sha}","comments_url":"https://api.github.com/repos/Wikia/app/comments{/number}","issue_comment_url":"https://api.github.com/repos/Wikia/app/issues/comments{/number}","contents_url":"https://api.github.com/repos/Wikia/app/contents/{+path}","compare_url":"https://api.github.com/repos/Wikia/app/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Wikia/app/merges","archive_url":"https://api.github.com/repos/Wikia/app/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Wikia/app/downloads","issues_url":"https://api.github.com/repos/Wikia/app/issues{/number}","pulls_url":"https://api.github.com/repos/Wikia/app/pulls{/number}","milestones_url":"https://api.github.com/repos/Wikia/app/milestones{/number}","notifications_url":"https://api.github.com/repos/Wikia/app/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Wikia/app/labels{/name}","releases_url":"https://api.github.com/repos/Wikia/app/releases{/id}","deployments_url":"https://api.github.com/repos/Wikia/app/deployments","created_at":"2012-08-23T20:55:58Z","updated_at":"2018-08-03T07:48:18Z","pushed_at":"2018-08-03T07:57:54Z","git_url":"git://github.com/Wikia/app.git","ssh_url":"git@github.com:Wikia/app.git","clone_url":"https://github.com/Wikia/app.git","svn_url":"https://github.com/Wikia/app","homepage":"http://dev.wikia.com","size":764772,"stargazers_count":145,"watchers_count":145,"language":"PHP","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":113,"mirror_url":null,"archived":false,"open_issues_count":24,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":113,"open_issues":24,"watchers":145,"default_branch":"dev"}},"base":{"label":"Wikia:dev","ref":"dev","sha":"8fcd85da5f27cc17258e89bf35761ae03a34dd4d","user":{"login":"Wikia","id":1171011,"node_id":"MDEyOk9yZ2FuaXphdGlvbjExNzEwMTE=","avatar_url":"https://avatars3.githubusercontent.com/u/1171011?v=4","gravatar_id":"","url":"https://api.github.com/users/Wikia","html_url":"https://github.com/Wikia","followers_url":"https://api.github.com/users/Wikia/followers","following_url":"https://api.github.com/users/Wikia/following{/other_user}","gists_url":"https://api.github.com/users/Wikia/gists{/gist_id}","starred_url":"https://api.github.com/users/Wikia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Wikia/subscriptions","organizations_url":"https://api.github.com/users/Wikia/orgs","repos_url":"https://api.github.com/users/Wikia/repos","events_url":"https://api.github.com/users/Wikia/events{/privacy}","received_events_url":"https://api.github.com/users/Wikia/received_events","type":"Organization","site_admin":false},"repo":{"id":5532313,"node_id":"MDEwOlJlcG9zaXRvcnk1NTMyMzEz","name":"app","full_name":"Wikia/app","owner":{"login":"Wikia","id":1171011,"node_id":"MDEyOk9yZ2FuaXphdGlvbjExNzEwMTE=","avatar_url":"https://avatars3.githubusercontent.com/u/1171011?v=4","gravatar_id":"","url":"https://api.github.com/users/Wikia","html_url":"https://github.com/Wikia","followers_url":"https://api.github.com/users/Wikia/followers","following_url":"https://api.github.com/users/Wikia/following{/other_user}","gists_url":"https://api.github.com/users/Wikia/gists{/gist_id}","starred_url":"https://api.github.com/users/Wikia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Wikia/subscriptions","organizations_url":"https://api.github.com/users/Wikia/orgs","repos_url":"https://api.github.com/users/Wikia/repos","events_url":"https://api.github.com/users/Wikia/events{/privacy}","received_events_url":"https://api.github.com/users/Wikia/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Wikia/app","description":"Wikia Application Code","fork":false,"url":"https://api.github.com/repos/Wikia/app","forks_url":"https://api.github.com/repos/Wikia/app/forks","keys_url":"https://api.github.com/repos/Wikia/app/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Wikia/app/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Wikia/app/teams","hooks_url":"https://api.github.com/repos/Wikia/app/hooks","issue_events_url":"https://api.github.com/repos/Wikia/app/issues/events{/number}","events_url":"https://api.github.com/repos/Wikia/app/events","assignees_url":"https://api.github.com/repos/Wikia/app/assignees{/user}","branches_url":"https://api.github.com/repos/Wikia/app/branches{/branch}","tags_url":"https://api.github.com/repos/Wikia/app/tags","blobs_url":"https://api.github.com/repos/Wikia/app/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Wikia/app/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Wikia/app/git/refs{/sha}","trees_url":"https://api.github.com/repos/Wikia/app/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Wikia/app/statuses/{sha}","languages_url":"https://api.github.com/repos/Wikia/app/languages","stargazers_url":"https://api.github.com/repos/Wikia/app/stargazers","contributors_url":"https://api.github.com/repos/Wikia/app/contributors","subscribers_url":"https://api.github.com/repos/Wikia/app/subscribers","subscription_url":"https://api.github.com/repos/Wikia/app/subscription","commits_url":"https://api.github.com/repos/Wikia/app/commits{/sha}","git_commits_url":"https://api.github.com/repos/Wikia/app/git/commits{/sha}","comments_url":"https://api.github.com/repos/Wikia/app/comments{/number}","issue_comment_url":"https://api.github.com/repos/Wikia/app/issues/comments{/number}","contents_url":"https://api.github.com/repos/Wikia/app/contents/{+path}","compare_url":"https://api.github.com/repos/Wikia/app/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Wikia/app/merges","archive_url":"https://api.github.com/repos/Wikia/app/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Wikia/app/downloads","issues_url":"https://api.github.com/repos/Wikia/app/issues{/number}","pulls_url":"https://api.github.com/repos/Wikia/app/pulls{/number}","milestones_url":"https://api.github.com/repos/Wikia/app/milestones{/number}","notifications_url":"https://api.github.com/repos/Wikia/app/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Wikia/app/labels{/name}","releases_url":"https://api.github.com/repos/Wikia/app/releases{/id}","deployments_url":"https://api.github.com/repos/Wikia/app/deployments","created_at":"2012-08-23T20:55:58Z","updated_at":"2018-08-03T07:48:18Z","pushed_at":"2018-08-03T07:57:54Z","git_url":"git://github.com/Wikia/app.git","ssh_url":"git@github.com:Wikia/app.git","clone_url":"https://github.com/Wikia/app.git","svn_url":"https://github.com/Wikia/app","homepage":"http://dev.wikia.com","size":764772,"stargazers_count":145,"watchers_count":145,"language":"PHP","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":113,"mirror_url":null,"archived":false,"open_issues_count":24,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":113,"open_issues":24,"watchers":145,"default_branch":"dev"}},"_links":{"self":{"href":"https://api.github.com/repos/Wikia/app/pulls/15828"},"html":{"href":"https://github.com/Wikia/app/pull/15828"},"issue":{"href":"https://api.github.com/repos/Wikia/app/issues/15828"},"comments":{"href":"https://api.github.com/repos/Wikia/app/issues/15828/comments"},"review_comments":{"href":"https://api.github.com/repos/Wikia/app/pulls/15828/comments"},"review_comment":{"href":"https://api.github.com/repos/Wikia/app/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Wikia/app/pulls/15828/commits"},"statuses":{"href":"https://api.github.com/repos/Wikia/app/statuses/f61694b2ff07db46e94402ef23f2a1373064e2e5"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"themech"}}