{"action":"created","comment":{"url":"https://api.github.com/repos/Wikia/app/pulls/comments/84820557","pull_request_review_id":5573132,"id":84820557,"diff_hunk":"@@ -73,60 +124,126 @@ private function getIso8601Timestamp( $touched ) {\n \t\t\t$touched[12] . $touched[13] . 'Z';\n \t}\n \n-\tprivate function getNamespaces() {\n+\tprivate function getOtherNamespaces() {\n \t\t$nsIds = array_unique( $this->wg->ContLang->getNamespaceIds() );\n+\t\treturn array_filter( $nsIds, [ $this, 'isOtherNamespace' ] );\n+\t}\n \n-\t\treturn array_filter( $nsIds, function ( $id ) {\n-\t\t\t// Exclude negative namespaces\n-\t\t\tif ( $id < 0 ) {\n-\t\t\t\treturn false;\n-\t\t\t}\n+\tprivate function generateSitemapPage( array $nses, $page ) {\n+\t\t$out = '<?xml version=\"1.0\" encoding=\"UTF-8\"?>' . PHP_EOL;\n+\t\t$out .= '<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\">' . PHP_EOL;\n+\t\t$out .= '<!-- Namespaces: ' . implode( ', ', $nses ) . '; page: ' . $page . ' -->' . PHP_EOL;\n \n-\t\t\t// Exclude talk pages\n-\t\t\tif ( $id % 2 !== 0 ) {\n-\t\t\t\treturn false;\n-\t\t\t}\n+\t\t$offset = self::URLS_PER_PAGE * ( $page - 1 );\n+\t\t$limit = self::URLS_PER_PAGE;\n+\n+\t\tforeach ( $nses as $ns ) {\n+\t\t\t$priority[$ns] = self::PRIORITIES[$ns] ?? self::DEFAULT_PRIORITY;\n+\t\t\t$title = Title::newFromText( '$1', $ns );\n+\t\t\t$urlPrefix[$ns] = str_replace( '$1', '', $title->getFullURL() );\n+\t\t}\n+\n+\t\tforeach ( $this->model->getItems( $nses, $offset, $limit ) as $page ) {\n+\t\t\t$encodedTitle = wfUrlencode( str_replace( ' ', '_', $page->page_title ) );\n+\t\t\t$lastmod = $this->getIso8601Timestamp( $page->page_touched );\n+\n+\t\t\t$out .= '<url>' . PHP_EOL;\n+\t\t\t$out .= '<loc>' . $urlPrefix[$page->page_namespace] . $encodedTitle . '</loc>' . PHP_EOL;\n+\t\t\t$out .= '<lastmod>' . $lastmod . '</lastmod>' . PHP_EOL;\n+\t\t\t$out .= '<priority>' . $priority[$page->page_namespace] . '</priority>' . PHP_EOL;\n+\t\t\t$out .= '</url>' . PHP_EOL;\n+\t\t}\n+\n+\t\t$out .= '</urlset>' . PHP_EOL;\n+\t\treturn $out;\n+\t}\n+\n+\tprivate function generateSitemapIndex() {\n+\t\t$out = '<?xml version=\"1.0\" encoding=\"UTF-8\"?>' . PHP_EOL;\n+\t\t$out .= '<sitemapindex xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\">' . PHP_EOL;\n \n-\t\t\t// Excluded namespaces\n-\t\t\tif ( in_array( $id, self::EXCLUDED_NAMESPACES ) ) {\n-\t\t\t\treturn false;\n+\t\t$baseUrl = $this->wg->Server;\n+\n+\t\tforeach ( self::SEPARATE_SITEMAPS as $ns ) {\n+\t\t\t$ns_pages = $this->model->getPageNumber( [ $ns ], self::URLS_PER_PAGE );\n+\t\t\tfor ( $page = 1; $page <= $ns_pages; $page++ ) {\n+\t\t\t\t$url = $baseUrl . '/sitemap-newsitemapxml-NS_' . $ns . '-p' . $page . '.xml';\n+\t\t\t\t$out .= '<sitemap><loc>' . $url . '</loc></sitemap>' . PHP_EOL;\n \t\t\t}\n+\t\t}\n+\n+\t\t$other_pages = $this->model->getPageNumber( $this->getOtherNamespaces(), self::URLS_PER_PAGE );\n+\n+\t\tfor ( $page = 1; $page <= $other_pages; $page++ ) {\n+\t\t\t$url = $baseUrl . '/sitemap-newsitemapxml-others-p' . $page . '.xml';\n+\t\t\t$out .= '<sitemap><loc>' . $url . '</loc></sitemap>' . PHP_EOL;\n+\t\t}\n+\n+\t\t$out .= '</sitemapindex>' . PHP_EOL;\n \n-\t\t\treturn true;\n-\t\t} );\n+\t\treturn $out;\n \t}\n \n-\tprivate function printNamespace( $ns ) {\n-\t\t$priority = self::PRIORITIES[$ns] ?? self::DEFAULT_PRIORITY;\n-\n-\t\t$title = Title::newFromText( '$1', $ns );\n-\t\t$urlPrefix = str_replace( '$1', '', $title->getFullURL() );\n-\n-\t\t$dbr = wfGetDB( DB_SLAVE );\n-\n-\t\t$query = $dbr->select(\n-\t\t\t'page',\n-\t\t\t[\n-\t\t\t\t'page_title',\n-\t\t\t\t'page_touched',\n-\t\t\t],\n-\t\t\t[\n-\t\t\t\t'page_namespace' => $ns,\n-\t\t\t\t'page_is_redirect' => false,\n-\t\t\t],\n-\t\t\t__METHOD__,\n-\t\t\t[\n-\t\t\t\t'ORDER BY' => 'page_id',\n-\t\t\t\t'LIMIT' => 15000,\n-\t\t\t]\n-\t\t);\n-\n-\t\twhile ( $row = $dbr->fetchObject( $query ) ) {\n-\t\t\techo '<url>' . PHP_EOL;\n-\t\t\techo '<loc>' . $urlPrefix . wfUrlencode( str_replace( ' ', '_', $row->page_title ) ) . '</loc>' . PHP_EOL;\n-\t\t\techo '<lastmod>' . $this->getIso8601Timestamp( $row->page_touched ) . '</lastmod>' . PHP_EOL;\n-\t\t\techo '<priority>' . $priority . '</priority>' . PHP_EOL;\n-\t\t\techo '</url>' . PHP_EOL;\n+\tprivate function isOtherNamespace( $nsId ) {","path":"extensions/wikia/SitemapXml/SpecialSitemapXmlController.class.php","position":235,"original_position":235,"commit_id":"ce079417fd2b0e2e26da32eb185cdc4e43c61ad2","original_commit_id":"ce079417fd2b0e2e26da32eb185cdc4e43c61ad2","user":{"login":"WikiaTech","id":13279985,"avatar_url":"https://avatars.githubusercontent.com/u/13279985?v=3","gravatar_id":"","url":"https://api.github.com/users/WikiaTech","html_url":"https://github.com/WikiaTech","followers_url":"https://api.github.com/users/WikiaTech/followers","following_url":"https://api.github.com/users/WikiaTech/following{/other_user}","gists_url":"https://api.github.com/users/WikiaTech/gists{/gist_id}","starred_url":"https://api.github.com/users/WikiaTech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/WikiaTech/subscriptions","organizations_url":"https://api.github.com/users/WikiaTech/orgs","repos_url":"https://api.github.com/users/WikiaTech/repos","events_url":"https://api.github.com/users/WikiaTech/events{/privacy}","received_events_url":"https://api.github.com/users/WikiaTech/received_events","type":"User","site_admin":false},"body":"![MAJOR](https://raw.githubusercontent.com/SonarCommunity/sonar-github/master/images/severity-major.png) Reduce the number of returns of this function 5, down to the maximum allowed 3. [![rule](https://raw.githubusercontent.com/SonarCommunity/sonar-github/master/images/rule.png)](http://10.8.74.32:9000/coding_rules#rule_key=php%3AS1142)\n","created_at":"2016-10-25T02:18:57Z","updated_at":"2016-10-25T02:18:57Z","html_url":"https://github.com/Wikia/app/pull/11681#discussion_r84820557","pull_request_url":"https://api.github.com/repos/Wikia/app/pulls/11681","_links":{"self":{"href":"https://api.github.com/repos/Wikia/app/pulls/comments/84820557"},"html":{"href":"https://github.com/Wikia/app/pull/11681#discussion_r84820557"},"pull_request":{"href":"https://api.github.com/repos/Wikia/app/pulls/11681"}}},"pull_request":{"url":"https://api.github.com/repos/Wikia/app/pulls/11681","id":90305304,"html_url":"https://github.com/Wikia/app/pull/11681","diff_url":"https://github.com/Wikia/app/pull/11681.diff","patch_url":"https://github.com/Wikia/app/pull/11681.patch","issue_url":"https://api.github.com/repos/Wikia/app/issues/11681","number":11681,"state":"open","locked":false,"title":"SEO-515 Divide the XML sitemaps to \"pages\"","user":{"login":"gabrys","id":74567,"avatar_url":"https://avatars.githubusercontent.com/u/74567?v=3","gravatar_id":"","url":"https://api.github.com/users/gabrys","html_url":"https://github.com/gabrys","followers_url":"https://api.github.com/users/gabrys/followers","following_url":"https://api.github.com/users/gabrys/following{/other_user}","gists_url":"https://api.github.com/users/gabrys/gists{/gist_id}","starred_url":"https://api.github.com/users/gabrys/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gabrys/subscriptions","organizations_url":"https://api.github.com/users/gabrys/orgs","repos_url":"https://api.github.com/users/gabrys/repos","events_url":"https://api.github.com/users/gabrys/events{/privacy}","received_events_url":"https://api.github.com/users/gabrys/received_events","type":"User","site_admin":false},"body":null,"created_at":"2016-10-21T00:33:33Z","updated_at":"2016-10-25T02:18:57Z","closed_at":null,"merged_at":null,"merge_commit_sha":"bc3273597610f334531f7e1a23a1fc1cf92e8347","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/Wikia/app/pulls/11681/commits","review_comments_url":"https://api.github.com/repos/Wikia/app/pulls/11681/comments","review_comment_url":"https://api.github.com/repos/Wikia/app/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Wikia/app/issues/11681/comments","statuses_url":"https://api.github.com/repos/Wikia/app/statuses/ce079417fd2b0e2e26da32eb185cdc4e43c61ad2","head":{"label":"Wikia:SEO-515-divide-xml-sitemaps","ref":"SEO-515-divide-xml-sitemaps","sha":"ce079417fd2b0e2e26da32eb185cdc4e43c61ad2","user":{"login":"Wikia","id":1171011,"avatar_url":"https://avatars.githubusercontent.com/u/1171011?v=3","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,"name":"app","full_name":"Wikia/app","owner":{"login":"Wikia","id":1171011,"avatar_url":"https://avatars.githubusercontent.com/u/1171011?v=3","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":"2016-10-24T08:51:36Z","pushed_at":"2016-10-25T02:18:27Z","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":1442901,"stargazers_count":104,"watchers_count":104,"language":"PHP","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":84,"mirror_url":null,"open_issues_count":113,"forks":84,"open_issues":113,"watchers":104,"default_branch":"dev"}},"base":{"label":"Wikia:dev","ref":"dev","sha":"06a00284ca1c729cfee673294b2f8073635a5111","user":{"login":"Wikia","id":1171011,"avatar_url":"https://avatars.githubusercontent.com/u/1171011?v=3","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,"name":"app","full_name":"Wikia/app","owner":{"login":"Wikia","id":1171011,"avatar_url":"https://avatars.githubusercontent.com/u/1171011?v=3","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":"2016-10-24T08:51:36Z","pushed_at":"2016-10-25T02:18:27Z","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":1442901,"stargazers_count":104,"watchers_count":104,"language":"PHP","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":84,"mirror_url":null,"open_issues_count":113,"forks":84,"open_issues":113,"watchers":104,"default_branch":"dev"}},"_links":{"self":{"href":"https://api.github.com/repos/Wikia/app/pulls/11681"},"html":{"href":"https://github.com/Wikia/app/pull/11681"},"issue":{"href":"https://api.github.com/repos/Wikia/app/issues/11681"},"comments":{"href":"https://api.github.com/repos/Wikia/app/issues/11681/comments"},"review_comments":{"href":"https://api.github.com/repos/Wikia/app/pulls/11681/comments"},"review_comment":{"href":"https://api.github.com/repos/Wikia/app/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Wikia/app/pulls/11681/commits"},"statuses":{"href":"https://api.github.com/repos/Wikia/app/statuses/ce079417fd2b0e2e26da32eb185cdc4e43c61ad2"}}}}
{"actor":{"display_login":"WikiaTech"}}