GitHub PullRequestReviewCommentEvent at 2014-08-09 11:33:00
Repository: phpbb
Actor: naderman
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/phpbb/phpbb/pulls/comments/16025594","id":16025594,"diff_hunk":"@@ -0,0 +1,137 @@\n+<?php\n+/**\n+*\n+* This file is part of the phpBB Forum Software package.\n+*\n+* @copyright (c) phpBB Limited <https://www.phpbb.com>\n+* @license GNU General Public License, version 2 (GPL-2.0)\n+*\n+* For full copyright and license information, please see\n+* the docs/CREDITS.txt file.\n+*\n+*/\n+\n+namespace phpbb\\db\\migration\\data\\v310;\n+\n+class topic_sort_username_clean extends \\phpbb\\db\\migration\\migration\n+{\n+\tprotected $user_array;\n+\n+\tpublic function effectively_installed()\n+\t{\n+\t\treturn $this->db_tools->sql_column_exists($this->table_prefix . 'topics', 'topic_first_poster_name_clean');\n+\t}\n+\n+\tstatic public function depends_on()\n+\t{\n+\t\treturn array('\\phpbb\\db\\migration\\data\\v310\\dev');\n+\t}\n+\n+\tpublic function update_schema()\n+\t{\n+\t\treturn array(\n+\t\t\t'add_columns' => array(\n+\t\t\t\t$this->table_prefix . 'topics'\t=> array(\n+\t\t\t\t\t'topic_first_poster_name_clean' => array('VCHAR_UNI:255', ''),\n+\t\t\t\t),\n+\t\t\t),\n+\t\t);\n+\t}\n+\n+\tpublic function revert_schema()\n+\t{\n+\t\treturn array(\n+\t\t\t'drop_columns' => array(\n+\t\t\t\t$this->table_prefix . 'topics'\t=> array(\n+\t\t\t\t\t'topic_first_poster_name_clean',\n+\t\t\t\t),\n+\t\t\t),\n+\t\t);\n+\t}\n+\n+\tpublic function update_data()\n+\t{\n+\t\treturn array(\n+\t\t\tarray('custom', array(array($this, 'update_topics'))),\n+\t\t);\n+\t}\n+\n+\tpublic function build_user_array()\n+\t{\n+\t\tif (!$this->user_array)\n+\t\t{\n+\t\t\t$this->user_array = array();\n+\t\t\t// First be get the username_clean field for all users to save some db load.\n+\t\t\t$sql = 'SELECT user_id, username_clean\n+\t\t\t\tFROM ' . $this->table_prefix . 'users\n+\t\t\t\tORDER BY user_id ASC';\n+\n+\t\t\t$result = $this->db->sql_query($sql);\n+\t\t\twhile($row = $this->db->sql_fetchrow($result))\n+\t\t\t{\n+\t\t\t\t$this->user_array[$row['user_id']] = $row['username_clean'];\n+\t\t\t}\n+\t\t\t$this->db->sql_freeresult($result);\n+\t\t}\n+\t}\n+\n+\t/**\n+\t * Warning : the function could take a long time (over 30 seconds)\n+\t */\n+\tpublic function update_topics($start)\n+\t{\n+\t\t$start = (int) $start;\n+\t\t$limit = 500;\n+\t\t$converted = 0;\n+\n+\t\t$this->build_user_array();\n+\n+\t\t$sql = 'SELECT topic_id, topic_poster, topic_first_poster_name\n+\t\t\tFROM ' . $this->table_prefix . 'topics\n+\t\t\tORDER BY topic_id ASC';\n+\t\t$result = $this->db->sql_query_limit($sql, $limit, $start);\n+\n+\t\twhile($row = $this->db->sql_fetchrow($result))\n+\t\t{\n+\t\t\tif($row['topic_poster'] == ANONYMOUS)\n+\t\t\t{\n+\t\t\t\tif($row['topic_first_poster_name'] != '')\n+\t\t\t\t{\n+\t\t\t\t\t$username = utf8_clean_string($row['topic_first_poster_name']);\n+\t\t\t\t}\n+\t\t\t\telse\n+\t\t\t\t{\n+\t\t\t\t\t// It is possible to use $user->lang['GUEST'] ?\n+\t\t\t\t\t$username = utf8_clean_string('Guest');\n+\t\t\t\t}\n+\t\t\t}\n+\t\t\telse\n+\t\t\t{\n+\t\t\t\tif(isset($this->user_array[$row['topic_poster']]))","path":"phpBB/phpbb/db/migration/data/v310/topic_sort_username_clean.php","position":110,"original_position":110,"commit_id":"d96c4ee79f09d7d46c7dd3fc73bd0c0e8e2183c2","original_commit_id":"d96c4ee79f09d7d46c7dd3fc73bd0c0e8e2183c2","user":{"login":"naderman","id":154844,"avatar_url":"https://avatars.githubusercontent.com/u/154844?v=2","gravatar_id":"9f580202b05cc640aa9297ab7a1ae764","url":"https://api.github.com/users/naderman","html_url":"https://github.com/naderman","followers_url":"https://api.github.com/users/naderman/followers","following_url":"https://api.github.com/users/naderman/following{/other_user}","gists_url":"https://api.github.com/users/naderman/gists{/gist_id}","starred_url":"https://api.github.com/users/naderman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/naderman/subscriptions","organizations_url":"https://api.github.com/users/naderman/orgs","repos_url":"https://api.github.com/users/naderman/repos","events_url":"https://api.github.com/users/naderman/events{/privacy}","received_events_url":"https://api.github.com/users/naderman/received_events","type":"User","site_admin":false},"body":"missing space after if, lots of other places too.","created_at":"2014-08-09T11:33:00Z","updated_at":"2014-08-09T11:33:00Z","html_url":"https://github.com/phpbb/phpbb/pull/2387#discussion_r16025594","pull_request_url":"https://api.github.com/repos/phpbb/phpbb/pulls/2387","_links":{"self":{"href":"https://api.github.com/repos/phpbb/phpbb/pulls/comments/16025594"},"html":{"href":"https://github.com/phpbb/phpbb/pull/2387#discussion_r16025594"},"pull_request":{"href":"https://api.github.com/repos/phpbb/phpbb/pulls/2387"}}},"pull_request":{"url":"https://api.github.com/repos/phpbb/phpbb/pulls/2387","id":15449611,"html_url":"https://github.com/phpbb/phpbb/pull/2387","diff_url":"https://github.com/phpbb/phpbb/pull/2387.diff","patch_url":"https://github.com/phpbb/phpbb/pull/2387.patch","issue_url":"https://api.github.com/repos/phpbb/phpbb/issues/2387","number":2387,"state":"open","title":"[3.2][ticket/8064] Forum author sort using username_clean","user":{"login":"Nicofuma","id":591456,"avatar_url":"https://avatars.githubusercontent.com/u/591456?v=2","gravatar_id":"4ca6947ea7c6c2303b6a4109cb931dd7","url":"https://api.github.com/users/Nicofuma","html_url":"https://github.com/Nicofuma","followers_url":"https://api.github.com/users/Nicofuma/followers","following_url":"https://api.github.com/users/Nicofuma/following{/other_user}","gists_url":"https://api.github.com/users/Nicofuma/gists{/gist_id}","starred_url":"https://api.github.com/users/Nicofuma/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Nicofuma/subscriptions","organizations_url":"https://api.github.com/users/Nicofuma/orgs","repos_url":"https://api.github.com/users/Nicofuma/repos","events_url":"https://api.github.com/users/Nicofuma/events{/privacy}","received_events_url":"https://api.github.com/users/Nicofuma/received_events","type":"User","site_admin":false},"body":"+ Conversion of the solution to 3.1.x\r\n+ Adding the migration file\r\n+ Bug fix (for moderation)\r\n\r\nTests still missing.\r\n\r\nAbout the migration file, we need to fill the column\r\n(topic_first_poster_name_clean) while updating the db but it's not easy\r\nand the migration could take a lot of time with thousands topics.\r\n\r\nhttps://tracker.phpbb.com/browse/PHPBB3-8064\r\n\r\nPHPBB3-8064","created_at":"2014-05-02T20:28:55Z","updated_at":"2014-08-09T11:33:00Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8d418745b2831522cea41ce28710867de2d9090f","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/phpbb/phpbb/pulls/2387/commits","review_comments_url":"https://api.github.com/repos/phpbb/phpbb/pulls/2387/comments","review_comment_url":"https://api.github.com/repos/phpbb/phpbb/pulls/comments/{number}","comments_url":"https://api.github.com/repos/phpbb/phpbb/issues/2387/comments","statuses_url":"https://api.github.com/repos/phpbb/phpbb/statuses/d96c4ee79f09d7d46c7dd3fc73bd0c0e8e2183c2","head":{"label":"Nicofuma:ticket/8064","ref":"ticket/8064","sha":"d96c4ee79f09d7d46c7dd3fc73bd0c0e8e2183c2","user":{"login":"Nicofuma","id":591456,"avatar_url":"https://avatars.githubusercontent.com/u/591456?v=2","gravatar_id":"4ca6947ea7c6c2303b6a4109cb931dd7","url":"https://api.github.com/users/Nicofuma","html_url":"https://github.com/Nicofuma","followers_url":"https://api.github.com/users/Nicofuma/followers","following_url":"https://api.github.com/users/Nicofuma/following{/other_user}","gists_url":"https://api.github.com/users/Nicofuma/gists{/gist_id}","starred_url":"https://api.github.com/users/Nicofuma/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Nicofuma/subscriptions","organizations_url":"https://api.github.com/users/Nicofuma/orgs","repos_url":"https://api.github.com/users/Nicofuma/repos","events_url":"https://api.github.com/users/Nicofuma/events{/privacy}","received_events_url":"https://api.github.com/users/Nicofuma/received_events","type":"User","site_admin":false},"repo":{"id":18715287,"name":"phpbb","full_name":"Nicofuma/phpbb","owner":{"login":"Nicofuma","id":591456,"avatar_url":"https://avatars.githubusercontent.com/u/591456?v=2","gravatar_id":"4ca6947ea7c6c2303b6a4109cb931dd7","url":"https://api.github.com/users/Nicofuma","html_url":"https://github.com/Nicofuma","followers_url":"https://api.github.com/users/Nicofuma/followers","following_url":"https://api.github.com/users/Nicofuma/following{/other_user}","gists_url":"https://api.github.com/users/Nicofuma/gists{/gist_id}","starred_url":"https://api.github.com/users/Nicofuma/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Nicofuma/subscriptions","organizations_url":"https://api.github.com/users/Nicofuma/orgs","repos_url":"https://api.github.com/users/Nicofuma/repos","events_url":"https://api.github.com/users/Nicofuma/events{/privacy}","received_events_url":"https://api.github.com/users/Nicofuma/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Nicofuma/phpbb","description":" phpBB 3 Development: phpBB is a popular open-source bulletin board written in PHP. This repository also contains the history of version 2.","fork":true,"url":"https://api.github.com/repos/Nicofuma/phpbb","forks_url":"https://api.github.com/repos/Nicofuma/phpbb/forks","keys_url":"https://api.github.com/repos/Nicofuma/phpbb/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Nicofuma/phpbb/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Nicofuma/phpbb/teams","hooks_url":"https://api.github.com/repos/Nicofuma/phpbb/hooks","issue_events_url":"https://api.github.com/repos/Nicofuma/phpbb/issues/events{/number}","events_url":"https://api.github.com/repos/Nicofuma/phpbb/events","assignees_url":"https://api.github.com/repos/Nicofuma/phpbb/assignees{/user}","branches_url":"https://api.github.com/repos/Nicofuma/phpbb/branches{/branch}","tags_url":"https://api.github.com/repos/Nicofuma/phpbb/tags","blobs_url":"https://api.github.com/repos/Nicofuma/phpbb/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Nicofuma/phpbb/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Nicofuma/phpbb/git/refs{/sha}","trees_url":"https://api.github.com/repos/Nicofuma/phpbb/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Nicofuma/phpbb/statuses/{sha}","languages_url":"https://api.github.com/repos/Nicofuma/phpbb/languages","stargazers_url":"https://api.github.com/repos/Nicofuma/phpbb/stargazers","contributors_url":"https://api.github.com/repos/Nicofuma/phpbb/contributors","subscribers_url":"https://api.github.com/repos/Nicofuma/phpbb/subscribers","subscription_url":"https://api.github.com/repos/Nicofuma/phpbb/subscription","commits_url":"https://api.github.com/repos/Nicofuma/phpbb/commits{/sha}","git_commits_url":"https://api.github.com/repos/Nicofuma/phpbb/git/commits{/sha}","comments_url":"https://api.github.com/repos/Nicofuma/phpbb/comments{/number}","issue_comment_url":"https://api.github.com/repos/Nicofuma/phpbb/issues/comments/{number}","contents_url":"https://api.github.com/repos/Nicofuma/phpbb/contents/{+path}","compare_url":"https://api.github.com/repos/Nicofuma/phpbb/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Nicofuma/phpbb/merges","archive_url":"https://api.github.com/repos/Nicofuma/phpbb/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Nicofuma/phpbb/downloads","issues_url":"https://api.github.com/repos/Nicofuma/phpbb/issues{/number}","pulls_url":"https://api.github.com/repos/Nicofuma/phpbb/pulls{/number}","milestones_url":"https://api.github.com/repos/Nicofuma/phpbb/milestones{/number}","notifications_url":"https://api.github.com/repos/Nicofuma/phpbb/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Nicofuma/phpbb/labels{/name}","releases_url":"https://api.github.com/repos/Nicofuma/phpbb/releases{/id}","created_at":"2014-04-12T21:36:20Z","updated_at":"2014-07-02T20:58:01Z","pushed_at":"2014-08-09T09:46:31Z","git_url":"git://github.com/Nicofuma/phpbb.git","ssh_url":"git@github.com:Nicofuma/phpbb.git","clone_url":"https://github.com/Nicofuma/phpbb.git","svn_url":"https://github.com/Nicofuma/phpbb","homepage":"http://www.phpbb.com","size":53593,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_downloads":true,"has_wiki":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"develop-ascraeus"}},"base":{"label":"phpbb:develop","ref":"develop","sha":"c068da7353b0d3dc0827a89ac01b274f9e6e7ce6","user":{"login":"phpbb","id":176697,"avatar_url":"https://avatars.githubusercontent.com/u/176697?v=2","gravatar_id":"cf23934d15908c132f1c236369262eb6","url":"https://api.github.com/users/phpbb","html_url":"https://github.com/phpbb","followers_url":"https://api.github.com/users/phpbb/followers","following_url":"https://api.github.com/users/phpbb/following{/other_user}","gists_url":"https://api.github.com/users/phpbb/gists{/gist_id}","starred_url":"https://api.github.com/users/phpbb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/phpbb/subscriptions","organizations_url":"https://api.github.com/users/phpbb/orgs","repos_url":"https://api.github.com/users/phpbb/repos","events_url":"https://api.github.com/users/phpbb/events{/privacy}","received_events_url":"https://api.github.com/users/phpbb/received_events","type":"Organization","site_admin":false},"repo":{"id":541983,"name":"phpbb","full_name":"phpbb/phpbb","owner":{"login":"phpbb","id":176697,"avatar_url":"https://avatars.githubusercontent.com/u/176697?v=2","gravatar_id":"cf23934d15908c132f1c236369262eb6","url":"https://api.github.com/users/phpbb","html_url":"https://github.com/phpbb","followers_url":"https://api.github.com/users/phpbb/followers","following_url":"https://api.github.com/users/phpbb/following{/other_user}","gists_url":"https://api.github.com/users/phpbb/gists{/gist_id}","starred_url":"https://api.github.com/users/phpbb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/phpbb/subscriptions","organizations_url":"https://api.github.com/users/phpbb/orgs","repos_url":"https://api.github.com/users/phpbb/repos","events_url":"https://api.github.com/users/phpbb/events{/privacy}","received_events_url":"https://api.github.com/users/phpbb/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/phpbb/phpbb","description":" phpBB 3 Development: phpBB is a popular open-source bulletin board written in PHP. This repository also contains the history of version 2.","fork":false,"url":"https://api.github.com/repos/phpbb/phpbb","forks_url":"https://api.github.com/repos/phpbb/phpbb/forks","keys_url":"https://api.github.com/repos/phpbb/phpbb/keys{/key_id}","collaborators_url":"https://api.github.com/repos/phpbb/phpbb/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/phpbb/phpbb/teams","hooks_url":"https://api.github.com/repos/phpbb/phpbb/hooks","issue_events_url":"https://api.github.com/repos/phpbb/phpbb/issues/events{/number}","events_url":"https://api.github.com/repos/phpbb/phpbb/events","assignees_url":"https://api.github.com/repos/phpbb/phpbb/assignees{/user}","branches_url":"https://api.github.com/repos/phpbb/phpbb/branches{/branch}","tags_url":"https://api.github.com/repos/phpbb/phpbb/tags","blobs_url":"https://api.github.com/repos/phpbb/phpbb/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/phpbb/phpbb/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/phpbb/phpbb/git/refs{/sha}","trees_url":"https://api.github.com/repos/phpbb/phpbb/git/trees{/sha}","statuses_url":"https://api.github.com/repos/phpbb/phpbb/statuses/{sha}","languages_url":"https://api.github.com/repos/phpbb/phpbb/languages","stargazers_url":"https://api.github.com/repos/phpbb/phpbb/stargazers","contributors_url":"https://api.github.com/repos/phpbb/phpbb/contributors","subscribers_url":"https://api.github.com/repos/phpbb/phpbb/subscribers","subscription_url":"https://api.github.com/repos/phpbb/phpbb/subscription","commits_url":"https://api.github.com/repos/phpbb/phpbb/commits{/sha}","git_commits_url":"https://api.github.com/repos/phpbb/phpbb/git/commits{/sha}","comments_url":"https://api.github.com/repos/phpbb/phpbb/comments{/number}","issue_comment_url":"https://api.github.com/repos/phpbb/phpbb/issues/comments/{number}","contents_url":"https://api.github.com/repos/phpbb/phpbb/contents/{+path}","compare_url":"https://api.github.com/repos/phpbb/phpbb/compare/{base}...{head}","merges_url":"https://api.github.com/repos/phpbb/phpbb/merges","archive_url":"https://api.github.com/repos/phpbb/phpbb/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/phpbb/phpbb/downloads","issues_url":"https://api.github.com/repos/phpbb/phpbb/issues{/number}","pulls_url":"https://api.github.com/repos/phpbb/phpbb/pulls{/number}","milestones_url":"https://api.github.com/repos/phpbb/phpbb/milestones{/number}","notifications_url":"https://api.github.com/repos/phpbb/phpbb/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/phpbb/phpbb/labels{/name}","releases_url":"https://api.github.com/repos/phpbb/phpbb/releases{/id}","created_at":"2010-03-01T22:33:17Z","updated_at":"2014-08-08T20:26:36Z","pushed_at":"2014-08-09T11:06:46Z","git_url":"git://github.com/phpbb/phpbb.git","ssh_url":"git@github.com:phpbb/phpbb.git","clone_url":"https://github.com/phpbb/phpbb.git","svn_url":"https://github.com/phpbb/phpbb","homepage":"http://www.phpbb.com","size":105474,"stargazers_count":646,"watchers_count":646,"language":"PHP","has_issues":false,"has_downloads":true,"has_wiki":false,"forks_count":376,"mirror_url":null,"open_issues_count":67,"forks":376,"open_issues":67,"watchers":646,"default_branch":"develop-ascraeus"}},"_links":{"self":{"href":"https://api.github.com/repos/phpbb/phpbb/pulls/2387"},"html":{"href":"https://github.com/phpbb/phpbb/pull/2387"},"issue":{"href":"https://api.github.com/repos/phpbb/phpbb/issues/2387"},"comments":{"href":"https://api.github.com/repos/phpbb/phpbb/issues/2387/comments"},"review_comments":{"href":"https://api.github.com/repos/phpbb/phpbb/pulls/2387/comments"},"review_comment":{"href":"https://api.github.com/repos/phpbb/phpbb/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/phpbb/phpbb/pulls/2387/commits"},"statuses":{"href":"https://api.github.com/repos/phpbb/phpbb/statuses/d96c4ee79f09d7d46c7dd3fc73bd0c0e8e2183c2"}}}}