From bca045087bdd72928d8602f19e18706252f53177 Mon Sep 17 00:00:00 2001 From: lucha <lucha@paranoici.org> Date: Sat, 2 Dec 2017 13:44:01 -0800 Subject: [PATCH] removed wpdb-profiling plugin --- wp-content/plugins/wpdb-profiling/readme.txt | 87 ---- .../plugins/wpdb-profiling/wpdb-profiling.css | 47 -- .../plugins/wpdb-profiling/wpdb-profiling.php | 480 ------------------ 3 files changed, 614 deletions(-) delete mode 100644 wp-content/plugins/wpdb-profiling/readme.txt delete mode 100644 wp-content/plugins/wpdb-profiling/wpdb-profiling.css delete mode 100644 wp-content/plugins/wpdb-profiling/wpdb-profiling.php diff --git a/wp-content/plugins/wpdb-profiling/readme.txt b/wp-content/plugins/wpdb-profiling/readme.txt deleted file mode 100644 index 747b24d09..000000000 --- a/wp-content/plugins/wpdb-profiling/readme.txt +++ /dev/null @@ -1,87 +0,0 @@ -=== WPDB Profiling === -Contributors: tierrainnovation -Donate link: http://tierra-innovation.com/wordpress-cms/2009/10/09/wpdb-profiling/ -Tags: profiling,db,queries,query,db query total -Requires at least: 1.5 -Tested up to: 2.9.1 -Stable tag: trunk - -This plugin will give you the total number of queries to the db per page, as well as the total time it took to render those queries out to the page. - -== Description == - -Render database profiling at the bottom of all WordPress pages. To install, upload `wpdb-profiling` to the `/wp-content/plugins/` directory, activate the plugin, and enable / disable features from the wp-admin plugin screen. - -== Changelog == - -= 1.3.3 = - -Fixing a bug where the css is always enabled, even if the plugin isn't. - -= 1.3.2 = - -Adds front end functionality to the wp-admin. Helpful for debugging admin or plugin scripts under development inside wp-admin. - -= 1.3 = - -This version adds db optimization functionality. - -1. Support to disable post revisions: Post revisions can bloat your database by retaining previously saved versions of your post, which you may never use. -2. Support to disable auto saving: Auto saving can bloat your database by assigning different id's each time an item is saved, this adding an unnecessary record to the db. - -= 1.2.1 = - -1. Update to license information - -= 1.2 = - -1. New configuration options to specify which user levels can view profiling (no longer restricted to Administrator) -2. ?show_queries=true can now be used in addition to ?show_queries=yes -3. Users not logged in can never view profiling - -= 1.1.1 = - -1. ?show_queries=yes $_GET parameter can only be used if logged in user is an administrator (user Level 10) - -= 1.1 = - -1. New wp-admin interface allows you to toggle plugin settings. Options are (Always show profiling when logged in as an administrator?) and (Allow the `?show_queries=yes` parameter in URL to show profiling?) -2. Enable / Disable profiling on the front end when logged in as administrator (user Level 10) to the wp-admin interface. -3. Enable / Disable `?show_queries=yes` $_GET parameter via wp-admin config to allow / prevent url request for query list. -4. Check whether WP_CACHE and SAVEQUERIES are set on the back end - display success / failure notices and suggestions if one is missing. - -= 1.0.2 = - -1. Checks if `define('WP_CACHE', true);` is present. If not, provides plugin suggestions for DB caching. -2. Plugin automatically enabled if your user has Level 10 permissions (administrator) by default. -3. If user Level < 10 or not logged in, you can continue to pass `?show_queries=yes` via the url if you are not logged in. -4. Sets `define('SAVEQUERIES', true);` in plugin should it not be by default. - -The next release will have an admin interface where you can enable / disable the plugin - -= 1.0.1 = - -Groups duplicate function calls and gives a total time for the grouped calls. Also styles the profiling a bit to mirror Kohana's profiling coloring. Also added a fix to PHP 5.2.1 where scientific notation was displaying instead of the true time. - -This plugin will give you the total number of queries to the db per page, as well as the total time it took to render those queries out to the page. Additionally, line by line each individual query will display with the originating SQL statement, time executed and the function call used to execute the query. - -This is especially handy if you are debugging a slow WordPress install and can't seem to locate the cause of the load. It is also a great way to identify plugins that may not have proper caching enabled or supported. - -This is NOT a full page load profiler. This simply shows you the total DB queries and the time it takes to execute. - -== Installation == - -1. Upload `wpdb-profiling.php` to the `/wp-content/plugins/wpdb-profiling/` directory -1. Activate the plugin through the 'Plugins' menu in WordPress -1. Edit `wp-config.php` and add `define('SAVEQUERIES', true);` -1. Load any page and append `?show_queries=yes` to the end of your url to view your db queries and time to execute. - -== Screenshots == - -**[View Screen Shots](http://tierra-innovation.com/wordpress-cms/2009/10/09/wpdb-profiling/)** - -== Frequently Asked Questions == - -= When I view the profile, it shows no results and says Total Number of Queries: 0 and Total Time: 0 = - -First, make sure in your footer.php file that you are using the `<?php wp_footer(); ?>` tag. If you are, verify that you have added `define('SAVEQUERIES', true);` to your wp-config.php. Need more help? **[Support](http://tierra-innovation.com/wordpress-cms/2009/10/09/wpdb-profiling/#respond)** \ No newline at end of file diff --git a/wp-content/plugins/wpdb-profiling/wpdb-profiling.css b/wp-content/plugins/wpdb-profiling/wpdb-profiling.css deleted file mode 100644 index 799f8fd0c..000000000 --- a/wp-content/plugins/wpdb-profiling/wpdb-profiling.css +++ /dev/null @@ -1,47 +0,0 @@ -div#wpdb-profiling { - font-family: Monaco, 'Courier New'; - background: #f8fff8; - margin-top: 20px; - clear: both; - padding: 10px 10px 0; - border: 1px solid #e5eff8; - text-align: left; - color:#000; -} - -div#wpdb-profiling table { - font-size: 1.0em; - color: #4d6171; - width: 100%; - border-collapse: collapse; - border: 1px solid #e5eff8; - border-bottom: 0; - margin-bottom: 10px; -} - -div#wpdb-profiling th { - border-bottom: 1px solid #e5eff8; - background: #cce8fb; - padding: 3px; - color: #263038; - font-size: 12px; - white-space: nowrap; -} - -div#wpdb-profiling td { - font-family: Monaco, 'Courier New'; - color:#000; - background: #ffffff; - border-bottom: 1px solid #e5eff8; - padding: 3px; - font-size: 11px; -} - -div#wpdb-profiling td a { - font-family: Monaco, 'Courier New'; - color:#000; - font-size: 11px; -} - -div#wpdb-profiling td.green { background: #ddffdf; } -div#wpdb-profiling td.red { background: #fdd; } \ No newline at end of file diff --git a/wp-content/plugins/wpdb-profiling/wpdb-profiling.php b/wp-content/plugins/wpdb-profiling/wpdb-profiling.php deleted file mode 100644 index 5b3c7d8f6..000000000 --- a/wp-content/plugins/wpdb-profiling/wpdb-profiling.php +++ /dev/null @@ -1,480 +0,0 @@ -<?php -/* -Plugin Name: WPDB Profiling -Plugin URI: http://www.tierra-innovation.com/blog/2009/07/01/wpdb-profiling-1-1-released/ -Description: Render database profiling below the wp_footer() variable. Upload `wpdb-profiling` to the `/wp-content/plugins/` directory, activate the plugin, and enable / disable features from the wp-admin plugin screen. -Author: Tierra Innovation -Version: 1.3.3 -Author URI: http://www.tierra-innovation.com -*/ - -/* - * This is a modified version (under the MIT License) of a plugin - * originally developed by Tierra Innovation for WNET.org. - * - * This plugin is currently available for use in all personal - * or commercial projects under both MIT and GPL licenses. This - * means that you can choose the license that best suits your - * project, and use it accordingly. - * - * MIT License: http://www.tierra-innovation.com/license/MIT-LICENSE.txt - * GPL2 License: http://www.tierra-innovation.com/license/GPL-LICENSE.txt - */ - -add_action('wp_head', 'wpdb_profiling_head',1); -add_action('admin_head', 'wpdb_profiling_head',1); -add_action('wp_footer', 'wpdb_profiling', 1000); -add_action('admin_footer', 'wpdb_profiling', 1000); - - -if ( !defined('SAVEQUERIES') ) - define('SAVEQUERIES', true); - -function wpdb_profiling_head() { - if(@file_exists(TEMPLATEPATH.'/wpdb-profiling.css')) { - echo '<link rel="stylesheet" href="'.get_stylesheet_directory_uri().'/wpdb-profiling.css" type="text/css" />'."\n"; - } else { - echo '<link rel="stylesheet" type="text/css" href="' . get_settings('siteurl') . '/wp-content/plugins/wpdb-profiling/wpdb-profiling.css" />'."\n"; - } -} - -function wpdb_profiling() { - - global $wpdb; - - $permission_1 = explode(",", get_option('profiling_user_permission_1')); - $permission_2 = explode(",", get_option('profiling_user_permission_2')); - - $display_1 = false; - foreach ($permission_1 as $permission) - { - if (current_user_can($permission)) - $display_1 = true; - - if ($display_1 == true) - break; - } - - $display_2 = false; - foreach ($permission_2 as $permission) - { - if (current_user_can($permission)) - $display_2 = true; - - if ($display_2 == true) - break; - } - - if ( - get_option('always_show_profiling') == "yes" - && $display_1 == true - || - ($_GET['show_queries'] == "yes" || $_GET['show_queries'] == "true") - && get_option('allow_get_request') == "yes" - && $display_2 == true - ) { - - $rows = array(); - $total_time = 0; - $total_time_by_function = array(); - - foreach ($wpdb->queries as $query) { - if ( !isset($total_time_by_function[$query[2]]) ) { - $total_time_by_function[$query[2]] = 0; - } - $total_time_by_function[$query[2]] += $query[1]; - $total_time += $query[1]; - $query_time = number_format($query[1], 7, '.', ''); - $rows[] = array($query[1], " - <tr> - <td>$query[0]</td>\n - <td>$query_time</td>\n - <td>$query[2]</td> - </tr>\n - "); - } - - usort($rows, "wpdb_sort_output"); - arsort($total_time_by_function); - - echo "<div id='wpdb-profiling'>\n"; - - if ( defined('WP_CACHE') ) { - $style = "green"; - $cached = "<strong>Enabled!</strong>"; - } - else { - $style = "red"; - $cached = "<strong>Disabled!</strong> Install a caching tool (<a href='http://wordpress.org/extend/plugins/batcache/' title='Batcache' target='_blank'>Batcache</a>) or (<a href='http://wordpress.org/extend/plugins/wp-super-cache/' title='WP_Super_Cache' target='_blank'>WP_Super_Cache</a>) for DB Optimization."; - } - - echo "<table border='2'>\n"; - echo "<tr>\n"; - echo " - <th width='50%'>Item</th>\n - <th width='50%'>Status</th>\n - "; - echo "</tr>\n"; - echo "<tr>\n"; - echo " - <td><strong>WP_Cache Status:</strong></td>\n - <td class='$style'>$cached</td>\n - "; - echo "</tr>\n"; - echo "</table>\n"; - - echo "<table border='2'>\n"; - echo "<tr>\n"; - echo " - <th>SQL</th>\n - <th>Execution Time</th>\n - <th>Function Call</th>\n - "; - echo "</tr>\n"; - - foreach ($rows as $row) - echo $row[1]; - - echo "<tr>\n"; - echo " <td colspan='3'><strong>Total Time:</strong> " . count($wpdb->queries) . " database queries run in " . $total_time . " seconds.</td>"; - echo "</tr>\n"; - - echo "</table>\n"; - - if ( !empty($total_time_by_function) ) { - - echo "<table border='2'>\n"; - echo "<tr>\n"; - echo " - <th>Grouped Functions</th>\n - <th>Execution Time</th>\n - "; - echo "</tr>\n"; - - foreach ($total_time_by_function as $function => $time) { - echo "<tr>\n"; - echo "<td>$function</td>"; - echo "<td>" . number_format($time, 7, '.', '') . "</td>"; - echo "</tr>\n"; - } - - echo "<tr>\n"; - echo " - <td><strong>Total Time</strong></td>\n - <td><strong>" . array_sum($total_time_by_function) . "</td></strong> - "; - echo "</tr>\n"; - - echo "</table>\n"; - - echo "</div>\n"; - - } - } -} - -function wpdb_sort_output($a, $b) { - return $a[0] == $b[0] ? 0 : (($a[0] > $b[0]) ? -1 : 1); -} - -function set_wpdb_profiling_options() { - $always_show_profiling = get_option('always_show_profiling'); - $allow_get_request = get_option('allow_get_request'); - - $profiling_user_permission_1 = get_option('profiling_user_permission_1'); - $profiling_user_permission_2 = get_option('profiling_user_permission_2'); - - $override_disable_auto_save = get_option('override_disable_auto_save'); - $override_disable_revisioning = get_option('override_disable_revisioning'); - - if ($always_show_profiling !== "no") - add_option('always_show_profiling','yes'); - - if ($allow_get_request !== "yes") - add_option('allow_get_request','no'); - - if ($profiling_user_permission_1 == '') - add_option('profiling_user_permission_1','8,9,10'); - - if ($profiling_user_permission_2 == '') - add_option('profiling_user_permission_2','8,9,10'); - - if ($override_disable_auto_save !== "no") - add_option('override_disable_auto_save','yes'); - - if ($override_disable_revisioning !== "yes") - add_option('override_disable_revisioning','no'); - -} - -function unset_wpdb_profiling_options() { - delete_option('always_show_profiling'); - delete_option('allow_get_request'); - delete_option('profiling_user_permission_1'); - delete_option('profiling_user_permission_2'); - delete_option('override_disable_auto_save'); - delete_option('override_disable_revisioning'); -} - -function admin_profiling_options() { - - if ($_REQUEST['submit']) - update_profiling_options(); - - print_profiling_form(); -} - -function update_profiling_options() { - - $ok = false; - - if ($_REQUEST['always_show_profiling']) - { - update_option('always_show_profiling',$_REQUEST['always_show_profiling']); - $ok = true; - } - - if ($_REQUEST['allow_get_request']) - { - update_option('allow_get_request',$_REQUEST['allow_get_request']); - $ok = true; - } - - if ($_REQUEST['profiling_user_permission_1']) - { - update_option('profiling_user_permission_1',$_REQUEST['profiling_user_permission_1']); - $ok = true; - } - - if ($_REQUEST['profiling_user_permission_2']) - { - update_option('profiling_user_permission_2',$_REQUEST['profiling_user_permission_2']); - $ok = true; - } - - if ($_REQUEST['override_disable_auto_save']) - { - update_option('override_disable_auto_save',$_REQUEST['override_disable_auto_save']); - $ok = true; - } - - if ($_REQUEST['override_disable_revisioning']) - { - update_option('override_disable_revisioning',$_REQUEST['override_disable_revisioning']); - $ok = true; - } - - if ($ok) - { - echo '<div id="message" class="updated fade"> - <p>Options saved.</p> - </div>'; - } - else - { - echo '<div id="message" class="error fade"> - <p>Failed to save options.</p> - </div>'; - } - -} - -function print_profiling_form() { - - $true_selected = ''; - $false_selected = ''; - - if (get_option('always_show_profiling') == "yes") - $true_selected = ' selected="selected"'; - else - $false_selected = ' selected="selected"'; - - if (get_option('allow_get_request') == "yes") - $get_true_selected = ' selected="selected"'; - else - $get_false_selected = ' selected="selected"'; - - if (get_option('profiling_user_permission_1') == "1") - $perm_1_1_selected = ' selected="selected"'; - elseif (get_option('profiling_user_permission_1') == "2,3,4") - $perm_1_2_selected = ' selected="selected"'; - elseif (get_option('profiling_user_permission_1') == "5,6,7") - $perm_1_3_selected = ' selected="selected"'; - elseif (get_option('profiling_user_permission_1') == "8,9,10") - $perm_1_4_selected = ' selected="selected"'; - - if (get_option('profiling_user_permission_2') == "1") - $perm_2_1_selected = ' selected="selected"'; - elseif (get_option('profiling_user_permission_2') == "2,3,4") - $perm_2_2_selected = ' selected="selected"'; - elseif (get_option('profiling_user_permission_2') == "5,6,7") - $perm_2_3_selected = ' selected="selected"'; - elseif (get_option('profiling_user_permission_2') == "8,9,10") - $perm_2_4_selected = ' selected="selected"'; - - if (get_option('override_disable_auto_save') == "yes") - $true_autosave_selected = ' selected="selected"'; - else - $false_autosave_selected = ' selected="selected"'; - - if (get_option('override_disable_revisioning') == "yes") - $true_revision_selected = ' selected="selected"'; - else - $false_revision_selected = ' selected="selected"'; - - print ' - - <div class="wrap"> - - <div id="icon-options-general" class="icon32"><img src="http://tierra-innovation.com/wordpress-cms/logos/src/wpdb-profiling/1.3.2/default.gif" alt="" title="" /><br /></div> - - <h2>WPDB Profiling & Optimization</h2> - - '; - - if ( defined('WP_CACHE') ) { - $style = "green"; - $cached = "<strong>Good!</strong> WP_CACHE is defined."; - } - else { - $style = "red"; - $cached = "<strong>Uh Oh!</strong> You'll need to enable and install a caching tool (<a href='http://wordpress.org/extend/plugins/batcache/' title='Batcache' target='_blank'>Batcache</a>) or (<a href='http://wordpress.org/extend/plugins/wp-super-cache/' title='WP_Super_Cache' target='_blank'>WP_Super_Cache</a>) for DB Optimization."; - } - - if ( defined('SAVEQUERIES') ) { - $stylesaved = "green"; - $saved = "<strong>Good!</strong> SAVEQUERIES is defined in wp-config.php"; - } - else { - $stylesaved = "red"; - $saved = "<strong>Uh Oh!</strong> Please add `define('SAVEQUERIES', true);` to your wp-config.php file."; - } - - print " - - <h3>Plugin Check</h3> - - <ul> - <li><span style='color: $style'>$cached</span><br /> - <span style='color: $stylesaved'>$saved</span></li> - </ul> - - "; - - print " - - <style type='text/css'> - select.wpdb { width: 120px; } - </style> - - <form method='post'> - - <h3>Database Profiling</h3> - - <ul> - <li> - <select class='wpdb' name='always_show_profiling'> - <option value='yes' $true_selected>Always</option> - <option value='no' $false_selected>Never</option> - </select> - - <label for='always_show_profiling'>automatically show profiling when logged in as </label> - - <select class='wpdb' name='profiling_user_permission_1'> - <option value='8,9,10' $perm_1_4_selected>Administrator</option> - <option value='5,6,7' $perm_1_3_selected>Editor</option> - <option value='2,3,4' $perm_1_2_selected>Author</option> - <option value='1' $perm_1_1_selected>Contributor</option> - </select> - </li> - - <li> - <select class='wpdb' name='allow_get_request'> - <option value='yes' $get_true_selected>Enable</option> - <option value='no' $get_false_selected>Disabled</option> - </select> - - <label for='allow_get_request'>the `?show_queries=yes` parameter in URL for user level</label> - - <select class='wpdb' name='profiling_user_permission_2'> - <option value='8,9,10' $perm_2_4_selected>Administrator</option> - <option value='5,6,7' $perm_2_3_selected>Editor</option> - <option value='2,3,4' $perm_2_2_selected>Author</option> - <option value='1' $perm_2_1_selected>Contributor</option> - </select> - </li> - </ul> - - <p><strong>Note:</strong> Select the lowest user permission level that should have access to profiling. The level you select and all higher levels will have access.</p> - - <h3>Database Optimization</h3> - - <ul> - <li> - <select class='wpdb' name='override_disable_auto_save'> - <option value='yes' $true_autosave_selected>Yes</option> - <option value='no' $false_autosave_selected>No</option> - </select> - - <label for='override_disable_auto_save'>Disable Auto Saving</label> - </li> - <li> - <select class='wpdb' name='override_disable_revisioning'> - <option value='yes' $true_revision_selected>Yes</option> - <option value='no' $false_revision_selected>No</option> - </select> - - <label for='override_disable_revisioning'>Disable Post Revisions</label> - </li> - </ul> - - <p><input type='submit' name='submit' class='button-primary' value='Save Options' /></p> - - </form> - - </div> - - "; - -} - -if (get_option('always_show_profiling') == "yes") { - - add_action('wp_head', 'wpdb_profiling_head',1); - add_action('admin_head', 'wpdb_profiling_head',1); - add_action('wp_footer', 'wpdb_profiling', 1000); - add_action('admin_footer', 'wpdb_profiling', 1000); - -} - -if ( get_option('override_disable_auto_save') == "yes" ) { - - function wpdb_disable_autosave() { - wp_deregister_script('autosave'); - } - - add_action( 'wp_print_scripts', 'wpdb_disable_autosave' ); - -} - -if ( get_option('override_disable_revisioning') == "yes" ) { - - define('WP_POST_REVISIONS', false); - -} - -function modify_menu() { - add_options_page( - 'WPDB Profiling', // page title - 'WPDB Profiling', // sub-menu title - 'manage_options', // access/capa - 'wpdb-profiling.php', // file - 'admin_profiling_options' // function - ); -} - -add_action('admin_menu', 'modify_menu'); - -register_activation_hook(__FILE__,'set_wpdb_profiling_options'); -register_deactivation_hook(__FILE__,'unset_wpdb_profiling_options'); -?> \ No newline at end of file -- GitLab