{"action":"created","comment":{"url":"https://api.github.com/repos/piwik/piwik/pulls/comments/43589639","id":43589639,"diff_hunk":"@@ -0,0 +1,167 @@\n+<?php\n+/**\n+ * Piwik - free/libre analytics platform\n+ *\n+ * @link http://piwik.org\n+ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later\n+ */\n+\n+namespace Piwik\\Plugins\\CoreAdminHome\\Commands\\SetConfig;\n+\n+use Piwik\\Config;\n+\n+/**\n+ * Representation of a INI config manipulation operation. Only supports two types\n+ * of manipulations: appending to a config array and assigning a config value.\n+ */\n+class ConfigSettingManipulation\n+{\n+    /**\n+     * @var string\n+     */\n+    private $sectionName;\n+\n+    /**\n+     * @var string\n+     */\n+    private $name;\n+\n+    /**\n+     * @var string\n+     */\n+    private $value;\n+\n+    /**\n+     * @var bool\n+     */\n+    private $isArrayAppend;\n+\n+    /**\n+     * @param string $sectionName\n+     * @param string $name\n+     * @param string $value\n+     * @param bool $isArrayAppend\n+     */\n+    public function __construct($sectionName, $name, $value, $isArrayAppend = false)\n+    {\n+        $this->sectionName = $sectionName;\n+        $this->name = $name;\n+        $this->value = $value;\n+        $this->isArrayAppend = $isArrayAppend;\n+    }\n+\n+    /**\n+     * Performs the INI config manipulation.\n+     *\n+     * @param Config $config\n+     * @throws \\Exception if trying to append to a non-array setting value or if trying to set an\n+     *                    array value to a non-array setting\n+     */\n+    public function manipulate(Config $config)\n+    {\n+        $setting =& $this->getSettingToManipulate($config);","path":"plugins/CoreAdminHome/Commands/SetConfig/ConfigSettingManipulation.php","position":62,"original_position":62,"commit_id":"ae017b43eae3274e8e86153022cced25b56932b0","original_commit_id":"ae017b43eae3274e8e86153022cced25b56932b0","user":{"login":"tsteur","id":273120,"avatar_url":"https://avatars.githubusercontent.com/u/273120?v=3","gravatar_id":"","url":"https://api.github.com/users/tsteur","html_url":"https://github.com/tsteur","followers_url":"https://api.github.com/users/tsteur/followers","following_url":"https://api.github.com/users/tsteur/following{/other_user}","gists_url":"https://api.github.com/users/tsteur/gists{/gist_id}","starred_url":"https://api.github.com/users/tsteur/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tsteur/subscriptions","organizations_url":"https://api.github.com/users/tsteur/orgs","repos_url":"https://api.github.com/users/tsteur/repos","events_url":"https://api.github.com/users/tsteur/events{/privacy}","received_events_url":"https://api.github.com/users/tsteur/received_events","type":"User","site_admin":false},"body":"References are the problem, not OOP :) Eg this is also why you want immutable objects etc see eg http://blog.joefallon.net/2015/08/immutable-objects-in-php/","created_at":"2015-11-01T23:11:29Z","updated_at":"2015-11-01T23:11:29Z","html_url":"https://github.com/piwik/piwik/pull/9124#discussion_r43589639","pull_request_url":"https://api.github.com/repos/piwik/piwik/pulls/9124","_links":{"self":{"href":"https://api.github.com/repos/piwik/piwik/pulls/comments/43589639"},"html":{"href":"https://github.com/piwik/piwik/pull/9124#discussion_r43589639"},"pull_request":{"href":"https://api.github.com/repos/piwik/piwik/pulls/9124"}}},"pull_request":{"url":"https://api.github.com/repos/piwik/piwik/pulls/9124","id":49185898,"html_url":"https://github.com/piwik/piwik/pull/9124","diff_url":"https://github.com/piwik/piwik/pull/9124.diff","patch_url":"https://github.com/piwik/piwik/pull/9124.patch","issue_url":"https://api.github.com/repos/piwik/piwik/issues/9124","number":9124,"state":"open","locked":false,"title":"Adding new command core:set-config command to set INI config","user":{"login":"diosmosis","id":125140,"avatar_url":"https://avatars.githubusercontent.com/u/125140?v=3","gravatar_id":"","url":"https://api.github.com/users/diosmosis","html_url":"https://github.com/diosmosis","followers_url":"https://api.github.com/users/diosmosis/followers","following_url":"https://api.github.com/users/diosmosis/following{/other_user}","gists_url":"https://api.github.com/users/diosmosis/gists{/gist_id}","starred_url":"https://api.github.com/users/diosmosis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/diosmosis/subscriptions","organizations_url":"https://api.github.com/users/diosmosis/orgs","repos_url":"https://api.github.com/users/diosmosis/repos","events_url":"https://api.github.com/users/diosmosis/events{/privacy}","received_events_url":"https://api.github.com/users/diosmosis/received_events","type":"User","site_admin":false},"body":"This PR includes a new command `core:set-config` which will set INI config. The command is meant to provide convenience and opportunities for automation.\r\n\r\nThere are two ways to set an INI config:\r\n\r\n1. You can use the `--section`, `--key`, `--value` options to set a single simple value. You cannot set non-string values or append to arrays w/ this option, but it may be simpler to use when using the command in scripts.\r\n\r\n2. You can use arguments formatted like `Section.name=\"value\"` or `Section.name[]=\"value\"` to set values and append values, respectively. Values must be JSON encoded, so arrays can be assigned.\r\n\r\nCC @mattab ","created_at":"2015-10-29T19:10:45Z","updated_at":"2015-11-01T23:11:29Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1223467687c5093ef76810b1afefbbf0d6bba62b","assignee":null,"milestone":{"url":"https://api.github.com/repos/piwik/piwik/milestones/89","html_url":"https://github.com/piwik/piwik/milestones/2.15.1","labels_url":"https://api.github.com/repos/piwik/piwik/milestones/89/labels","id":1257878,"number":89,"title":"2.15.1","description":"","creator":{"login":"mattab","id":466765,"avatar_url":"https://avatars.githubusercontent.com/u/466765?v=3","gravatar_id":"","url":"https://api.github.com/users/mattab","html_url":"https://github.com/mattab","followers_url":"https://api.github.com/users/mattab/followers","following_url":"https://api.github.com/users/mattab/following{/other_user}","gists_url":"https://api.github.com/users/mattab/gists{/gist_id}","starred_url":"https://api.github.com/users/mattab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mattab/subscriptions","organizations_url":"https://api.github.com/users/mattab/orgs","repos_url":"https://api.github.com/users/mattab/repos","events_url":"https://api.github.com/users/mattab/events{/privacy}","received_events_url":"https://api.github.com/users/mattab/received_events","type":"User","site_admin":false},"open_issues":44,"closed_issues":15,"state":"open","created_at":"2015-08-17T09:20:14Z","updated_at":"2015-11-01T21:57:14Z","due_on":"2015-11-24T11:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/piwik/piwik/pulls/9124/commits","review_comments_url":"https://api.github.com/repos/piwik/piwik/pulls/9124/comments","review_comment_url":"https://api.github.com/repos/piwik/piwik/pulls/comments{/number}","comments_url":"https://api.github.com/repos/piwik/piwik/issues/9124/comments","statuses_url":"https://api.github.com/repos/piwik/piwik/statuses/ae017b43eae3274e8e86153022cced25b56932b0","head":{"label":"piwik:config_set_command","ref":"config_set_command","sha":"ae017b43eae3274e8e86153022cced25b56932b0","user":{"login":"piwik","id":698038,"avatar_url":"https://avatars.githubusercontent.com/u/698038?v=3","gravatar_id":"","url":"https://api.github.com/users/piwik","html_url":"https://github.com/piwik","followers_url":"https://api.github.com/users/piwik/followers","following_url":"https://api.github.com/users/piwik/following{/other_user}","gists_url":"https://api.github.com/users/piwik/gists{/gist_id}","starred_url":"https://api.github.com/users/piwik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/piwik/subscriptions","organizations_url":"https://api.github.com/users/piwik/orgs","repos_url":"https://api.github.com/users/piwik/repos","events_url":"https://api.github.com/users/piwik/events{/privacy}","received_events_url":"https://api.github.com/users/piwik/received_events","type":"Organization","site_admin":false},"repo":{"id":1548202,"name":"piwik","full_name":"piwik/piwik","owner":{"login":"piwik","id":698038,"avatar_url":"https://avatars.githubusercontent.com/u/698038?v=3","gravatar_id":"","url":"https://api.github.com/users/piwik","html_url":"https://github.com/piwik","followers_url":"https://api.github.com/users/piwik/followers","following_url":"https://api.github.com/users/piwik/following{/other_user}","gists_url":"https://api.github.com/users/piwik/gists{/gist_id}","starred_url":"https://api.github.com/users/piwik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/piwik/subscriptions","organizations_url":"https://api.github.com/users/piwik/orgs","repos_url":"https://api.github.com/users/piwik/repos","events_url":"https://api.github.com/users/piwik/events{/privacy}","received_events_url":"https://api.github.com/users/piwik/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/piwik/piwik","description":"Liberating Web Analytics. Star us on Github? +1. Piwik is the leading open alternative to Google Analytics that gives you full control over your data. Piwik lets you easily collect data from websites, apps & the IoT and visualise this data and extract insights. Privacy is built-in. We love Pull Requests! ","fork":false,"url":"https://api.github.com/repos/piwik/piwik","forks_url":"https://api.github.com/repos/piwik/piwik/forks","keys_url":"https://api.github.com/repos/piwik/piwik/keys{/key_id}","collaborators_url":"https://api.github.com/repos/piwik/piwik/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/piwik/piwik/teams","hooks_url":"https://api.github.com/repos/piwik/piwik/hooks","issue_events_url":"https://api.github.com/repos/piwik/piwik/issues/events{/number}","events_url":"https://api.github.com/repos/piwik/piwik/events","assignees_url":"https://api.github.com/repos/piwik/piwik/assignees{/user}","branches_url":"https://api.github.com/repos/piwik/piwik/branches{/branch}","tags_url":"https://api.github.com/repos/piwik/piwik/tags","blobs_url":"https://api.github.com/repos/piwik/piwik/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/piwik/piwik/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/piwik/piwik/git/refs{/sha}","trees_url":"https://api.github.com/repos/piwik/piwik/git/trees{/sha}","statuses_url":"https://api.github.com/repos/piwik/piwik/statuses/{sha}","languages_url":"https://api.github.com/repos/piwik/piwik/languages","stargazers_url":"https://api.github.com/repos/piwik/piwik/stargazers","contributors_url":"https://api.github.com/repos/piwik/piwik/contributors","subscribers_url":"https://api.github.com/repos/piwik/piwik/subscribers","subscription_url":"https://api.github.com/repos/piwik/piwik/subscription","commits_url":"https://api.github.com/repos/piwik/piwik/commits{/sha}","git_commits_url":"https://api.github.com/repos/piwik/piwik/git/commits{/sha}","comments_url":"https://api.github.com/repos/piwik/piwik/comments{/number}","issue_comment_url":"https://api.github.com/repos/piwik/piwik/issues/comments{/number}","contents_url":"https://api.github.com/repos/piwik/piwik/contents/{+path}","compare_url":"https://api.github.com/repos/piwik/piwik/compare/{base}...{head}","merges_url":"https://api.github.com/repos/piwik/piwik/merges","archive_url":"https://api.github.com/repos/piwik/piwik/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/piwik/piwik/downloads","issues_url":"https://api.github.com/repos/piwik/piwik/issues{/number}","pulls_url":"https://api.github.com/repos/piwik/piwik/pulls{/number}","milestones_url":"https://api.github.com/repos/piwik/piwik/milestones{/number}","notifications_url":"https://api.github.com/repos/piwik/piwik/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/piwik/piwik/labels{/name}","releases_url":"https://api.github.com/repos/piwik/piwik/releases{/id}","created_at":"2011-03-30T21:18:17Z","updated_at":"2015-11-01T20:50:55Z","pushed_at":"2015-11-01T22:47:06Z","git_url":"git://github.com/piwik/piwik.git","ssh_url":"git@github.com:piwik/piwik.git","clone_url":"https://github.com/piwik/piwik.git","svn_url":"https://github.com/piwik/piwik","homepage":"http://piwik.org/","size":392291,"stargazers_count":4644,"watchers_count":4644,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":825,"mirror_url":null,"open_issues_count":1174,"forks":825,"open_issues":1174,"watchers":4644,"default_branch":"master"}},"base":{"label":"piwik:master","ref":"master","sha":"2de7fef4d2176dc435a7dd9c1932b7cf6fdcf77c","user":{"login":"piwik","id":698038,"avatar_url":"https://avatars.githubusercontent.com/u/698038?v=3","gravatar_id":"","url":"https://api.github.com/users/piwik","html_url":"https://github.com/piwik","followers_url":"https://api.github.com/users/piwik/followers","following_url":"https://api.github.com/users/piwik/following{/other_user}","gists_url":"https://api.github.com/users/piwik/gists{/gist_id}","starred_url":"https://api.github.com/users/piwik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/piwik/subscriptions","organizations_url":"https://api.github.com/users/piwik/orgs","repos_url":"https://api.github.com/users/piwik/repos","events_url":"https://api.github.com/users/piwik/events{/privacy}","received_events_url":"https://api.github.com/users/piwik/received_events","type":"Organization","site_admin":false},"repo":{"id":1548202,"name":"piwik","full_name":"piwik/piwik","owner":{"login":"piwik","id":698038,"avatar_url":"https://avatars.githubusercontent.com/u/698038?v=3","gravatar_id":"","url":"https://api.github.com/users/piwik","html_url":"https://github.com/piwik","followers_url":"https://api.github.com/users/piwik/followers","following_url":"https://api.github.com/users/piwik/following{/other_user}","gists_url":"https://api.github.com/users/piwik/gists{/gist_id}","starred_url":"https://api.github.com/users/piwik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/piwik/subscriptions","organizations_url":"https://api.github.com/users/piwik/orgs","repos_url":"https://api.github.com/users/piwik/repos","events_url":"https://api.github.com/users/piwik/events{/privacy}","received_events_url":"https://api.github.com/users/piwik/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/piwik/piwik","description":"Liberating Web Analytics. Star us on Github? +1. Piwik is the leading open alternative to Google Analytics that gives you full control over your data. Piwik lets you easily collect data from websites, apps & the IoT and visualise this data and extract insights. Privacy is built-in. We love Pull Requests! ","fork":false,"url":"https://api.github.com/repos/piwik/piwik","forks_url":"https://api.github.com/repos/piwik/piwik/forks","keys_url":"https://api.github.com/repos/piwik/piwik/keys{/key_id}","collaborators_url":"https://api.github.com/repos/piwik/piwik/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/piwik/piwik/teams","hooks_url":"https://api.github.com/repos/piwik/piwik/hooks","issue_events_url":"https://api.github.com/repos/piwik/piwik/issues/events{/number}","events_url":"https://api.github.com/repos/piwik/piwik/events","assignees_url":"https://api.github.com/repos/piwik/piwik/assignees{/user}","branches_url":"https://api.github.com/repos/piwik/piwik/branches{/branch}","tags_url":"https://api.github.com/repos/piwik/piwik/tags","blobs_url":"https://api.github.com/repos/piwik/piwik/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/piwik/piwik/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/piwik/piwik/git/refs{/sha}","trees_url":"https://api.github.com/repos/piwik/piwik/git/trees{/sha}","statuses_url":"https://api.github.com/repos/piwik/piwik/statuses/{sha}","languages_url":"https://api.github.com/repos/piwik/piwik/languages","stargazers_url":"https://api.github.com/repos/piwik/piwik/stargazers","contributors_url":"https://api.github.com/repos/piwik/piwik/contributors","subscribers_url":"https://api.github.com/repos/piwik/piwik/subscribers","subscription_url":"https://api.github.com/repos/piwik/piwik/subscription","commits_url":"https://api.github.com/repos/piwik/piwik/commits{/sha}","git_commits_url":"https://api.github.com/repos/piwik/piwik/git/commits{/sha}","comments_url":"https://api.github.com/repos/piwik/piwik/comments{/number}","issue_comment_url":"https://api.github.com/repos/piwik/piwik/issues/comments{/number}","contents_url":"https://api.github.com/repos/piwik/piwik/contents/{+path}","compare_url":"https://api.github.com/repos/piwik/piwik/compare/{base}...{head}","merges_url":"https://api.github.com/repos/piwik/piwik/merges","archive_url":"https://api.github.com/repos/piwik/piwik/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/piwik/piwik/downloads","issues_url":"https://api.github.com/repos/piwik/piwik/issues{/number}","pulls_url":"https://api.github.com/repos/piwik/piwik/pulls{/number}","milestones_url":"https://api.github.com/repos/piwik/piwik/milestones{/number}","notifications_url":"https://api.github.com/repos/piwik/piwik/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/piwik/piwik/labels{/name}","releases_url":"https://api.github.com/repos/piwik/piwik/releases{/id}","created_at":"2011-03-30T21:18:17Z","updated_at":"2015-11-01T20:50:55Z","pushed_at":"2015-11-01T22:47:06Z","git_url":"git://github.com/piwik/piwik.git","ssh_url":"git@github.com:piwik/piwik.git","clone_url":"https://github.com/piwik/piwik.git","svn_url":"https://github.com/piwik/piwik","homepage":"http://piwik.org/","size":392291,"stargazers_count":4644,"watchers_count":4644,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":825,"mirror_url":null,"open_issues_count":1174,"forks":825,"open_issues":1174,"watchers":4644,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/piwik/piwik/pulls/9124"},"html":{"href":"https://github.com/piwik/piwik/pull/9124"},"issue":{"href":"https://api.github.com/repos/piwik/piwik/issues/9124"},"comments":{"href":"https://api.github.com/repos/piwik/piwik/issues/9124/comments"},"review_comments":{"href":"https://api.github.com/repos/piwik/piwik/pulls/9124/comments"},"review_comment":{"href":"https://api.github.com/repos/piwik/piwik/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/piwik/piwik/pulls/9124/commits"},"statuses":{"href":"https://api.github.com/repos/piwik/piwik/statuses/ae017b43eae3274e8e86153022cced25b56932b0"}}}}