Skip to content

Commit

Permalink
Deprecate ancient "debugging" tools.
Browse files Browse the repository at this point in the history
 * logIO() and the global $xmlrpc_logging in XML-RPC.
 * log_app() and the global $app_logging in APP.
 * debug_fwrite(), debug_fopen(), debug_fclose(), and $debug.
see #20051.



git-svn-id: http://svn.automattic.com/wordpress/trunk@19935 1a063a9b-81f0-0310-95a4-ce76da25c4cd
  • Loading branch information
nacin committed Feb 17, 2012
1 parent af2eb34 commit aefde50
Show file tree
Hide file tree
Showing 8 changed files with 82 additions and 229 deletions.
3 changes: 1 addition & 2 deletions wp-admin/includes/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -1359,9 +1359,8 @@ function add_clean_index($table, $index) {
** false on error
*/
function maybe_add_column($table_name, $column_name, $create_ddl) {
global $wpdb, $debug;
global $wpdb;
foreach ($wpdb->get_col("DESC $table_name", 0) as $column ) {
if ($debug) echo("checking $column == $column_name<br />");
if ($column == $column_name) {
return true;
}
Expand Down
21 changes: 2 additions & 19 deletions wp-admin/install-helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@
* needing to use these functions a lot, you might experience time outs. If you
* do, then it is advised to just write the SQL code yourself.
*
* You can turn debugging on, by setting $debug to 1 after you include this
* file.
*
* <code>
* check_column('wp_links', 'link_description', 'mediumtext');
* if (check_column($wpdb->comments, 'comment_author', 'tinytext'))
Expand Down Expand Up @@ -41,15 +38,6 @@
/** Load WordPress Bootstrap */
require_once(dirname(dirname(__FILE__)).'/wp-load.php');

/**
* Turn debugging on or off.
* @global bool|int $debug
* @name $debug
* @var bool|int
* @since 1.0.0
*/
$debug = 0;

if ( ! function_exists('maybe_create_table') ) :
/**
* Create database table, if it doesn't already exist.
Expand Down Expand Up @@ -90,17 +78,15 @@ function maybe_create_table($table_name, $create_ddl) {
* @package WordPress
* @subpackage Plugin
* @uses $wpdb
* @uses $debug
*
* @param string $table_name Database table name
* @param string $column_name Table column name
* @param string $create_ddl SQL to add column to table.
* @return bool False on failure. True, if already exists or was successful.
*/
function maybe_add_column($table_name, $column_name, $create_ddl) {
global $wpdb, $debug;
global $wpdb;
foreach ($wpdb->get_col("DESC $table_name",0) as $column ) {
if ($debug) echo("checking $column == $column_name<br />");

if ($column == $column_name) {
return true;
Expand Down Expand Up @@ -179,16 +165,14 @@ function maybe_drop_column($table_name, $column_name, $drop_ddl) {
* @return bool True, if matches. False, if not matching.
*/
function check_column($table_name, $col_name, $col_type, $is_null = null, $key = null, $default = null, $extra = null) {
global $wpdb, $debug;
global $wpdb;
$diffs = 0;
$results = $wpdb->get_results("DESC $table_name");

foreach ($results as $row ) {
if ($debug > 1) print_r($row);

if ($row->Field == $col_name) {
// got our column, check the params
if ($debug) echo ("checking $row->Type against $col_type\n");
if (($col_type != null) && ($row->Type != $col_type)) {
++$diffs;
}
Expand All @@ -205,7 +189,6 @@ function check_column($table_name, $col_name, $col_type, $is_null = null, $key =
++$diffs;
}
if ($diffs > 0) {
if ($debug) echo ("diffs = $diffs returning false\n");
return false;
}
return true;
Expand Down
Loading

0 comments on commit aefde50

Please sign in to comment.