Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
tombenner committed Mar 6, 2012
0 parents commit a5719cf
Show file tree
Hide file tree
Showing 38 changed files with 9,909 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -0,0 +1 @@
.DS_Store
19 changes: 19 additions & 0 deletions LICENSE.txt
@@ -0,0 +1,19 @@
Copyright (C) 2012 by Tom Benner

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
51 changes: 51 additions & 0 deletions README.md
@@ -0,0 +1,51 @@
MySQL Profiler
==================================================
A SQL profiler for WordPress

Description
-----------

MySQL Profiler displays debugging information about SQL queries to admin WordPress users. For each query, the profiler displays the time, syntax-highlighted SQL, and a trace of the functions (as well as the file and line number that the functions were called from) that were called.

The list can be sorted by any of its columns, so you can, for example:

* Order the list by ID to see the chronological order of the queries
* Order the list by time to see the slowest queries
* Order the list by query to group the queries by type (SELECT, UPDATE, etc)
* Order the list by trace to group the queries by similar origins

The list can also filtered by typing in the search box, so you can, for example:

* View all queries that use the wp_posts table
* View all queries that are related to the use of a function in taxonomy.php
* View all queries that are related to the use of a specific function or class
* View all queries that call a specific MySQL function

To turn off syntax highlighting, put the following in wp-config.php:

define('MP_HIGHLIGHT_SYNTAX', false);

To omit the file and line number from the function trace and display the functions as a comma-separated list (to save vertical space), define the following in wp-config.php:

define('MP_DISPLAY_FILES', false);

This plugin was loosely based on [Frank BŸltge](http://bueltge.de/)'s [Debug Queries](http://wordpress.org/extend/plugins/debug-queries/) plugin, so a hearty thanks to him for the development of that.

If you'd like to grab development releases, see what new features are being added, or browse the source code please visit/follow the [GitHub repo](http://github.com/tombenner/mysql-profiler).

Installation
------------

1. Put `mysql-profiler` into the `wp-content/plugins` directory
1. Activate the plugin in the "Plugins" menu in WordPress to turn on the profiling
1. Deactivate when you've finished using the profiling

Frequently Asked Questions
--------------------------

#### Is feature X available?

If there's widely-needed functionality that you'd like that isn't implemented, I'd likely be willing to implement it myself or to accept any well-written code that implements it. Please feel free to either add a topic in the WordPress forum or contact me through GitHub for any such requests:

* [WordPress Forum](http://wordpress.org/tags/mysql-profiler?forum_id=10)
* [GitHub](http://github.com/tombenner)
53 changes: 53 additions & 0 deletions css/style.css
@@ -0,0 +1,53 @@
.mysql-profiler {
clear:both;
width:90%;
margin:15px auto;
padding:18px;
border:1px solid #ccc;
border-radius:10px;
background-color:#fff;
color:#000;
font-family:Helvetica,Arial,sans-serif;
font-size:12px;
text-align:left;
}
.mysql-profiler h3 {
font-weight:bold;
font-size:18px;
}
.mysql-profiler .mp-column-time {
width:70px;
}
.mysql-profiler .mp-column-trace > div {
width:350px;
}
.mysql-profiler .mp-column-query > div,
.mysql-profiler .mp-column-trace > div {
max-height:90px;
overflow-y:auto;
}
.mysql-profiler .mp-column-trace > div > div {
clear:both;
}
.mysql-profiler .mp-column-trace {
font-size:11px;
}
.mysql-profiler .line-reference {
float:right;
text-align:right;
font-size:10px;
color:#999;
}
.mysql-profiler .mp-general-stats {
clear:both;
padding:15px 0;
list-style-type:none;
margin:0;
}
.mysql-profiler .dataTables_info {
display:none;
}
.mysql-profiler .mp-final-message {
font-weight:bold;
font-style:italic;
}
219 changes: 219 additions & 0 deletions datatables/css/jquery.dataTables.css
@@ -0,0 +1,219 @@

/*
* Table
*/
table.dataTable {
margin: 0 auto;
clear: both;
width: 100%;
}

table.dataTable thead th {
padding: 3px 18px 3px 10px;
border-bottom: 1px solid black;
font-weight: bold;
cursor: pointer;
*cursor: hand;
}

table.dataTable tfoot th {
padding: 3px 18px 3px 10px;
border-top: 1px solid black;
font-weight: bold;
}

table.dataTable td {
padding: 3px 10px;
}

table.dataTable td.center,
table.dataTable td.dataTables_empty {
text-align: center;
}

table.dataTable tr.odd { background-color: #E2E4FF; }
table.dataTable tr.even { background-color: white; }

table.dataTable tr.odd td.sorting_1 { background-color: #D3D6FF; }
table.dataTable tr.odd td.sorting_2 { background-color: #DADCFF; }
table.dataTable tr.odd td.sorting_3 { background-color: #E0E2FF; }
table.dataTable tr.even td.sorting_1 { background-color: #EAEBFF; }
table.dataTable tr.even td.sorting_2 { background-color: #F2F3FF; }
table.dataTable tr.even td.sorting_3 { background-color: #F9F9FF; }


/*
* Table wrapper
*/
.dataTables_wrapper {
position: relative;
clear: both;
*zoom: 1;
}


/*
* Page length menu
*/
.dataTables_length {
float: left;
}


/*
* Filter
*/
.dataTables_filter {
float: right;
text-align: right;
}


/*
* Table information
*/
.dataTables_info {
clear: both;
float: left;
}


/*
* Pagination
*/
.dataTables_paginate {
float: right;
text-align: right;
}

/* Two button pagination - previous / next */
.paginate_disabled_previous,
.paginate_enabled_previous,
.paginate_disabled_next,
.paginate_enabled_next {
height: 19px;
float: left;
cursor: pointer;
*cursor: hand;
color: #111 !important;
}
.paginate_disabled_previous:hover,
.paginate_enabled_previous:hover,
.paginate_disabled_next:hover,
.paginate_enabled_next:hover {
text-decoration: none !important;
}
.paginate_disabled_previous:active,
.paginate_enabled_previous:active,
.paginate_disabled_next:active,
.paginate_enabled_next:active {
outline: none;
}

.paginate_disabled_previous,
.paginate_disabled_next {
color: #666 !important;
}
.paginate_disabled_previous,
.paginate_enabled_previous {
padding-left: 23px;
}
.paginate_disabled_next,
.paginate_enabled_next {
padding-right: 23px;
margin-left: 10px;
}

.paginate_enabled_previous { background: url('../images/back_enabled.png') no-repeat top left; }
.paginate_enabled_previous:hover { background: url('../images/back_enabled_hover.png') no-repeat top left; }
.paginate_disabled_previous { background: url('../images/back_disabled.png') no-repeat top left; }

.paginate_enabled_next { background: url('../images/forward_enabled.png') no-repeat top right; }
.paginate_enabled_next:hover { background: url('../images/forward_enabled_hover.png') no-repeat top right; }
.paginate_disabled_next { background: url('../images/forward_disabled.png') no-repeat top right; }

/* Full number pagination */
.paging_full_numbers {
height: 22px;
line-height: 22px;
}
.paging_full_numbers a:active {
outline: none
}
.paging_full_numbers a:hover {
text-decoration: none;
}

.paging_full_numbers a.paginate_button,
.paging_full_numbers a.paginate_active {
border: 1px solid #aaa;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
padding: 2px 5px;
margin: 0 3px;
cursor: pointer;
*cursor: hand;
color: #333 !important;
}

.paging_full_numbers a.paginate_button {
background-color: #ddd;
}

.paging_full_numbers a.paginate_button:hover {
background-color: #ccc;
text-decoration: none !important;
}

.paging_full_numbers a.paginate_active {
background-color: #99B3FF;
}


/*
* Processing indicator
*/
.dataTables_processing {
position: absolute;
top: 50%;
left: 50%;
width: 250px;
height: 30px;
margin-left: -125px;
margin-top: -15px;
padding: 14px 0 2px 0;
border: 1px solid #ddd;
text-align: center;
color: #999;
font-size: 14px;
background-color: white;
}


/*
* Sorting
*/
.sorting { background: url('../images/sort_both.png') no-repeat center right; }
.sorting_asc { background: url('../images/sort_asc.png') no-repeat center right; }
.sorting_desc { background: url('../images/sort_desc.png') no-repeat center right; }

.sorting_asc_disabled { background: url('../images/sort_asc_disabled.png') no-repeat center right; }
.sorting_desc_disabled { background: url('../images/sort_desc_disabled.png') no-repeat center right; }

table.dataTable th:active {
outline: none;
}


/*
* Scrolling
*/
.dataTables_scroll {
clear: both;
}

.dataTables_scrollBody {
*margin-top: -1px;
}

Binary file added datatables/images/back_disabled.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added datatables/images/back_enabled.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added datatables/images/back_enabled_hover.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added datatables/images/favicon.ico
Binary file not shown.
Binary file added datatables/images/forward_disabled.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added datatables/images/forward_enabled.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added datatables/images/forward_enabled_hover.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added datatables/images/sort_asc.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added datatables/images/sort_asc_disabled.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added datatables/images/sort_both.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added datatables/images/sort_desc.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added datatables/images/sort_desc_disabled.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit a5719cf

Please sign in to comment.