{"action":"created","comment":{"url":"https://api.github.com/repos/owncloud/core/pulls/comments/22410180","id":22410180,"diff_hunk":"@@ -0,0 +1,117 @@\n+<?php\n+/**\n+ * @author Georg Ehrke\n+ * @copyright 2014 Georg Ehrke <georg@ownCloud.com>\n+ *\n+ * This file is licensed under the Affero General Public License version 3 or\n+ * later.\n+ * See the COPYING-README file.\n+ */\n+\n+namespace OC\\Settings\\Controller;\n+\n+use OCP\\AppFramework\\Controller;\n+use OCP\\AppFramework\\Http\\JSONResponse;\n+use OCP\\IRequest;\n+use OCP\\IConfig;\n+\n+/**\n+ * Class LogSettingsController\n+ *\n+ * @package OC\\Settings\\Controller\n+ */\n+class LogSettingsController extends Controller {\n+\t/** @var \\OCP\\IConfig */\n+\tprivate $config;\n+\n+\t/**\n+\t * @param string $appName\n+\t * @param IRequest $request\n+\t * @param IConfig $config\n+\t */\n+\tpublic function __construct($appName,\n+\t\t\t\t\t\t\t\tIRequest $request,\n+\t\t\t\t\t\t\t\tIConfig $config) {\n+\t\tparent::__construct($appName, $request);\n+\t\t$this->config = $config;\n+\t}\n+\n+\t/**\n+\t * set log level for logger\n+\t *\n+\t * @param int $level\n+\t * @return JSONResponse\n+\t */\n+\tpublic function setLogLevel($level) {\n+\t\tif ($level < 0 || $level > 4) {\n+\t\t\treturn new JSONResponse([\n+\t\t\t\t'message' => 'log-level out of allowed range',\n+\t\t\t\t'status' => 'error',\n+\t\t\t]);\n+\t\t}\n+\n+\t\t$this->config->setSystemValue('loglevel', (int) $level);\n+\t\treturn new JSONResponse([\n+\t\t\t'level' => (int) $level,\n+\t\t\t'status' => 'success',\n+\t\t]);\n+\t}\n+\n+\t/**\n+\t * get log entries from logfile\n+\t *\n+\t * @param int $count\n+\t * @param int $offset\n+\t * @return JSONResponse\n+\t */\n+\tpublic function getEntries($count=50, $offset=0) {\n+\t\treturn new JSONResponse([\n+\t\t\t'data' => \\OC_Log_Owncloud::getEntries($count, $offset),\n+\t\t\t'remain' => count(\\OC_Log_Owncloud::getEntries(1, $offset + $count)) !== 0,\n+\t\t\t'status' => 'success',\n+\t\t]);\n+\t}\n+\n+\t/**\n+\t * download the logfile\n+\t *\n+\t * @NoCSRFRequired\n+\t */\n+\tpublic function downloadLogFile() {\n+\t\t$this->sendHeadersForLogFileDownload();\n+\n+\t\t//AppFramework Responses don't support handles,\n+\t\t//so we have to use readfile instead of a proper response\n+\t\t$logFilePath = \\OC_Log_Owncloud::getLogFilePath();\n+\t\treadfile($logFilePath);","path":"settings/controller/logsettingscontroller.php","position":86,"original_position":86,"commit_id":"67cb0865b6a25fae98a90ae6b1f301490ed76fa3","original_commit_id":"783c96877a2a95c86d8b86f22945e66c2c25939e","user":{"login":"georgehrke","id":1250540,"avatar_url":"https://avatars.githubusercontent.com/u/1250540?v=3","gravatar_id":"","url":"https://api.github.com/users/georgehrke","html_url":"https://github.com/georgehrke","followers_url":"https://api.github.com/users/georgehrke/followers","following_url":"https://api.github.com/users/georgehrke/following{/other_user}","gists_url":"https://api.github.com/users/georgehrke/gists{/gist_id}","starred_url":"https://api.github.com/users/georgehrke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/georgehrke/subscriptions","organizations_url":"https://api.github.com/users/georgehrke/orgs","repos_url":"https://api.github.com/users/georgehrke/repos","events_url":"https://api.github.com/users/georgehrke/events{/privacy}","received_events_url":"https://api.github.com/users/georgehrke/received_events","type":"User","site_admin":false},"body":"see my comment: https://github.com/owncloud/core/pull/12988#issuecomment-68414398","created_at":"2015-01-02T13:28:32Z","updated_at":"2015-01-02T13:28:32Z","html_url":"https://github.com/owncloud/core/pull/12988#discussion_r22410180","pull_request_url":"https://api.github.com/repos/owncloud/core/pulls/12988","_links":{"self":{"href":"https://api.github.com/repos/owncloud/core/pulls/comments/22410180"},"html":{"href":"https://github.com/owncloud/core/pull/12988#discussion_r22410180"},"pull_request":{"href":"https://api.github.com/repos/owncloud/core/pulls/12988"}}},"pull_request":{"url":"https://api.github.com/repos/owncloud/core/pulls/12988","id":26425981,"html_url":"https://github.com/owncloud/core/pull/12988","diff_url":"https://github.com/owncloud/core/pull/12988.diff","patch_url":"https://github.com/owncloud/core/pull/12988.patch","issue_url":"https://api.github.com/repos/owncloud/core/issues/12988","number":12988,"state":"open","locked":false,"title":"Logfile download","user":{"login":"georgehrke","id":1250540,"avatar_url":"https://avatars.githubusercontent.com/u/1250540?v=3","gravatar_id":"","url":"https://api.github.com/users/georgehrke","html_url":"https://github.com/georgehrke","followers_url":"https://api.github.com/users/georgehrke/followers","following_url":"https://api.github.com/users/georgehrke/following{/other_user}","gists_url":"https://api.github.com/users/georgehrke/gists{/gist_id}","starred_url":"https://api.github.com/users/georgehrke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/georgehrke/subscriptions","organizations_url":"https://api.github.com/users/georgehrke/orgs","repos_url":"https://api.github.com/users/georgehrke/repos","events_url":"https://api.github.com/users/georgehrke/events{/privacy}","received_events_url":"https://api.github.com/users/georgehrke/received_events","type":"User","site_admin":false},"body":"implements / fixes https://github.com/owncloud/core/issues/12731\r\n\r\nTODO:\r\n- [x] add unit test\r\n- [x] add warning if log file is bigger than 100MB","created_at":"2014-12-21T09:22:55Z","updated_at":"2015-01-02T13:28:32Z","closed_at":null,"merged_at":null,"merge_commit_sha":"68d57202b8992b04463d9cfe40cb6e0a552e4386","assignee":null,"milestone":{"url":"https://api.github.com/repos/owncloud/core/milestones/29","labels_url":"https://api.github.com/repos/owncloud/core/milestones/29/labels","id":841322,"number":29,"title":"8.0-current","description":null,"creator":{"login":"craigpg","id":160667,"avatar_url":"https://avatars.githubusercontent.com/u/160667?v=3","gravatar_id":"","url":"https://api.github.com/users/craigpg","html_url":"https://github.com/craigpg","followers_url":"https://api.github.com/users/craigpg/followers","following_url":"https://api.github.com/users/craigpg/following{/other_user}","gists_url":"https://api.github.com/users/craigpg/gists{/gist_id}","starred_url":"https://api.github.com/users/craigpg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/craigpg/subscriptions","organizations_url":"https://api.github.com/users/craigpg/orgs","repos_url":"https://api.github.com/users/craigpg/repos","events_url":"https://api.github.com/users/craigpg/events{/privacy}","received_events_url":"https://api.github.com/users/craigpg/received_events","type":"User","site_admin":false},"open_issues":106,"closed_issues":307,"state":"open","created_at":"2014-10-27T01:20:05Z","updated_at":"2015-01-02T08:23:10Z","due_on":"2015-01-02T22:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/owncloud/core/pulls/12988/commits","review_comments_url":"https://api.github.com/repos/owncloud/core/pulls/12988/comments","review_comment_url":"https://api.github.com/repos/owncloud/core/pulls/comments/{number}","comments_url":"https://api.github.com/repos/owncloud/core/issues/12988/comments","statuses_url":"https://api.github.com/repos/owncloud/core/statuses/67cb0865b6a25fae98a90ae6b1f301490ed76fa3","head":{"label":"owncloud:logfile_download","ref":"logfile_download","sha":"67cb0865b6a25fae98a90ae6b1f301490ed76fa3","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":"The ownCloud core","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}","created_at":"2012-08-25T10:32:48Z","updated_at":"2015-01-02T06:54:31Z","pushed_at":"2015-01-02T13:22:53Z","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":null,"size":813906,"stargazers_count":2873,"watchers_count":2873,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":940,"mirror_url":null,"open_issues_count":1522,"forks":940,"open_issues":1522,"watchers":2873,"default_branch":"master"}},"base":{"label":"owncloud:master","ref":"master","sha":"c16cb74ba2c8cbd51db3f4e12aa1d69416932475","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":"The ownCloud core","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}","created_at":"2012-08-25T10:32:48Z","updated_at":"2015-01-02T06:54:31Z","pushed_at":"2015-01-02T13:22:53Z","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":null,"size":813906,"stargazers_count":2873,"watchers_count":2873,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":940,"mirror_url":null,"open_issues_count":1522,"forks":940,"open_issues":1522,"watchers":2873,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/owncloud/core/pulls/12988"},"html":{"href":"https://github.com/owncloud/core/pull/12988"},"issue":{"href":"https://api.github.com/repos/owncloud/core/issues/12988"},"comments":{"href":"https://api.github.com/repos/owncloud/core/issues/12988/comments"},"review_comments":{"href":"https://api.github.com/repos/owncloud/core/pulls/12988/comments"},"review_comment":{"href":"https://api.github.com/repos/owncloud/core/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/owncloud/core/pulls/12988/commits"},"statuses":{"href":"https://api.github.com/repos/owncloud/core/statuses/67cb0865b6a25fae98a90ae6b1f301490ed76fa3"}}}}