{"action":"created","comment":{"url":"https://api.github.com/repos/owncloud/core/pulls/comments/66253280","id":66253280,"diff_hunk":"@@ -0,0 +1,115 @@\n+<?php\n+/**\n+ * @author Roeland Jago Douma <rullzer@owncloud.com>\n+ *\n+ * @copyright Copyright (c) 2016, ownCloud, Inc.\n+ * @license AGPL-3.0\n+ *\n+ * This code is free software: you can redistribute it and/or modify\n+ * it under the terms of the GNU Affero General Public License, version 3,\n+ * as published by the Free Software Foundation.\n+ *\n+ * This program is distributed in the hope that it will be useful,\n+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\n+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n+ * GNU Affero General Public License for more details.\n+ *\n+ * You should have received a copy of the GNU Affero General Public License, version 3,\n+ * along with this program.  If not, see <http://www.gnu.org/licenses/>\n+ *\n+ */\n+namespace OC\\Repair;\n+\n+use Doctrine\\DBAL\\Platforms\\OraclePlatform;\n+use OCP\\IDBConnection;\n+use OCP\\Migration\\IOutput;\n+use OCP\\Migration\\IRepairStep;\n+\n+/**\n+ * Class AvatarPermissions\n+ *\n+ * @package OC\\Repair\n+ */\n+class AvatarPermissions implements IRepairStep {\n+\t/** @var IDBConnection */\n+\tprivate $connection;\n+\n+\t/**\n+\t * AvatarPermissions constructor.\n+\t *\n+\t * @param IDBConnection $connection\n+\t */\n+\tpublic function __construct(IDBConnection $connection) {\n+\t\t$this->connection = $connection;\n+\t}\n+\n+\t/**\n+\t * @return string\n+\t */\n+\tpublic function getName() {\n+\t\treturn 'Fix permissions so avatars can be stored again';\n+\t}\n+\n+\t/**\n+\t * @param IOutput $output\n+\t */\n+\tpublic function run(IOutput $output) {\n+\t\t$output->startProgress(2);\n+\t\t$this->fixUserRootPermissions();\n+\t\t$output->advance();\n+\t\t$this->fixAvatarPermissions();\n+\t\t$output->finishProgress();\n+\t}\n+\n+\t/**\n+\t * Make sure all user roots have permissions 23 (all but share)\n+\t */\n+\tprotected function fixUserRootPermissions() {\n+\t\t$qb = $this->connection->getQueryBuilder();\n+\t\t$qb2 = $this->connection->getQueryBuilder();\n+\n+\t\t$qb->select('numeric_id')\n+\t\t\t->from('storages')\n+\t\t\t->where($qb->expr()->like('id', $qb2->createParameter('like')));\n+\n+\t\tif ($this->connection->getDatabasePlatform() instanceof OraclePlatform) {\n+\t\t\t// '' is null on oracle\n+\t\t\t$path = $qb2->expr()->isNull('path');\n+\t\t} else {\n+\t\t\t$path = $qb2->expr()->eq('path', $qb2->createNamedParameter(''));\n+\t\t}\n+\n+\t\t$qb2->update('filecache')\n+\t\t\t->set('permissions', $qb2->createNamedParameter(23))\n+\t\t\t->where($path)\n+\t\t\t->andWhere($qb2->expr()->in('storage', $qb2->createFunction($qb->getSQL())))\n+\t\t\t->andWhere($qb2->expr()->neq('permissions', $qb2->createNamedParameter(23)))\n+\t\t\t->setParameter('like', 'home::%');","path":"lib/private/Repair/AvatarPermissions.php","position":87,"original_position":87,"commit_id":"01cb5d732b95875b0d4350a11069ac77311640ac","original_commit_id":"01cb5d732b95875b0d4350a11069ac77311640ac","user":{"login":"rullzer","id":45821,"avatar_url":"https://avatars.githubusercontent.com/u/45821?v=3","gravatar_id":"","url":"https://api.github.com/users/rullzer","html_url":"https://github.com/rullzer","followers_url":"https://api.github.com/users/rullzer/followers","following_url":"https://api.github.com/users/rullzer/following{/other_user}","gists_url":"https://api.github.com/users/rullzer/gists{/gist_id}","starred_url":"https://api.github.com/users/rullzer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rullzer/subscriptions","organizations_url":"https://api.github.com/users/rullzer/orgs","repos_url":"https://api.github.com/users/rullzer/repos","events_url":"https://api.github.com/users/rullzer/events{/privacy}","received_events_url":"https://api.github.com/users/rullzer/received_events","type":"User","site_admin":false},"body":"uhm pfff... fair enough... but lets try to fix that separatly then... As this will not break those...","created_at":"2016-06-08T13:20:01Z","updated_at":"2016-06-08T13:20:01Z","html_url":"https://github.com/owncloud/core/pull/24898#discussion_r66253280","pull_request_url":"https://api.github.com/repos/owncloud/core/pulls/24898","_links":{"self":{"href":"https://api.github.com/repos/owncloud/core/pulls/comments/66253280"},"html":{"href":"https://github.com/owncloud/core/pull/24898#discussion_r66253280"},"pull_request":{"href":"https://api.github.com/repos/owncloud/core/pulls/24898"}}},"pull_request":{"url":"https://api.github.com/repos/owncloud/core/pulls/24898","id":71898828,"html_url":"https://github.com/owncloud/core/pull/24898","diff_url":"https://github.com/owncloud/core/pull/24898.diff","patch_url":"https://github.com/owncloud/core/pull/24898.patch","issue_url":"https://api.github.com/repos/owncloud/core/issues/24898","number":24898,"state":"open","locked":false,"title":"Repair job to fix permissions for avatars","user":{"login":"rullzer","id":45821,"avatar_url":"https://avatars.githubusercontent.com/u/45821?v=3","gravatar_id":"","url":"https://api.github.com/users/rullzer","html_url":"https://github.com/rullzer","followers_url":"https://api.github.com/users/rullzer/followers","following_url":"https://api.github.com/users/rullzer/following{/other_user}","gists_url":"https://api.github.com/users/rullzer/gists{/gist_id}","starred_url":"https://api.github.com/users/rullzer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rullzer/subscriptions","organizations_url":"https://api.github.com/users/rullzer/orgs","repos_url":"https://api.github.com/users/rullzer/repos","events_url":"https://api.github.com/users/rullzer/events{/privacy}","received_events_url":"https://api.github.com/users/rullzer/received_events","type":"User","site_admin":false},"body":"Fixes #22978\r\n\r\nOn some older installations the permissions for the userRoot and the\r\navatars are not correct. This breaks since we now use the Node API in\r\nthe avatar code.\r\n\r\nThis repair job makes sure that the permissions are set correctly.\r\n\r\n* Unit tests added\r\n\r\nCC: @PVince81 @nickvergessen @icewind1991 @blizzz \r\n\r\n@karlitschek should be backported to 9.0 since that is where the issue originally happend.","created_at":"2016-05-30T13:03:17Z","updated_at":"2016-06-08T13:20:01Z","closed_at":null,"merged_at":null,"merge_commit_sha":"fbfc0aeb49f2f1794896bb290c4659ea45fdcb7d","assignee":null,"milestone":{"url":"https://api.github.com/repos/owncloud/core/milestones/62","html_url":"https://github.com/owncloud/core/milestones/9.1-current","labels_url":"https://api.github.com/repos/owncloud/core/milestones/62/labels","id":1322460,"number":62,"title":"9.1-current","description":"","creator":{"login":"MorrisJobke","id":245432,"avatar_url":"https://avatars.githubusercontent.com/u/245432?v=3","gravatar_id":"","url":"https://api.github.com/users/MorrisJobke","html_url":"https://github.com/MorrisJobke","followers_url":"https://api.github.com/users/MorrisJobke/followers","following_url":"https://api.github.com/users/MorrisJobke/following{/other_user}","gists_url":"https://api.github.com/users/MorrisJobke/gists{/gist_id}","starred_url":"https://api.github.com/users/MorrisJobke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MorrisJobke/subscriptions","organizations_url":"https://api.github.com/users/MorrisJobke/orgs","repos_url":"https://api.github.com/users/MorrisJobke/repos","events_url":"https://api.github.com/users/MorrisJobke/events{/privacy}","received_events_url":"https://api.github.com/users/MorrisJobke/received_events","type":"User","site_admin":false},"open_issues":642,"closed_issues":1006,"state":"open","created_at":"2015-09-24T16:30:14Z","updated_at":"2016-06-08T13:08:32Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/owncloud/core/pulls/24898/commits","review_comments_url":"https://api.github.com/repos/owncloud/core/pulls/24898/comments","review_comment_url":"https://api.github.com/repos/owncloud/core/pulls/comments{/number}","comments_url":"https://api.github.com/repos/owncloud/core/issues/24898/comments","statuses_url":"https://api.github.com/repos/owncloud/core/statuses/01cb5d732b95875b0d4350a11069ac77311640ac","head":{"label":"owncloud:avatar_repair","ref":"avatar_repair","sha":"01cb5d732b95875b0d4350a11069ac77311640ac","user":{"login":"owncloud","id":1645051,"avatar_url":"https://avatars.githubusercontent.com/u/1645051?v=3","gravatar_id":"","url":"https://api.github.com/users/owncloud","html_url":"https://github.com/owncloud","followers_url":"https://api.github.com/users/owncloud/followers","following_url":"https://api.github.com/users/owncloud/following{/other_user}","gists_url":"https://api.github.com/users/owncloud/gists{/gist_id}","starred_url":"https://api.github.com/users/owncloud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/owncloud/subscriptions","organizations_url":"https://api.github.com/users/owncloud/orgs","repos_url":"https://api.github.com/users/owncloud/repos","events_url":"https://api.github.com/users/owncloud/events{/privacy}","received_events_url":"https://api.github.com/users/owncloud/received_events","type":"Organization","site_admin":false},"repo":{"id":5550552,"name":"core","full_name":"owncloud/core","owner":{"login":"owncloud","id":1645051,"avatar_url":"https://avatars.githubusercontent.com/u/1645051?v=3","gravatar_id":"","url":"https://api.github.com/users/owncloud","html_url":"https://github.com/owncloud","followers_url":"https://api.github.com/users/owncloud/followers","following_url":"https://api.github.com/users/owncloud/following{/other_user}","gists_url":"https://api.github.com/users/owncloud/gists{/gist_id}","starred_url":"https://api.github.com/users/owncloud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/owncloud/subscriptions","organizations_url":"https://api.github.com/users/owncloud/orgs","repos_url":"https://api.github.com/users/owncloud/repos","events_url":"https://api.github.com/users/owncloud/events{/privacy}","received_events_url":"https://api.github.com/users/owncloud/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/owncloud/core","description":":cloud: ownCloud web server core (Files, DAV, etc.)","fork":false,"url":"https://api.github.com/repos/owncloud/core","forks_url":"https://api.github.com/repos/owncloud/core/forks","keys_url":"https://api.github.com/repos/owncloud/core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/owncloud/core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/owncloud/core/teams","hooks_url":"https://api.github.com/repos/owncloud/core/hooks","issue_events_url":"https://api.github.com/repos/owncloud/core/issues/events{/number}","events_url":"https://api.github.com/repos/owncloud/core/events","assignees_url":"https://api.github.com/repos/owncloud/core/assignees{/user}","branches_url":"https://api.github.com/repos/owncloud/core/branches{/branch}","tags_url":"https://api.github.com/repos/owncloud/core/tags","blobs_url":"https://api.github.com/repos/owncloud/core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/owncloud/core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/owncloud/core/git/refs{/sha}","trees_url":"https://api.github.com/repos/owncloud/core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/owncloud/core/statuses/{sha}","languages_url":"https://api.github.com/repos/owncloud/core/languages","stargazers_url":"https://api.github.com/repos/owncloud/core/stargazers","contributors_url":"https://api.github.com/repos/owncloud/core/contributors","subscribers_url":"https://api.github.com/repos/owncloud/core/subscribers","subscription_url":"https://api.github.com/repos/owncloud/core/subscription","commits_url":"https://api.github.com/repos/owncloud/core/commits{/sha}","git_commits_url":"https://api.github.com/repos/owncloud/core/git/commits{/sha}","comments_url":"https://api.github.com/repos/owncloud/core/comments{/number}","issue_comment_url":"https://api.github.com/repos/owncloud/core/issues/comments{/number}","contents_url":"https://api.github.com/repos/owncloud/core/contents/{+path}","compare_url":"https://api.github.com/repos/owncloud/core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/owncloud/core/merges","archive_url":"https://api.github.com/repos/owncloud/core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/owncloud/core/downloads","issues_url":"https://api.github.com/repos/owncloud/core/issues{/number}","pulls_url":"https://api.github.com/repos/owncloud/core/pulls{/number}","milestones_url":"https://api.github.com/repos/owncloud/core/milestones{/number}","notifications_url":"https://api.github.com/repos/owncloud/core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/owncloud/core/labels{/name}","releases_url":"https://api.github.com/repos/owncloud/core/releases{/id}","deployments_url":"https://api.github.com/repos/owncloud/core/deployments","created_at":"2012-08-25T10:32:48Z","updated_at":"2016-06-07T20:17:45Z","pushed_at":"2016-06-08T13:19:03Z","git_url":"git://github.com/owncloud/core.git","ssh_url":"git@github.com:owncloud/core.git","clone_url":"https://github.com/owncloud/core.git","svn_url":"https://github.com/owncloud/core","homepage":"https://owncloud.org/","size":316758,"stargazers_count":4624,"watchers_count":4624,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1511,"mirror_url":null,"open_issues_count":1876,"forks":1511,"open_issues":1876,"watchers":4624,"default_branch":"master"}},"base":{"label":"owncloud:master","ref":"master","sha":"bbd61cd98a0fff5fbf497e75515e4c5a4f12bd7d","user":{"login":"owncloud","id":1645051,"avatar_url":"https://avatars.githubusercontent.com/u/1645051?v=3","gravatar_id":"","url":"https://api.github.com/users/owncloud","html_url":"https://github.com/owncloud","followers_url":"https://api.github.com/users/owncloud/followers","following_url":"https://api.github.com/users/owncloud/following{/other_user}","gists_url":"https://api.github.com/users/owncloud/gists{/gist_id}","starred_url":"https://api.github.com/users/owncloud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/owncloud/subscriptions","organizations_url":"https://api.github.com/users/owncloud/orgs","repos_url":"https://api.github.com/users/owncloud/repos","events_url":"https://api.github.com/users/owncloud/events{/privacy}","received_events_url":"https://api.github.com/users/owncloud/received_events","type":"Organization","site_admin":false},"repo":{"id":5550552,"name":"core","full_name":"owncloud/core","owner":{"login":"owncloud","id":1645051,"avatar_url":"https://avatars.githubusercontent.com/u/1645051?v=3","gravatar_id":"","url":"https://api.github.com/users/owncloud","html_url":"https://github.com/owncloud","followers_url":"https://api.github.com/users/owncloud/followers","following_url":"https://api.github.com/users/owncloud/following{/other_user}","gists_url":"https://api.github.com/users/owncloud/gists{/gist_id}","starred_url":"https://api.github.com/users/owncloud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/owncloud/subscriptions","organizations_url":"https://api.github.com/users/owncloud/orgs","repos_url":"https://api.github.com/users/owncloud/repos","events_url":"https://api.github.com/users/owncloud/events{/privacy}","received_events_url":"https://api.github.com/users/owncloud/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/owncloud/core","description":":cloud: ownCloud web server core (Files, DAV, etc.)","fork":false,"url":"https://api.github.com/repos/owncloud/core","forks_url":"https://api.github.com/repos/owncloud/core/forks","keys_url":"https://api.github.com/repos/owncloud/core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/owncloud/core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/owncloud/core/teams","hooks_url":"https://api.github.com/repos/owncloud/core/hooks","issue_events_url":"https://api.github.com/repos/owncloud/core/issues/events{/number}","events_url":"https://api.github.com/repos/owncloud/core/events","assignees_url":"https://api.github.com/repos/owncloud/core/assignees{/user}","branches_url":"https://api.github.com/repos/owncloud/core/branches{/branch}","tags_url":"https://api.github.com/repos/owncloud/core/tags","blobs_url":"https://api.github.com/repos/owncloud/core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/owncloud/core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/owncloud/core/git/refs{/sha}","trees_url":"https://api.github.com/repos/owncloud/core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/owncloud/core/statuses/{sha}","languages_url":"https://api.github.com/repos/owncloud/core/languages","stargazers_url":"https://api.github.com/repos/owncloud/core/stargazers","contributors_url":"https://api.github.com/repos/owncloud/core/contributors","subscribers_url":"https://api.github.com/repos/owncloud/core/subscribers","subscription_url":"https://api.github.com/repos/owncloud/core/subscription","commits_url":"https://api.github.com/repos/owncloud/core/commits{/sha}","git_commits_url":"https://api.github.com/repos/owncloud/core/git/commits{/sha}","comments_url":"https://api.github.com/repos/owncloud/core/comments{/number}","issue_comment_url":"https://api.github.com/repos/owncloud/core/issues/comments{/number}","contents_url":"https://api.github.com/repos/owncloud/core/contents/{+path}","compare_url":"https://api.github.com/repos/owncloud/core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/owncloud/core/merges","archive_url":"https://api.github.com/repos/owncloud/core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/owncloud/core/downloads","issues_url":"https://api.github.com/repos/owncloud/core/issues{/number}","pulls_url":"https://api.github.com/repos/owncloud/core/pulls{/number}","milestones_url":"https://api.github.com/repos/owncloud/core/milestones{/number}","notifications_url":"https://api.github.com/repos/owncloud/core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/owncloud/core/labels{/name}","releases_url":"https://api.github.com/repos/owncloud/core/releases{/id}","deployments_url":"https://api.github.com/repos/owncloud/core/deployments","created_at":"2012-08-25T10:32:48Z","updated_at":"2016-06-07T20:17:45Z","pushed_at":"2016-06-08T13:19:03Z","git_url":"git://github.com/owncloud/core.git","ssh_url":"git@github.com:owncloud/core.git","clone_url":"https://github.com/owncloud/core.git","svn_url":"https://github.com/owncloud/core","homepage":"https://owncloud.org/","size":316758,"stargazers_count":4624,"watchers_count":4624,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1511,"mirror_url":null,"open_issues_count":1876,"forks":1511,"open_issues":1876,"watchers":4624,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/owncloud/core/pulls/24898"},"html":{"href":"https://github.com/owncloud/core/pull/24898"},"issue":{"href":"https://api.github.com/repos/owncloud/core/issues/24898"},"comments":{"href":"https://api.github.com/repos/owncloud/core/issues/24898/comments"},"review_comments":{"href":"https://api.github.com/repos/owncloud/core/pulls/24898/comments"},"review_comment":{"href":"https://api.github.com/repos/owncloud/core/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/owncloud/core/pulls/24898/commits"},"statuses":{"href":"https://api.github.com/repos/owncloud/core/statuses/01cb5d732b95875b0d4350a11069ac77311640ac"}}}}
{"actor":{"display_login":"rullzer"}}