{"action":"created","comment":{"url":"https://api.github.com/repos/silverstripe/silverstripe-forum/pulls/comments/35265116","id":35265116,"diff_hunk":"@@ -252,11 +242,24 @@ function getNumTopics() {\n \t * @return int Returns the number of distinct authors\n \t */\n \tpublic function getNumAuthors() {\n-\t\treturn DB::query(\"\n-\t\t\tSELECT COUNT(DISTINCT \\\"Post\\\".\\\"AuthorID\\\") \n-\t\t\tFROM \\\"Post\\\" \n-\t\t\tJOIN \\\"\" . ForumHolder::baseForumTable() . \"\\\" AS \\\"ForumPage\\\" ON \\\"Post\\\".\\\"ForumID\\\"=\\\"ForumPage\\\".\\\"ID\\\"\n-\t\t\tAND \\\"ForumPage\\\".\\\"ParentID\\\" = '\" . $this->ID . \"'\")->value(); \t\t\n+\t\treturn $this->getForumStatistics()['Authors'];\n+\t}\n+\n+\t/**\n+\t * Tally the number of posts, threads and authors from the Forum of this ForumHolder\n+\t *\n+\t * @return array Returns an key => value pair of the stats for the forum.\n+\t */\n+\tpublic function getForumStatistics() {","path":"code/pagetypes/ForumHolder.php","position":238,"original_position":238,"commit_id":"ce5cfa7a57ea6a74155eaf334189e6d786383672","original_commit_id":"ce5cfa7a57ea6a74155eaf334189e6d786383672","user":{"login":"tractorcow","id":936064,"avatar_url":"https://avatars.githubusercontent.com/u/936064?v=3","gravatar_id":"","url":"https://api.github.com/users/tractorcow","html_url":"https://github.com/tractorcow","followers_url":"https://api.github.com/users/tractorcow/followers","following_url":"https://api.github.com/users/tractorcow/following{/other_user}","gists_url":"https://api.github.com/users/tractorcow/gists{/gist_id}","starred_url":"https://api.github.com/users/tractorcow/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tractorcow/subscriptions","organizations_url":"https://api.github.com/users/tractorcow/orgs","repos_url":"https://api.github.com/users/tractorcow/repos","events_url":"https://api.github.com/users/tractorcow/events{/privacy}","received_events_url":"https://api.github.com/users/tractorcow/received_events","type":"User","site_admin":false},"body":"I would recommend going back to a SQL only based approach. It can be awkward to have to re-implement business logic in sql, but you get the benefit of sql query caches, and not having to run tasks in o(n) for each request, (or is this o(n^2)? ). This is going to be a huge performance bottleneck.","created_at":"2015-07-22T21:16:03Z","updated_at":"2015-07-22T21:16:03Z","html_url":"https://github.com/silverstripe/silverstripe-forum/pull/145#discussion_r35265116","pull_request_url":"https://api.github.com/repos/silverstripe/silverstripe-forum/pulls/145","_links":{"self":{"href":"https://api.github.com/repos/silverstripe/silverstripe-forum/pulls/comments/35265116"},"html":{"href":"https://github.com/silverstripe/silverstripe-forum/pull/145#discussion_r35265116"},"pull_request":{"href":"https://api.github.com/repos/silverstripe/silverstripe-forum/pulls/145"}}},"pull_request":{"url":"https://api.github.com/repos/silverstripe/silverstripe-forum/pulls/145","id":40302675,"html_url":"https://github.com/silverstripe/silverstripe-forum/pull/145","diff_url":"https://github.com/silverstripe/silverstripe-forum/pull/145.diff","patch_url":"https://github.com/silverstripe/silverstripe-forum/pull/145.patch","issue_url":"https://api.github.com/repos/silverstripe/silverstripe-forum/issues/145","number":145,"state":"open","locked":false,"title":"FIX Forum statistics exclude spammers","user":{"login":"camfindlay","id":367847,"avatar_url":"https://avatars.githubusercontent.com/u/367847?v=3","gravatar_id":"","url":"https://api.github.com/users/camfindlay","html_url":"https://github.com/camfindlay","followers_url":"https://api.github.com/users/camfindlay/followers","following_url":"https://api.github.com/users/camfindlay/following{/other_user}","gists_url":"https://api.github.com/users/camfindlay/gists{/gist_id}","starred_url":"https://api.github.com/users/camfindlay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/camfindlay/subscriptions","organizations_url":"https://api.github.com/users/camfindlay/orgs","repos_url":"https://api.github.com/users/camfindlay/repos","events_url":"https://api.github.com/users/camfindlay/events{/privacy}","received_events_url":"https://api.github.com/users/camfindlay/received_events","type":"User","site_admin":false},"body":"Fixes #118 - @dhensby if you have a sec can you peer this?","created_at":"2015-07-19T03:41:49Z","updated_at":"2015-07-22T21:16:03Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8907687b45de78266ebee41dbe1d583f8e370d02","assignee":null,"milestone":{"url":"https://api.github.com/repos/silverstripe/silverstripe-forum/milestones/6","html_url":"https://github.com/silverstripe/silverstripe-forum/milestones/0.8.0","labels_url":"https://api.github.com/repos/silverstripe/silverstripe-forum/milestones/6/labels","id":984118,"number":6,"title":"0.8.0","description":"","creator":{"login":"camfindlay","id":367847,"avatar_url":"https://avatars.githubusercontent.com/u/367847?v=3","gravatar_id":"","url":"https://api.github.com/users/camfindlay","html_url":"https://github.com/camfindlay","followers_url":"https://api.github.com/users/camfindlay/followers","following_url":"https://api.github.com/users/camfindlay/following{/other_user}","gists_url":"https://api.github.com/users/camfindlay/gists{/gist_id}","starred_url":"https://api.github.com/users/camfindlay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/camfindlay/subscriptions","organizations_url":"https://api.github.com/users/camfindlay/orgs","repos_url":"https://api.github.com/users/camfindlay/repos","events_url":"https://api.github.com/users/camfindlay/events{/privacy}","received_events_url":"https://api.github.com/users/camfindlay/received_events","type":"User","site_admin":false},"open_issues":2,"closed_issues":9,"state":"open","created_at":"2015-02-18T08:37:12Z","updated_at":"2015-07-21T15:48:47Z","due_on":"2015-07-30T12:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/silverstripe/silverstripe-forum/pulls/145/commits","review_comments_url":"https://api.github.com/repos/silverstripe/silverstripe-forum/pulls/145/comments","review_comment_url":"https://api.github.com/repos/silverstripe/silverstripe-forum/pulls/comments{/number}","comments_url":"https://api.github.com/repos/silverstripe/silverstripe-forum/issues/145/comments","statuses_url":"https://api.github.com/repos/silverstripe/silverstripe-forum/statuses/ce5cfa7a57ea6a74155eaf334189e6d786383672","head":{"label":"camfindlay:forumstatistics","ref":"forumstatistics","sha":"ce5cfa7a57ea6a74155eaf334189e6d786383672","user":{"login":"camfindlay","id":367847,"avatar_url":"https://avatars.githubusercontent.com/u/367847?v=3","gravatar_id":"","url":"https://api.github.com/users/camfindlay","html_url":"https://github.com/camfindlay","followers_url":"https://api.github.com/users/camfindlay/followers","following_url":"https://api.github.com/users/camfindlay/following{/other_user}","gists_url":"https://api.github.com/users/camfindlay/gists{/gist_id}","starred_url":"https://api.github.com/users/camfindlay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/camfindlay/subscriptions","organizations_url":"https://api.github.com/users/camfindlay/orgs","repos_url":"https://api.github.com/users/camfindlay/repos","events_url":"https://api.github.com/users/camfindlay/events{/privacy}","received_events_url":"https://api.github.com/users/camfindlay/received_events","type":"User","site_admin":false},"repo":{"id":15325227,"name":"silverstripe-forum","full_name":"camfindlay/silverstripe-forum","owner":{"login":"camfindlay","id":367847,"avatar_url":"https://avatars.githubusercontent.com/u/367847?v=3","gravatar_id":"","url":"https://api.github.com/users/camfindlay","html_url":"https://github.com/camfindlay","followers_url":"https://api.github.com/users/camfindlay/followers","following_url":"https://api.github.com/users/camfindlay/following{/other_user}","gists_url":"https://api.github.com/users/camfindlay/gists{/gist_id}","starred_url":"https://api.github.com/users/camfindlay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/camfindlay/subscriptions","organizations_url":"https://api.github.com/users/camfindlay/orgs","repos_url":"https://api.github.com/users/camfindlay/repos","events_url":"https://api.github.com/users/camfindlay/events{/privacy}","received_events_url":"https://api.github.com/users/camfindlay/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/camfindlay/silverstripe-forum","description":"Forum module for SilverStripe CMS","fork":true,"url":"https://api.github.com/repos/camfindlay/silverstripe-forum","forks_url":"https://api.github.com/repos/camfindlay/silverstripe-forum/forks","keys_url":"https://api.github.com/repos/camfindlay/silverstripe-forum/keys{/key_id}","collaborators_url":"https://api.github.com/repos/camfindlay/silverstripe-forum/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/camfindlay/silverstripe-forum/teams","hooks_url":"https://api.github.com/repos/camfindlay/silverstripe-forum/hooks","issue_events_url":"https://api.github.com/repos/camfindlay/silverstripe-forum/issues/events{/number}","events_url":"https://api.github.com/repos/camfindlay/silverstripe-forum/events","assignees_url":"https://api.github.com/repos/camfindlay/silverstripe-forum/assignees{/user}","branches_url":"https://api.github.com/repos/camfindlay/silverstripe-forum/branches{/branch}","tags_url":"https://api.github.com/repos/camfindlay/silverstripe-forum/tags","blobs_url":"https://api.github.com/repos/camfindlay/silverstripe-forum/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/camfindlay/silverstripe-forum/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/camfindlay/silverstripe-forum/git/refs{/sha}","trees_url":"https://api.github.com/repos/camfindlay/silverstripe-forum/git/trees{/sha}","statuses_url":"https://api.github.com/repos/camfindlay/silverstripe-forum/statuses/{sha}","languages_url":"https://api.github.com/repos/camfindlay/silverstripe-forum/languages","stargazers_url":"https://api.github.com/repos/camfindlay/silverstripe-forum/stargazers","contributors_url":"https://api.github.com/repos/camfindlay/silverstripe-forum/contributors","subscribers_url":"https://api.github.com/repos/camfindlay/silverstripe-forum/subscribers","subscription_url":"https://api.github.com/repos/camfindlay/silverstripe-forum/subscription","commits_url":"https://api.github.com/repos/camfindlay/silverstripe-forum/commits{/sha}","git_commits_url":"https://api.github.com/repos/camfindlay/silverstripe-forum/git/commits{/sha}","comments_url":"https://api.github.com/repos/camfindlay/silverstripe-forum/comments{/number}","issue_comment_url":"https://api.github.com/repos/camfindlay/silverstripe-forum/issues/comments{/number}","contents_url":"https://api.github.com/repos/camfindlay/silverstripe-forum/contents/{+path}","compare_url":"https://api.github.com/repos/camfindlay/silverstripe-forum/compare/{base}...{head}","merges_url":"https://api.github.com/repos/camfindlay/silverstripe-forum/merges","archive_url":"https://api.github.com/repos/camfindlay/silverstripe-forum/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/camfindlay/silverstripe-forum/downloads","issues_url":"https://api.github.com/repos/camfindlay/silverstripe-forum/issues{/number}","pulls_url":"https://api.github.com/repos/camfindlay/silverstripe-forum/pulls{/number}","milestones_url":"https://api.github.com/repos/camfindlay/silverstripe-forum/milestones{/number}","notifications_url":"https://api.github.com/repos/camfindlay/silverstripe-forum/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/camfindlay/silverstripe-forum/labels{/name}","releases_url":"https://api.github.com/repos/camfindlay/silverstripe-forum/releases{/id}","created_at":"2013-12-19T23:15:44Z","updated_at":"2015-02-04T20:10:21Z","pushed_at":"2015-07-21T10:28:25Z","git_url":"git://github.com/camfindlay/silverstripe-forum.git","ssh_url":"git@github.com:camfindlay/silverstripe-forum.git","clone_url":"https://github.com/camfindlay/silverstripe-forum.git","svn_url":"https://github.com/camfindlay/silverstripe-forum","homepage":"http://silverstripe.org/forum-module","size":1779,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"silverstripe:0.8","ref":"0.8","sha":"7d9b154a6a91760689dab11399a5fa56bc973f03","user":{"login":"silverstripe","id":379348,"avatar_url":"https://avatars.githubusercontent.com/u/379348?v=3","gravatar_id":"","url":"https://api.github.com/users/silverstripe","html_url":"https://github.com/silverstripe","followers_url":"https://api.github.com/users/silverstripe/followers","following_url":"https://api.github.com/users/silverstripe/following{/other_user}","gists_url":"https://api.github.com/users/silverstripe/gists{/gist_id}","starred_url":"https://api.github.com/users/silverstripe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/silverstripe/subscriptions","organizations_url":"https://api.github.com/users/silverstripe/orgs","repos_url":"https://api.github.com/users/silverstripe/repos","events_url":"https://api.github.com/users/silverstripe/events{/privacy}","received_events_url":"https://api.github.com/users/silverstripe/received_events","type":"Organization","site_admin":false},"repo":{"id":1236915,"name":"silverstripe-forum","full_name":"silverstripe/silverstripe-forum","owner":{"login":"silverstripe","id":379348,"avatar_url":"https://avatars.githubusercontent.com/u/379348?v=3","gravatar_id":"","url":"https://api.github.com/users/silverstripe","html_url":"https://github.com/silverstripe","followers_url":"https://api.github.com/users/silverstripe/followers","following_url":"https://api.github.com/users/silverstripe/following{/other_user}","gists_url":"https://api.github.com/users/silverstripe/gists{/gist_id}","starred_url":"https://api.github.com/users/silverstripe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/silverstripe/subscriptions","organizations_url":"https://api.github.com/users/silverstripe/orgs","repos_url":"https://api.github.com/users/silverstripe/repos","events_url":"https://api.github.com/users/silverstripe/events{/privacy}","received_events_url":"https://api.github.com/users/silverstripe/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/silverstripe/silverstripe-forum","description":"Forum module for SilverStripe CMS","fork":false,"url":"https://api.github.com/repos/silverstripe/silverstripe-forum","forks_url":"https://api.github.com/repos/silverstripe/silverstripe-forum/forks","keys_url":"https://api.github.com/repos/silverstripe/silverstripe-forum/keys{/key_id}","collaborators_url":"https://api.github.com/repos/silverstripe/silverstripe-forum/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/silverstripe/silverstripe-forum/teams","hooks_url":"https://api.github.com/repos/silverstripe/silverstripe-forum/hooks","issue_events_url":"https://api.github.com/repos/silverstripe/silverstripe-forum/issues/events{/number}","events_url":"https://api.github.com/repos/silverstripe/silverstripe-forum/events","assignees_url":"https://api.github.com/repos/silverstripe/silverstripe-forum/assignees{/user}","branches_url":"https://api.github.com/repos/silverstripe/silverstripe-forum/branches{/branch}","tags_url":"https://api.github.com/repos/silverstripe/silverstripe-forum/tags","blobs_url":"https://api.github.com/repos/silverstripe/silverstripe-forum/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/silverstripe/silverstripe-forum/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/silverstripe/silverstripe-forum/git/refs{/sha}","trees_url":"https://api.github.com/repos/silverstripe/silverstripe-forum/git/trees{/sha}","statuses_url":"https://api.github.com/repos/silverstripe/silverstripe-forum/statuses/{sha}","languages_url":"https://api.github.com/repos/silverstripe/silverstripe-forum/languages","stargazers_url":"https://api.github.com/repos/silverstripe/silverstripe-forum/stargazers","contributors_url":"https://api.github.com/repos/silverstripe/silverstripe-forum/contributors","subscribers_url":"https://api.github.com/repos/silverstripe/silverstripe-forum/subscribers","subscription_url":"https://api.github.com/repos/silverstripe/silverstripe-forum/subscription","commits_url":"https://api.github.com/repos/silverstripe/silverstripe-forum/commits{/sha}","git_commits_url":"https://api.github.com/repos/silverstripe/silverstripe-forum/git/commits{/sha}","comments_url":"https://api.github.com/repos/silverstripe/silverstripe-forum/comments{/number}","issue_comment_url":"https://api.github.com/repos/silverstripe/silverstripe-forum/issues/comments{/number}","contents_url":"https://api.github.com/repos/silverstripe/silverstripe-forum/contents/{+path}","compare_url":"https://api.github.com/repos/silverstripe/silverstripe-forum/compare/{base}...{head}","merges_url":"https://api.github.com/repos/silverstripe/silverstripe-forum/merges","archive_url":"https://api.github.com/repos/silverstripe/silverstripe-forum/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/silverstripe/silverstripe-forum/downloads","issues_url":"https://api.github.com/repos/silverstripe/silverstripe-forum/issues{/number}","pulls_url":"https://api.github.com/repos/silverstripe/silverstripe-forum/pulls{/number}","milestones_url":"https://api.github.com/repos/silverstripe/silverstripe-forum/milestones{/number}","notifications_url":"https://api.github.com/repos/silverstripe/silverstripe-forum/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/silverstripe/silverstripe-forum/labels{/name}","releases_url":"https://api.github.com/repos/silverstripe/silverstripe-forum/releases{/id}","created_at":"2011-01-10T04:23:04Z","updated_at":"2015-04-29T07:20:27Z","pushed_at":"2015-07-21T22:37:01Z","git_url":"git://github.com/silverstripe/silverstripe-forum.git","ssh_url":"git@github.com:silverstripe/silverstripe-forum.git","clone_url":"https://github.com/silverstripe/silverstripe-forum.git","svn_url":"https://github.com/silverstripe/silverstripe-forum","homepage":"http://silverstripe.org/forum-module","size":2065,"stargazers_count":31,"watchers_count":31,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":47,"mirror_url":null,"open_issues_count":36,"forks":47,"open_issues":36,"watchers":31,"default_branch":"0.7"}},"_links":{"self":{"href":"https://api.github.com/repos/silverstripe/silverstripe-forum/pulls/145"},"html":{"href":"https://github.com/silverstripe/silverstripe-forum/pull/145"},"issue":{"href":"https://api.github.com/repos/silverstripe/silverstripe-forum/issues/145"},"comments":{"href":"https://api.github.com/repos/silverstripe/silverstripe-forum/issues/145/comments"},"review_comments":{"href":"https://api.github.com/repos/silverstripe/silverstripe-forum/pulls/145/comments"},"review_comment":{"href":"https://api.github.com/repos/silverstripe/silverstripe-forum/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/silverstripe/silverstripe-forum/pulls/145/commits"},"statuses":{"href":"https://api.github.com/repos/silverstripe/silverstripe-forum/statuses/ce5cfa7a57ea6a74155eaf334189e6d786383672"}}}}