{"action":"closed","number":268,"pull_request":{"url":"https://api.github.com/repos/opencredit/badgeos/pulls/268","id":14732293,"html_url":"https://github.com/opencredit/badgeos/pull/268","diff_url":"https://github.com/opencredit/badgeos/pull/268.diff","patch_url":"https://github.com/opencredit/badgeos/pull/268.patch","issue_url":"https://api.github.com/repos/opencredit/badgeos/issues/268","number":268,"state":"closed","locked":false,"title":"Introduction of ORM and new logging subsystem","user":{"login":"karnold","id":1236813,"avatar_url":"https://avatars.githubusercontent.com/u/1236813?v=3","gravatar_id":"","url":"https://api.github.com/users/karnold","html_url":"https://github.com/karnold","followers_url":"https://api.github.com/users/karnold/followers","following_url":"https://api.github.com/users/karnold/following{/other_user}","gists_url":"https://api.github.com/users/karnold/gists{/gist_id}","starred_url":"https://api.github.com/users/karnold/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/karnold/subscriptions","organizations_url":"https://api.github.com/users/karnold/orgs","repos_url":"https://api.github.com/users/karnold/repos","events_url":"https://api.github.com/users/karnold/events{/privacy}","received_events_url":"https://api.github.com/users/karnold/received_events","type":"User","site_admin":false},"body":"This pull request incorporates the composer package manager and autoloading subsystem to introduce the Capsule ORM class as well as Monolog to replace the existing core logging.  \r\n\r\nAll new classes introduced exist in the BadgeOS namespace and are loaded via the PSR-4 spec.\r\n\r\nThis initial pull is meant primarily to be a proof of concept on how these tools can be implemented.  It would be my recommendation that it starts a 2.x branch of BadgeOS and not get included into the existing 1.x branch as these tools can improve other areas of badgeos as well.  \r\n\r\nCapsule:\r\nCapsule is an ORM and Schema management class for php.  Along with basic ORM functionality it also introduces basic model management.  Documentation is available at https://github.com/illuminate/database.\r\n\r\nI've created an update hook in badgeos.php to create the table, and this can be extendable to account for version changes.  \r\n\r\nThe initial implementation only deals with log entries as seen in includes/LogEntry.php and include/BadgeOSLogHandler.php.\r\n\r\nWhile this currently only handles logs this library would be extremely useful for rewriting any code that manually queries the database as the query object does not exist in a global namespace.  This will also further performance improvements as flat database tables can more easily be generated and managed.\r\n\r\nMonolog:\r\nMonolog is a logging subsystem that has been implemented to replace logging as wordpress posts.  By default a factory class is assigned via $badgeos_settings['log_factory'].  This factory class is implemented as includes/Log.php.  And a custom dispatcher has been created to dispatch the data to a flat table structure.\r\n\r\nAny custom plugin can override the default logging factory by implementing an override to the $badgeos_settings['log_factory'] setting.  Further more any of the existing log dispatchers available can be utilized to route the data to the developers preferred data storage.  Many different dispatchers already exist, and the api is very easily extended.\r\n\r\nYou can see an example of how the DMA extended the logging class to include elastic search as a data source at https://github.com/DallasMuseumArt/DMA-Friends/blob/master/wp-content/plugins/badgeos-dma-platform/includes/DmaLog.php","created_at":"2014-04-14T18:14:01Z","updated_at":"2015-03-10T16:47:44Z","closed_at":"2015-03-10T16:47:44Z","merged_at":null,"merge_commit_sha":"160c9a27bad452a8bb4891adec4f8a60a99ece71","assignee":{"login":"brichards","id":285715,"avatar_url":"https://avatars.githubusercontent.com/u/285715?v=3","gravatar_id":"","url":"https://api.github.com/users/brichards","html_url":"https://github.com/brichards","followers_url":"https://api.github.com/users/brichards/followers","following_url":"https://api.github.com/users/brichards/following{/other_user}","gists_url":"https://api.github.com/users/brichards/gists{/gist_id}","starred_url":"https://api.github.com/users/brichards/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brichards/subscriptions","organizations_url":"https://api.github.com/users/brichards/orgs","repos_url":"https://api.github.com/users/brichards/repos","events_url":"https://api.github.com/users/brichards/events{/privacy}","received_events_url":"https://api.github.com/users/brichards/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/opencredit/badgeos/milestones/5","html_url":"https://github.com/opencredit/badgeos/milestones/Future%20Release","labels_url":"https://api.github.com/repos/opencredit/badgeos/milestones/5/labels","id":634063,"number":5,"title":"Future Release","description":"","creator":{"login":"sc0ttkclark","id":709662,"avatar_url":"https://avatars.githubusercontent.com/u/709662?v=3","gravatar_id":"","url":"https://api.github.com/users/sc0ttkclark","html_url":"https://github.com/sc0ttkclark","followers_url":"https://api.github.com/users/sc0ttkclark/followers","following_url":"https://api.github.com/users/sc0ttkclark/following{/other_user}","gists_url":"https://api.github.com/users/sc0ttkclark/gists{/gist_id}","starred_url":"https://api.github.com/users/sc0ttkclark/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sc0ttkclark/subscriptions","organizations_url":"https://api.github.com/users/sc0ttkclark/orgs","repos_url":"https://api.github.com/users/sc0ttkclark/repos","events_url":"https://api.github.com/users/sc0ttkclark/events{/privacy}","received_events_url":"https://api.github.com/users/sc0ttkclark/received_events","type":"User","site_admin":false},"open_issues":1,"closed_issues":1,"state":"open","created_at":"2014-04-18T17:52:27Z","updated_at":"2015-03-10T16:47:44Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/opencredit/badgeos/pulls/268/commits","review_comments_url":"https://api.github.com/repos/opencredit/badgeos/pulls/268/comments","review_comment_url":"https://api.github.com/repos/opencredit/badgeos/pulls/comments{/number}","comments_url":"https://api.github.com/repos/opencredit/badgeos/issues/268/comments","statuses_url":"https://api.github.com/repos/opencredit/badgeos/statuses/8ac120e7f7e2d35dc75ee82a75b96782ff0c40f9","head":{"label":"DallasMuseumArt:master","ref":"master","sha":"8ac120e7f7e2d35dc75ee82a75b96782ff0c40f9","user":{"login":"DallasMuseumArt","id":4520470,"avatar_url":"https://avatars.githubusercontent.com/u/4520470?v=3","gravatar_id":"","url":"https://api.github.com/users/DallasMuseumArt","html_url":"https://github.com/DallasMuseumArt","followers_url":"https://api.github.com/users/DallasMuseumArt/followers","following_url":"https://api.github.com/users/DallasMuseumArt/following{/other_user}","gists_url":"https://api.github.com/users/DallasMuseumArt/gists{/gist_id}","starred_url":"https://api.github.com/users/DallasMuseumArt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DallasMuseumArt/subscriptions","organizations_url":"https://api.github.com/users/DallasMuseumArt/orgs","repos_url":"https://api.github.com/users/DallasMuseumArt/repos","events_url":"https://api.github.com/users/DallasMuseumArt/events{/privacy}","received_events_url":"https://api.github.com/users/DallasMuseumArt/received_events","type":"Organization","site_admin":false},"repo":null},"base":{"label":"opencredit:master","ref":"master","sha":"9c69429f8411e467c84f48b982c278c09fec90fc","user":{"login":"opencredit","id":3958505,"avatar_url":"https://avatars.githubusercontent.com/u/3958505?v=3","gravatar_id":"","url":"https://api.github.com/users/opencredit","html_url":"https://github.com/opencredit","followers_url":"https://api.github.com/users/opencredit/followers","following_url":"https://api.github.com/users/opencredit/following{/other_user}","gists_url":"https://api.github.com/users/opencredit/gists{/gist_id}","starred_url":"https://api.github.com/users/opencredit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/opencredit/subscriptions","organizations_url":"https://api.github.com/users/opencredit/orgs","repos_url":"https://api.github.com/users/opencredit/repos","events_url":"https://api.github.com/users/opencredit/events{/privacy}","received_events_url":"https://api.github.com/users/opencredit/received_events","type":"User","site_admin":false},"repo":{"id":9036394,"name":"badgeos","full_name":"opencredit/badgeos","owner":{"login":"opencredit","id":3958505,"avatar_url":"https://avatars.githubusercontent.com/u/3958505?v=3","gravatar_id":"","url":"https://api.github.com/users/opencredit","html_url":"https://github.com/opencredit","followers_url":"https://api.github.com/users/opencredit/followers","following_url":"https://api.github.com/users/opencredit/following{/other_user}","gists_url":"https://api.github.com/users/opencredit/gists{/gist_id}","starred_url":"https://api.github.com/users/opencredit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/opencredit/subscriptions","organizations_url":"https://api.github.com/users/opencredit/orgs","repos_url":"https://api.github.com/users/opencredit/repos","events_url":"https://api.github.com/users/opencredit/events{/privacy}","received_events_url":"https://api.github.com/users/opencredit/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/opencredit/badgeos","description":"BadgeOS is a plugin to WordPress that allows you to easily create badges and set up the steps and achievements users take to earn them. Badges are Mozilla OBI compatible and sharable via Credly.","fork":false,"url":"https://api.github.com/repos/opencredit/badgeos","forks_url":"https://api.github.com/repos/opencredit/badgeos/forks","keys_url":"https://api.github.com/repos/opencredit/badgeos/keys{/key_id}","collaborators_url":"https://api.github.com/repos/opencredit/badgeos/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/opencredit/badgeos/teams","hooks_url":"https://api.github.com/repos/opencredit/badgeos/hooks","issue_events_url":"https://api.github.com/repos/opencredit/badgeos/issues/events{/number}","events_url":"https://api.github.com/repos/opencredit/badgeos/events","assignees_url":"https://api.github.com/repos/opencredit/badgeos/assignees{/user}","branches_url":"https://api.github.com/repos/opencredit/badgeos/branches{/branch}","tags_url":"https://api.github.com/repos/opencredit/badgeos/tags","blobs_url":"https://api.github.com/repos/opencredit/badgeos/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/opencredit/badgeos/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/opencredit/badgeos/git/refs{/sha}","trees_url":"https://api.github.com/repos/opencredit/badgeos/git/trees{/sha}","statuses_url":"https://api.github.com/repos/opencredit/badgeos/statuses/{sha}","languages_url":"https://api.github.com/repos/opencredit/badgeos/languages","stargazers_url":"https://api.github.com/repos/opencredit/badgeos/stargazers","contributors_url":"https://api.github.com/repos/opencredit/badgeos/contributors","subscribers_url":"https://api.github.com/repos/opencredit/badgeos/subscribers","subscription_url":"https://api.github.com/repos/opencredit/badgeos/subscription","commits_url":"https://api.github.com/repos/opencredit/badgeos/commits{/sha}","git_commits_url":"https://api.github.com/repos/opencredit/badgeos/git/commits{/sha}","comments_url":"https://api.github.com/repos/opencredit/badgeos/comments{/number}","issue_comment_url":"https://api.github.com/repos/opencredit/badgeos/issues/comments{/number}","contents_url":"https://api.github.com/repos/opencredit/badgeos/contents/{+path}","compare_url":"https://api.github.com/repos/opencredit/badgeos/compare/{base}...{head}","merges_url":"https://api.github.com/repos/opencredit/badgeos/merges","archive_url":"https://api.github.com/repos/opencredit/badgeos/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/opencredit/badgeos/downloads","issues_url":"https://api.github.com/repos/opencredit/badgeos/issues{/number}","pulls_url":"https://api.github.com/repos/opencredit/badgeos/pulls{/number}","milestones_url":"https://api.github.com/repos/opencredit/badgeos/milestones{/number}","notifications_url":"https://api.github.com/repos/opencredit/badgeos/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/opencredit/badgeos/labels{/name}","releases_url":"https://api.github.com/repos/opencredit/badgeos/releases{/id}","created_at":"2013-03-26T17:45:41Z","updated_at":"2015-02-18T13:05:14Z","pushed_at":"2015-02-03T16:04:12Z","git_url":"git://github.com/opencredit/badgeos.git","ssh_url":"git@github.com:opencredit/badgeos.git","clone_url":"https://github.com/opencredit/badgeos.git","svn_url":"https://github.com/opencredit/badgeos","homepage":"http://www.badgeos.org","size":4399,"stargazers_count":59,"watchers_count":59,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":34,"mirror_url":null,"open_issues_count":152,"forks":34,"open_issues":152,"watchers":59,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/opencredit/badgeos/pulls/268"},"html":{"href":"https://github.com/opencredit/badgeos/pull/268"},"issue":{"href":"https://api.github.com/repos/opencredit/badgeos/issues/268"},"comments":{"href":"https://api.github.com/repos/opencredit/badgeos/issues/268/comments"},"review_comments":{"href":"https://api.github.com/repos/opencredit/badgeos/pulls/268/comments"},"review_comment":{"href":"https://api.github.com/repos/opencredit/badgeos/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/opencredit/badgeos/pulls/268/commits"},"statuses":{"href":"https://api.github.com/repos/opencredit/badgeos/statuses/8ac120e7f7e2d35dc75ee82a75b96782ff0c40f9"}},"merged":false,"mergeable":false,"mergeable_state":"dirty","merged_by":null,"comments":3,"review_comments":0,"commits":12,"additions":38819,"deletions":356,"changed_files":321}}