{"action":"created","comment":{"url":"https://api.github.com/repos/pantheon-systems/wp-redis/pulls/comments/62355125","id":62355125,"diff_hunk":"@@ -29,6 +29,68 @@ public function __invoke() {\n \n \t}\n \n+\t/**\n+\t * Debug object cache hit / miss ratio for any page URL.\n+\t *\n+\t * ## OPTIONS\n+\t *\n+\t * [--url=<url>]\n+\t * : Execute a request against a specified URL. Defaults to home_url( '/' ).\n+\t *\n+\t * [--format=<format>]\n+\t * : Render the results in a particular format.\n+\t *\n+\t * @when before_wp_load\n+\t */\n+\tpublic function debug( $_, $assoc_args ) {\n+\t\tglobal $wp_object_cache;\n+\t\t$this->load_wordpress_with_template();\n+\t\t$data = array(\n+\t\t\t'cache_hits'      => $wp_object_cache->cache_hits,\n+\t\t\t'cache_misses'    => $wp_object_cache->cache_misses,\n+\t\t\t'redis_calls'     => $wp_object_cache->redis_calls,\n+\t\t);\n+\t\tWP_CLI::print_value( $data, $assoc_args );\n+\t}\n+\n+\t/**\n+\t * Runs through the entirety of the WP bootstrap process\n+\t */\n+\tprivate function load_wordpress_with_template() {\n+\t\tglobal $wp_query;\n+\n+\t\tWP_CLI::get_runner()->load_wordpress();\n+\n+\t\t// Set up the main WordPress query.\n+\t\twp();\n+\n+\t\t$interpreted = array();\n+\t\tforeach( $wp_query as $key => $value ) {\n+\t\t\tif ( 0 === stripos( $key, 'is_' ) && $value ) {\n+\t\t\t\t$interpreted[] = $key;\n+\t\t\t}\n+\t\t}\n+\t\tWP_CLI::debug( 'Main WP_Query: ' . implode( ', ', $interpreted ), 'redis-debug' );\n+\n+\t\tdefine( 'WP_USE_THEMES', true );\n+\n+\t\tadd_filter( 'template_include', function( $template ) {\n+\t\t\t$display_template = str_replace( dirname( get_template_directory() ) . '/', '', $template );\n+\t\t\tWP_CLI::debug( \"Theme template: {$display_template}\", 'redis-debug' );\n+\t\t\treturn $template;\n+\t\t}, 999 );\n+\n+\t\t// Template is normally loaded in global scope, so we need to replicate\n+\t\tforeach( $GLOBALS as $key => $value ) {\n+\t\t\tglobal $$key;\n+\t\t}\n+\n+\t\t// Load the theme template.\n+\t\tob_start();\n+\t\trequire_once( ABSPATH . WPINC . '/template-loader.php' );\n+\t\tob_get_clean();\n+\t}\n+\n }\n \n-WP_CLI::add_command( 'redis-cli', 'WP_Redis_CLI_Command' );\n+WP_CLI::add_command( 'redis', 'WP_Redis_CLI_Command' );","path":"cli.php","position":78,"original_position":78,"commit_id":"d9e43e1f146d904f3f4b02229bbea87cc542536f","original_commit_id":"d9e43e1f146d904f3f4b02229bbea87cc542536f","user":{"login":"stevector","id":211029,"avatar_url":"https://avatars.githubusercontent.com/u/211029?v=3","gravatar_id":"","url":"https://api.github.com/users/stevector","html_url":"https://github.com/stevector","followers_url":"https://api.github.com/users/stevector/followers","following_url":"https://api.github.com/users/stevector/following{/other_user}","gists_url":"https://api.github.com/users/stevector/gists{/gist_id}","starred_url":"https://api.github.com/users/stevector/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stevector/subscriptions","organizations_url":"https://api.github.com/users/stevector/orgs","repos_url":"https://api.github.com/users/stevector/repos","events_url":"https://api.github.com/users/stevector/events{/privacy}","received_events_url":"https://api.github.com/users/stevector/received_events","type":"User","site_admin":false},"body":"As a point of clarity, if this change were happening after 1.0.0, we'd keep `redis-cli` and mark it as deprecated, yes?","created_at":"2016-05-06T16:37:35Z","updated_at":"2016-05-06T16:37:35Z","html_url":"https://github.com/pantheon-systems/wp-redis/pull/99#discussion_r62355125","pull_request_url":"https://api.github.com/repos/pantheon-systems/wp-redis/pulls/99","_links":{"self":{"href":"https://api.github.com/repos/pantheon-systems/wp-redis/pulls/comments/62355125"},"html":{"href":"https://github.com/pantheon-systems/wp-redis/pull/99#discussion_r62355125"},"pull_request":{"href":"https://api.github.com/repos/pantheon-systems/wp-redis/pulls/99"}}},"pull_request":{"url":"https://api.github.com/repos/pantheon-systems/wp-redis/pulls/99","id":67919964,"html_url":"https://github.com/pantheon-systems/wp-redis/pull/99","diff_url":"https://github.com/pantheon-systems/wp-redis/pull/99.diff","patch_url":"https://github.com/pantheon-systems/wp-redis/pull/99.patch","issue_url":"https://api.github.com/repos/pantheon-systems/wp-redis/issues/99","number":99,"state":"open","locked":false,"title":"Introduce `wp redis debug` for easier CLI debugging; transform `redis-cli` to `redis cli`","user":{"login":"danielbachhuber","id":36432,"avatar_url":"https://avatars.githubusercontent.com/u/36432?v=3","gravatar_id":"","url":"https://api.github.com/users/danielbachhuber","html_url":"https://github.com/danielbachhuber","followers_url":"https://api.github.com/users/danielbachhuber/followers","following_url":"https://api.github.com/users/danielbachhuber/following{/other_user}","gists_url":"https://api.github.com/users/danielbachhuber/gists{/gist_id}","starred_url":"https://api.github.com/users/danielbachhuber/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danielbachhuber/subscriptions","organizations_url":"https://api.github.com/users/danielbachhuber/orgs","repos_url":"https://api.github.com/users/danielbachhuber/repos","events_url":"https://api.github.com/users/danielbachhuber/events{/privacy}","received_events_url":"https://api.github.com/users/danielbachhuber/received_events","type":"User","site_admin":false},"body":null,"created_at":"2016-04-26T16:48:58Z","updated_at":"2016-05-06T16:37:35Z","closed_at":null,"merged_at":null,"merge_commit_sha":"53128c1cc63fd090625046a0ef3378fe306a2b9c","assignee":{"login":"stevector","id":211029,"avatar_url":"https://avatars.githubusercontent.com/u/211029?v=3","gravatar_id":"","url":"https://api.github.com/users/stevector","html_url":"https://github.com/stevector","followers_url":"https://api.github.com/users/stevector/followers","following_url":"https://api.github.com/users/stevector/following{/other_user}","gists_url":"https://api.github.com/users/stevector/gists{/gist_id}","starred_url":"https://api.github.com/users/stevector/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stevector/subscriptions","organizations_url":"https://api.github.com/users/stevector/orgs","repos_url":"https://api.github.com/users/stevector/repos","events_url":"https://api.github.com/users/stevector/events{/privacy}","received_events_url":"https://api.github.com/users/stevector/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/pantheon-systems/wp-redis/pulls/99/commits","review_comments_url":"https://api.github.com/repos/pantheon-systems/wp-redis/pulls/99/comments","review_comment_url":"https://api.github.com/repos/pantheon-systems/wp-redis/pulls/comments{/number}","comments_url":"https://api.github.com/repos/pantheon-systems/wp-redis/issues/99/comments","statuses_url":"https://api.github.com/repos/pantheon-systems/wp-redis/statuses/d9e43e1f146d904f3f4b02229bbea87cc542536f","head":{"label":"pantheon-systems:redis-debug-cli","ref":"redis-debug-cli","sha":"d9e43e1f146d904f3f4b02229bbea87cc542536f","user":{"login":"pantheon-systems","id":513357,"avatar_url":"https://avatars.githubusercontent.com/u/513357?v=3","gravatar_id":"","url":"https://api.github.com/users/pantheon-systems","html_url":"https://github.com/pantheon-systems","followers_url":"https://api.github.com/users/pantheon-systems/followers","following_url":"https://api.github.com/users/pantheon-systems/following{/other_user}","gists_url":"https://api.github.com/users/pantheon-systems/gists{/gist_id}","starred_url":"https://api.github.com/users/pantheon-systems/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pantheon-systems/subscriptions","organizations_url":"https://api.github.com/users/pantheon-systems/orgs","repos_url":"https://api.github.com/users/pantheon-systems/repos","events_url":"https://api.github.com/users/pantheon-systems/events{/privacy}","received_events_url":"https://api.github.com/users/pantheon-systems/received_events","type":"Organization","site_admin":false},"repo":{"id":24170398,"name":"wp-redis","full_name":"pantheon-systems/wp-redis","owner":{"login":"pantheon-systems","id":513357,"avatar_url":"https://avatars.githubusercontent.com/u/513357?v=3","gravatar_id":"","url":"https://api.github.com/users/pantheon-systems","html_url":"https://github.com/pantheon-systems","followers_url":"https://api.github.com/users/pantheon-systems/followers","following_url":"https://api.github.com/users/pantheon-systems/following{/other_user}","gists_url":"https://api.github.com/users/pantheon-systems/gists{/gist_id}","starred_url":"https://api.github.com/users/pantheon-systems/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pantheon-systems/subscriptions","organizations_url":"https://api.github.com/users/pantheon-systems/orgs","repos_url":"https://api.github.com/users/pantheon-systems/repos","events_url":"https://api.github.com/users/pantheon-systems/events{/privacy}","received_events_url":"https://api.github.com/users/pantheon-systems/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/pantheon-systems/wp-redis","description":"WordPress Object Cache using Redis.","fork":true,"url":"https://api.github.com/repos/pantheon-systems/wp-redis","forks_url":"https://api.github.com/repos/pantheon-systems/wp-redis/forks","keys_url":"https://api.github.com/repos/pantheon-systems/wp-redis/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pantheon-systems/wp-redis/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pantheon-systems/wp-redis/teams","hooks_url":"https://api.github.com/repos/pantheon-systems/wp-redis/hooks","issue_events_url":"https://api.github.com/repos/pantheon-systems/wp-redis/issues/events{/number}","events_url":"https://api.github.com/repos/pantheon-systems/wp-redis/events","assignees_url":"https://api.github.com/repos/pantheon-systems/wp-redis/assignees{/user}","branches_url":"https://api.github.com/repos/pantheon-systems/wp-redis/branches{/branch}","tags_url":"https://api.github.com/repos/pantheon-systems/wp-redis/tags","blobs_url":"https://api.github.com/repos/pantheon-systems/wp-redis/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pantheon-systems/wp-redis/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pantheon-systems/wp-redis/git/refs{/sha}","trees_url":"https://api.github.com/repos/pantheon-systems/wp-redis/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pantheon-systems/wp-redis/statuses/{sha}","languages_url":"https://api.github.com/repos/pantheon-systems/wp-redis/languages","stargazers_url":"https://api.github.com/repos/pantheon-systems/wp-redis/stargazers","contributors_url":"https://api.github.com/repos/pantheon-systems/wp-redis/contributors","subscribers_url":"https://api.github.com/repos/pantheon-systems/wp-redis/subscribers","subscription_url":"https://api.github.com/repos/pantheon-systems/wp-redis/subscription","commits_url":"https://api.github.com/repos/pantheon-systems/wp-redis/commits{/sha}","git_commits_url":"https://api.github.com/repos/pantheon-systems/wp-redis/git/commits{/sha}","comments_url":"https://api.github.com/repos/pantheon-systems/wp-redis/comments{/number}","issue_comment_url":"https://api.github.com/repos/pantheon-systems/wp-redis/issues/comments{/number}","contents_url":"https://api.github.com/repos/pantheon-systems/wp-redis/contents/{+path}","compare_url":"https://api.github.com/repos/pantheon-systems/wp-redis/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pantheon-systems/wp-redis/merges","archive_url":"https://api.github.com/repos/pantheon-systems/wp-redis/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pantheon-systems/wp-redis/downloads","issues_url":"https://api.github.com/repos/pantheon-systems/wp-redis/issues{/number}","pulls_url":"https://api.github.com/repos/pantheon-systems/wp-redis/pulls{/number}","milestones_url":"https://api.github.com/repos/pantheon-systems/wp-redis/milestones{/number}","notifications_url":"https://api.github.com/repos/pantheon-systems/wp-redis/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pantheon-systems/wp-redis/labels{/name}","releases_url":"https://api.github.com/repos/pantheon-systems/wp-redis/releases{/id}","deployments_url":"https://api.github.com/repos/pantheon-systems/wp-redis/deployments","created_at":"2014-09-18T02:13:43Z","updated_at":"2016-04-29T10:00:23Z","pushed_at":"2016-05-06T12:14:20Z","git_url":"git://github.com/pantheon-systems/wp-redis.git","ssh_url":"git@github.com:pantheon-systems/wp-redis.git","clone_url":"https://github.com/pantheon-systems/wp-redis.git","svn_url":"https://github.com/pantheon-systems/wp-redis","homepage":"https://wordpress.org/plugins/wp-redis/","size":201,"stargazers_count":28,"watchers_count":28,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":17,"mirror_url":null,"open_issues_count":11,"forks":17,"open_issues":11,"watchers":28,"default_branch":"master"}},"base":{"label":"pantheon-systems:master","ref":"master","sha":"0e00d90df8d087950c43ec3e8ee11c2afd4a6648","user":{"login":"pantheon-systems","id":513357,"avatar_url":"https://avatars.githubusercontent.com/u/513357?v=3","gravatar_id":"","url":"https://api.github.com/users/pantheon-systems","html_url":"https://github.com/pantheon-systems","followers_url":"https://api.github.com/users/pantheon-systems/followers","following_url":"https://api.github.com/users/pantheon-systems/following{/other_user}","gists_url":"https://api.github.com/users/pantheon-systems/gists{/gist_id}","starred_url":"https://api.github.com/users/pantheon-systems/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pantheon-systems/subscriptions","organizations_url":"https://api.github.com/users/pantheon-systems/orgs","repos_url":"https://api.github.com/users/pantheon-systems/repos","events_url":"https://api.github.com/users/pantheon-systems/events{/privacy}","received_events_url":"https://api.github.com/users/pantheon-systems/received_events","type":"Organization","site_admin":false},"repo":{"id":24170398,"name":"wp-redis","full_name":"pantheon-systems/wp-redis","owner":{"login":"pantheon-systems","id":513357,"avatar_url":"https://avatars.githubusercontent.com/u/513357?v=3","gravatar_id":"","url":"https://api.github.com/users/pantheon-systems","html_url":"https://github.com/pantheon-systems","followers_url":"https://api.github.com/users/pantheon-systems/followers","following_url":"https://api.github.com/users/pantheon-systems/following{/other_user}","gists_url":"https://api.github.com/users/pantheon-systems/gists{/gist_id}","starred_url":"https://api.github.com/users/pantheon-systems/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pantheon-systems/subscriptions","organizations_url":"https://api.github.com/users/pantheon-systems/orgs","repos_url":"https://api.github.com/users/pantheon-systems/repos","events_url":"https://api.github.com/users/pantheon-systems/events{/privacy}","received_events_url":"https://api.github.com/users/pantheon-systems/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/pantheon-systems/wp-redis","description":"WordPress Object Cache using Redis.","fork":true,"url":"https://api.github.com/repos/pantheon-systems/wp-redis","forks_url":"https://api.github.com/repos/pantheon-systems/wp-redis/forks","keys_url":"https://api.github.com/repos/pantheon-systems/wp-redis/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pantheon-systems/wp-redis/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pantheon-systems/wp-redis/teams","hooks_url":"https://api.github.com/repos/pantheon-systems/wp-redis/hooks","issue_events_url":"https://api.github.com/repos/pantheon-systems/wp-redis/issues/events{/number}","events_url":"https://api.github.com/repos/pantheon-systems/wp-redis/events","assignees_url":"https://api.github.com/repos/pantheon-systems/wp-redis/assignees{/user}","branches_url":"https://api.github.com/repos/pantheon-systems/wp-redis/branches{/branch}","tags_url":"https://api.github.com/repos/pantheon-systems/wp-redis/tags","blobs_url":"https://api.github.com/repos/pantheon-systems/wp-redis/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pantheon-systems/wp-redis/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pantheon-systems/wp-redis/git/refs{/sha}","trees_url":"https://api.github.com/repos/pantheon-systems/wp-redis/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pantheon-systems/wp-redis/statuses/{sha}","languages_url":"https://api.github.com/repos/pantheon-systems/wp-redis/languages","stargazers_url":"https://api.github.com/repos/pantheon-systems/wp-redis/stargazers","contributors_url":"https://api.github.com/repos/pantheon-systems/wp-redis/contributors","subscribers_url":"https://api.github.com/repos/pantheon-systems/wp-redis/subscribers","subscription_url":"https://api.github.com/repos/pantheon-systems/wp-redis/subscription","commits_url":"https://api.github.com/repos/pantheon-systems/wp-redis/commits{/sha}","git_commits_url":"https://api.github.com/repos/pantheon-systems/wp-redis/git/commits{/sha}","comments_url":"https://api.github.com/repos/pantheon-systems/wp-redis/comments{/number}","issue_comment_url":"https://api.github.com/repos/pantheon-systems/wp-redis/issues/comments{/number}","contents_url":"https://api.github.com/repos/pantheon-systems/wp-redis/contents/{+path}","compare_url":"https://api.github.com/repos/pantheon-systems/wp-redis/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pantheon-systems/wp-redis/merges","archive_url":"https://api.github.com/repos/pantheon-systems/wp-redis/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pantheon-systems/wp-redis/downloads","issues_url":"https://api.github.com/repos/pantheon-systems/wp-redis/issues{/number}","pulls_url":"https://api.github.com/repos/pantheon-systems/wp-redis/pulls{/number}","milestones_url":"https://api.github.com/repos/pantheon-systems/wp-redis/milestones{/number}","notifications_url":"https://api.github.com/repos/pantheon-systems/wp-redis/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pantheon-systems/wp-redis/labels{/name}","releases_url":"https://api.github.com/repos/pantheon-systems/wp-redis/releases{/id}","deployments_url":"https://api.github.com/repos/pantheon-systems/wp-redis/deployments","created_at":"2014-09-18T02:13:43Z","updated_at":"2016-04-29T10:00:23Z","pushed_at":"2016-05-06T12:14:20Z","git_url":"git://github.com/pantheon-systems/wp-redis.git","ssh_url":"git@github.com:pantheon-systems/wp-redis.git","clone_url":"https://github.com/pantheon-systems/wp-redis.git","svn_url":"https://github.com/pantheon-systems/wp-redis","homepage":"https://wordpress.org/plugins/wp-redis/","size":201,"stargazers_count":28,"watchers_count":28,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":17,"mirror_url":null,"open_issues_count":11,"forks":17,"open_issues":11,"watchers":28,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/pantheon-systems/wp-redis/pulls/99"},"html":{"href":"https://github.com/pantheon-systems/wp-redis/pull/99"},"issue":{"href":"https://api.github.com/repos/pantheon-systems/wp-redis/issues/99"},"comments":{"href":"https://api.github.com/repos/pantheon-systems/wp-redis/issues/99/comments"},"review_comments":{"href":"https://api.github.com/repos/pantheon-systems/wp-redis/pulls/99/comments"},"review_comment":{"href":"https://api.github.com/repos/pantheon-systems/wp-redis/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/pantheon-systems/wp-redis/pulls/99/commits"},"statuses":{"href":"https://api.github.com/repos/pantheon-systems/wp-redis/statuses/d9e43e1f146d904f3f4b02229bbea87cc542536f"}}}}