Deprecate ancient "debugging" tools.

* 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
This commit is contained in:
nacin 2012-02-17 00:02:42 +00:00
parent af2eb34f8a
commit aefde50081
8 changed files with 84 additions and 231 deletions

View File

@ -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;
}

View File

@ -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'))
@ -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.
@ -90,7 +78,6 @@ if ( ! function_exists('maybe_add_column') ) :
* @package WordPress
* @subpackage Plugin
* @uses $wpdb
* @uses $debug
*
* @param string $table_name Database table name
* @param string $column_name Table column name
@ -98,9 +85,8 @@ if ( ! function_exists('maybe_add_column') ) :
* @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;
@ -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;
}
@ -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;

View File

@ -23,14 +23,6 @@ require_once(ABSPATH . '/wp-admin/includes/image.php');
$_SERVER['PATH_INFO'] = preg_replace( '/.*\/wp-app\.php/', '', $_SERVER['REQUEST_URI'] );
/**
* Whether to enable Atom Publishing Protocol Logging.
*
* @name app_logging
* @var int|bool
*/
$app_logging = 0;
/**
* Whether to always authenticate user. Permanently set to true.
*
@ -44,21 +36,17 @@ $always_authenticate = 1;
* Writes logging info to a file.
*
* @since 2.2.0
* @uses $app_logging
* @package WordPress
* @subpackage Logging
* @deprecated 3.4.0
* @deprecated Use error_log()
* @link http://www.php.net/manual/en/function.error-log.php
*
* @param string $label Type of logging
* @param string $msg Information describing logging reason.
*/
function log_app($label,$msg) {
global $app_logging;
if ($app_logging) {
$fp = fopen( 'wp-app.log', 'a+');
$date = gmdate( 'Y-m-d H:i:s' );
fwrite($fp, "\n\n$date - $label\n$msg\n");
fclose($fp);
}
function log_app( $label, $msg ) {
_deprecated_function( __FUNCTION__, '3.4', 'error_log()' );
if ( ! empty( $GLOBALS['app_logging'] ) )
error_log( $label . ' - ' . $message );
}
/**
@ -268,8 +256,6 @@ class AtomServer {
$method = $_SERVER['REQUEST_METHOD'];
log_app('REQUEST',"$method $path\n================");
$this->process_conditionals();
//$this->process_conditionals();
@ -319,8 +305,6 @@ class AtomServer {
* @since 2.2.0
*/
function get_service() {
log_app('function','get_service()');
if ( !current_user_can( 'edit_posts' ) )
$this->auth_required( __( 'Sorry, you do not have the right to access this site.' ) );
@ -360,8 +344,6 @@ EOD;
* @since 2.2.0
*/
function get_categories_xml() {
log_app('function','get_categories_xml()');
if ( !current_user_can( 'edit_posts' ) )
$this->auth_required( __( 'Sorry, you do not have the right to access this site.' ) );
@ -397,8 +379,6 @@ EOD;
$entry = array_pop($parser->feed->entries);
log_app('Received entry:', print_r($entry,true));
$catnames = array();
if ( !empty( $entry->categories ) ) {
foreach ( $entry->categories as $cat ) {
@ -451,7 +431,6 @@ EOD;
$post_data = compact('blog_ID', 'post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_title', 'post_category', 'post_status', 'post_excerpt', 'post_name');
$this->escape($post_data);
log_app('Inserting Post. Data:', print_r($post_data,true));
$postID = wp_insert_post($post_data);
if ( is_wp_error( $postID ) )
@ -470,7 +449,6 @@ EOD;
$output = $this->get_entry($postID);
log_app('function',"create_post($postID)");
$this->created($postID, $output);
}
@ -489,7 +467,6 @@ EOD;
$this->set_current_entry($postID);
$output = $this->get_entry($postID);
log_app('function',"get_post($postID)");
$this->output($output);
}
@ -512,8 +489,6 @@ EOD;
$parsed = array_pop($parser->feed->entries);
log_app('Received UPDATED entry:', print_r($parsed,true));
// check for not found
global $entry;
$this->set_current_entry($postID);
@ -546,7 +521,6 @@ EOD;
do_action( 'atompub_put_post', $ID, $parsed );
log_app('function',"put_post($postID)");
$this->ok();
}
@ -575,7 +549,6 @@ EOD;
$this->internal_error(__('For some strange yet very annoying reason, this post could not be deleted.'));
}
log_app('function',"delete_post($postID)");
$this->ok();
}
@ -597,7 +570,6 @@ EOD;
} else {
$this->set_current_entry($postID);
$output = $this->get_entry($postID, 'attachment');
log_app('function',"get_attachment($postID)");
$this->output($output);
}
}
@ -632,8 +604,6 @@ EOD;
$slug = sanitize_file_name( "$slug.$ext" );
$file = wp_upload_bits( $slug, null, $bits);
log_app('wp_upload_bits returns:',print_r($file,true));
$url = $file['url'];
$file = $file['file'];
@ -658,7 +628,6 @@ EOD;
$output = $this->get_entry($postID, 'attachment');
$this->created($postID, $output, 'attachment');
log_app('function',"create_attachment($postID)");
}
/**
@ -703,7 +672,6 @@ EOD;
if ( !$result )
$this->internal_error(__('For some strange yet very annoying reason, this post could not be edited.'));
log_app('function',"put_attachment($postID)");
$this->ok();
}
@ -715,8 +683,6 @@ EOD;
* @param int $postID Post ID.
*/
function delete_attachment($postID) {
log_app('function',"delete_attachment($postID). File '$location' deleted.");
// check for not found
global $entry;
$this->set_current_entry($postID);
@ -739,7 +705,6 @@ EOD;
if ( !$result )
$this->internal_error(__('For some strange yet very annoying reason, this post could not be deleted.'));
log_app('function',"delete_attachment($postID). File '$location' deleted.");
$this->ok();
}
@ -785,7 +750,6 @@ EOD;
status_header ('404');
}
log_app('function',"get_file($postID)");
exit;
}
@ -843,7 +807,6 @@ EOD;
wp_update_attachment_metadata( $postID, wp_generate_attachment_metadata( $postID, $location ) );
log_app('function',"put_file($postID)");
$this->ok();
}
@ -954,7 +917,6 @@ EOD;
$url = $this->app_base . $this->ENTRY_PATH . "/$postID";
log_app('function',"get_entry_url() = $url");
return $url;
}
@ -985,7 +947,6 @@ EOD;
$url = $this->app_base . $this->MEDIA_SINGLE_PATH ."/file/$postID";
log_app('function',"get_media_url() = $url");
return $url;
}
@ -1009,7 +970,6 @@ EOD;
*/
function set_current_entry($postID) {
global $entry;
log_app('function',"set_current_entry($postID)");
if (!isset($postID)) {
// $this->bad_request();
@ -1033,7 +993,6 @@ EOD;
* @param string $post_type Optional, default is 'post'. Post Type.
*/
function get_posts($page = 1, $post_type = 'post') {
log_app('function',"get_posts($page, '$post_type')");
$feed = $this->get_feed($page, $post_type);
$this->output($feed);
}
@ -1047,7 +1006,6 @@ EOD;
* @param string $post_type Optional, default is 'attachment'. Post type.
*/
function get_attachments($page = 1, $post_type = 'attachment') {
log_app('function',"get_attachments($page, '$post_type')");
$GLOBALS['post_type'] = $post_type;
$feed = $this->get_feed($page, $post_type);
$this->output($feed);
@ -1064,7 +1022,6 @@ EOD;
*/
function get_feed($page = 1, $post_type = 'post') {
global $post, $wp, $wp_query, $posts, $wpdb, $blog_id;
log_app('function',"get_feed($page, '$post_type')");
ob_start();
$this->ENTRY_PATH = $post_type;
@ -1084,9 +1041,7 @@ EOD;
$wp_query = $GLOBALS['wp_query'];
$wpdb = $GLOBALS['wpdb'];
$blog_id = (int) $GLOBALS['blog_id'];
log_app('function',"query_posts(# " . print_r($wp_query, true) . "#)");
log_app('function',"total_count(# $wp_query->max_num_pages #)");
$last_page = $wp_query->max_num_pages;
$next_page = (($page + 1) > $last_page) ? null : $page + 1;
$prev_page = ($page - 1) < 1 ? null : $page - 1;
@ -1131,7 +1086,6 @@ EOD;
* @return string.
*/
function get_entry($postID, $post_type = 'post') {
log_app('function',"get_entry($postID, '$post_type')");
ob_start();
switch($post_type) {
case 'post':
@ -1147,14 +1101,12 @@ EOD;
while ( have_posts() ) {
the_post();
$this->echo_entry();
log_app('$post',print_r($GLOBALS['post'],true));
$entry = ob_get_contents();
break;
}
}
ob_end_clean();
log_app('get_entry returning:',$entry);
return $entry;
}
@ -1205,7 +1157,6 @@ list($content_type, $content) = prep_atom_text_construct(get_the_content()); ?>
* @since 2.2.0
*/
function ok() {
log_app('Status','200: OK');
header('Content-Type: text/plain');
status_header('200');
exit;
@ -1217,7 +1168,6 @@ list($content_type, $content) = prep_atom_text_construct(get_the_content()); ?>
* @since 2.2.0
*/
function no_content() {
log_app('Status','204: No Content');
header('Content-Type: text/plain');
status_header('204');
echo "Moved to Trash.";
@ -1232,7 +1182,6 @@ list($content_type, $content) = prep_atom_text_construct(get_the_content()); ?>
* @param string $msg Optional. Status string.
*/
function internal_error($msg = 'Internal Server Error') {
log_app('Status','500: Server Error');
header('Content-Type: text/plain');
status_header('500');
echo $msg;
@ -1245,7 +1194,6 @@ list($content_type, $content) = prep_atom_text_construct(get_the_content()); ?>
* @since 2.2.0
*/
function bad_request() {
log_app('Status','400: Bad Request');
header('Content-Type: text/plain');
status_header('400');
exit;
@ -1257,7 +1205,6 @@ list($content_type, $content) = prep_atom_text_construct(get_the_content()); ?>
* @since 2.2.0
*/
function length_required() {
log_app('Status','411: Length Required');
header("HTTP/1.1 411 Length Required");
header('Content-Type: text/plain');
status_header('411');
@ -1270,7 +1217,6 @@ list($content_type, $content) = prep_atom_text_construct(get_the_content()); ?>
* @since 2.2.0
*/
function invalid_media() {
log_app('Status','415: Unsupported Media Type');
header("HTTP/1.1 415 Unsupported Media Type");
header('Content-Type: text/plain');
exit;
@ -1282,7 +1228,6 @@ list($content_type, $content) = prep_atom_text_construct(get_the_content()); ?>
* @since 2.6.0
*/
function forbidden($reason='') {
log_app('Status','403: Forbidden');
header('Content-Type: text/plain');
status_header('403');
echo $reason;
@ -1295,7 +1240,6 @@ list($content_type, $content) = prep_atom_text_construct(get_the_content()); ?>
* @since 2.2.0
*/
function not_found() {
log_app('Status','404: Not Found');
header('Content-Type: text/plain');
status_header('404');
exit;
@ -1307,7 +1251,6 @@ list($content_type, $content) = prep_atom_text_construct(get_the_content()); ?>
* @since 2.2.0
*/
function not_allowed($allow) {
log_app('Status','405: Not Allowed');
header('Allow: ' . join(',', $allow));
status_header('405');
exit;
@ -1319,8 +1262,6 @@ list($content_type, $content) = prep_atom_text_construct(get_the_content()); ?>
* @since 2.3.0
*/
function redirect($url) {
log_app('Status','302: Redirect');
$escaped_url = esc_attr($url);
$content = <<<EOD
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
@ -1349,7 +1290,6 @@ EOD;
* @since 2.2.0
*/
function client_error($msg = 'Client Error') {
log_app('Status','400: Client Error');
header('Content-Type: text/plain');
status_header('400');
exit;
@ -1363,7 +1303,6 @@ EOD;
* @since 2.2.0
*/
function created($post_ID, $content, $post_type = 'post') {
log_app('created()::$post_ID',"$post_ID, $post_type");
$edit = $this->get_entry_url($post_ID);
switch($post_type) {
case 'post':
@ -1390,7 +1329,6 @@ EOD;
* @param string $msg Status header content and HTML content.
*/
function auth_required($msg) {
log_app('Status','401: Auth Required');
nocache_headers();
header('WWW-Authenticate: Basic realm="WordPress Atom Protocol"');
header("HTTP/1.1 401 $msg");
@ -1431,7 +1369,6 @@ EOD;
header('Date: '. date('r'));
if ($this->do_output)
echo $xml;
log_app('function', "output:\n$xml");
exit;
}
@ -1464,8 +1401,6 @@ EOD;
* @return bool
*/
function authenticate() {
log_app("authenticate()",print_r($_ENV, true));
// if using mod_rewrite/ENV hack
// http://www.besthostratings.com/articles/http-auth-php-cgi.html
if (isset($_SERVER['HTTP_AUTHORIZATION'])) {
@ -1480,12 +1415,9 @@ EOD;
// If Basic Auth is working...
if (isset($_SERVER['PHP_AUTH_USER']) && isset($_SERVER['PHP_AUTH_PW'])) {
log_app("Basic Auth",$_SERVER['PHP_AUTH_USER']);
$user = wp_authenticate($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']);
if ( $user && !is_wp_error($user) ) {
wp_set_current_user($user->ID);
log_app("authenticate()", $user->user_login);
return true;
}
}
@ -1514,7 +1446,6 @@ EOD;
$type = $_SERVER['CONTENT_TYPE'];
list($type,$subtype) = explode('/',$type);
list($subtype) = explode(";",$subtype); // strip MIME parameters
log_app("get_accepted_content_type", "type=$type, subtype=$subtype");
foreach($types as $t) {
list($acceptedType,$acceptedSubtype) = explode('/',$t);

View File

@ -2700,8 +2700,6 @@ class wp_xmlrpc_server extends IXR_Server {
$this->attach_uploads( $post_ID, $post_content );
logIO('O', "Posted ! ID: $post_ID");
return $post_ID;
}
@ -3046,7 +3044,6 @@ class wp_xmlrpc_server extends IXR_Server {
$post_category = array();
if ( isset( $content_struct['categories'] ) ) {
$catnames = $content_struct['categories'];
logIO('O', 'Post cats: ' . var_export($catnames,true));
if ( is_array($catnames) ) {
foreach ($catnames as $cat) {
@ -3088,8 +3085,6 @@ class wp_xmlrpc_server extends IXR_Server {
if ( !$post_ID )
return new IXR_Error(500, __('Sorry, your entry could not be posted. Something wrong happened.'));
logIO('O', "Posted ! ID: $post_ID");
return strval($post_ID);
}
@ -3381,8 +3376,6 @@ class wp_xmlrpc_server extends IXR_Server {
if ( isset( $content_struct['wp_post_format'] ) )
wp_set_post_terms( $post_ID, array( 'post-format-' . $content_struct['wp_post_format'] ), 'post_format' );
logIO('O',"(MW) Edited ! ID: $post_ID");
return true;
}
@ -3695,15 +3688,12 @@ class wp_xmlrpc_server extends IXR_Server {
$type = $data['type'];
$bits = $data['bits'];
logIO('O', '(MW) Received '.strlen($bits).' bytes');
if ( !$user = $this->login($username, $password) )
return $this->error;
do_action('xmlrpc_call', 'metaWeblog.newMediaObject');
if ( !current_user_can('upload_files') ) {
logIO('O', '(MW) User does not have upload_files capability');
$this->error = new IXR_Error(401, __('You are not allowed to upload files to this site.'));
return $this->error;
}
@ -3732,7 +3722,6 @@ class wp_xmlrpc_server extends IXR_Server {
$upload = wp_upload_bits($name, null, $bits);
if ( ! empty($upload['error']) ) {
$errorString = sprintf(__('Could not write file %1$s (%2$s)'), $name, $upload['error']);
logIO('O', '(MW) ' . $errorString);
return new IXR_Error(500, $errorString);
}
// Construct the attachment array
@ -4119,8 +4108,6 @@ class wp_xmlrpc_server extends IXR_Server {
}
$post_ID = (int) $post_ID;
logIO("O","(PB) URL='$pagelinkedto' ID='$post_ID' Found='$way'");
$post = get_post($post_ID);
if ( !$post ) // Post_ID not found

View File

@ -15,7 +15,7 @@ class WP {
* @access public
* @var array
*/
var $public_query_vars = array('m', 'p', 'posts', 'w', 'cat', 'withcomments', 'withoutcomments', 's', 'search', 'exact', 'sentence', 'debug', 'calendar', 'page', 'paged', 'more', 'tb', 'pb', 'author', 'order', 'orderby', 'year', 'monthnum', 'day', 'hour', 'minute', 'second', 'name', 'category_name', 'tag', 'feed', 'author_name', 'static', 'pagename', 'page_id', 'error', 'comments_popup', 'attachment', 'attachment_id', 'subpost', 'subpost_id', 'preview', 'robots', 'taxonomy', 'term', 'cpage', 'post_type');
var $public_query_vars = array('m', 'p', 'posts', 'w', 'cat', 'withcomments', 'withoutcomments', 's', 'search', 'exact', 'sentence', 'calendar', 'page', 'paged', 'more', 'tb', 'pb', 'author', 'order', 'orderby', 'year', 'monthnum', 'day', 'hour', 'minute', 'second', 'name', 'category_name', 'tag', 'feed', 'author_name', 'static', 'pagename', 'page_id', 'error', 'comments_popup', 'attachment', 'attachment_id', 'subpost', 'subpost_id', 'preview', 'robots', 'taxonomy', 'term', 'cpage', 'post_type');
/**
* Private query variables.

View File

@ -2564,7 +2564,7 @@ function is_term( $term, $taxonomy = '', $parent = 0 ) {
* Is the current admin page generated by a plugin?
*
* @since 1.5.0
* @deprecated 3.1
* @deprecated 3.1.0
* @deprecated Use global $plugin_page and/or get_plugin_page_hookname() hooks.
*
* @global $plugin_page
@ -2590,7 +2590,7 @@ function is_plugin_page() {
* for updating the category cache.
*
* @since 1.5.0
* @deprecated 3.1
* @deprecated 3.1.0
*
* @return bool Always return True
*/
@ -2604,7 +2604,7 @@ function update_category_cache() {
* Check for PHP timezone support
*
* @since 2.9.0
* @deprecated 3.2
* @deprecated 3.2.0
*
* @return bool
*/
@ -2618,7 +2618,9 @@ function wp_timezone_supported() {
* Display editor: TinyMCE, HTML, or both.
*
* @since 2.1.0
* @deprecated 3.3
* @deprecated 3.3.0
* @deprecated Use wp_editor()
* @see wp_editor()
*
* @param string $content Textarea content.
* @param string $id Optional, default is 'content'. HTML ID attribute value.
@ -2627,6 +2629,7 @@ function wp_timezone_supported() {
* @param int $tab_index Optional, not used
*/
function the_editor($content, $id = 'content', $prev_id = 'title', $media_buttons = true, $tab_index = 2, $extended = true) {
_deprecated_function( __FUNCTION__, '3.3', 'wp_editor()' );
wp_editor( $content, $id, array( 'media_buttons' => $media_buttons ) );
return;
@ -2636,6 +2639,8 @@ function the_editor($content, $id = 'content', $prev_id = 'title', $media_button
* Perform the query to get the $metavalues array(s) needed by _fill_user and _fill_many_users
*
* @since 3.0.0
* @deprecated 3.3.0
*
* @param array $ids User ID numbers list.
* @return array of arrays. The array is indexed by user_id, containing $metavalues object arrays.
*/
@ -2668,7 +2673,6 @@ function get_user_metavalues($ids) {
*
* @since 2.3.0
* @deprecated 3.3.0
* @uses sanitize_user_field() Used to sanitize the fields.
*
* @param object|array $user The User Object or Array
* @param string $context Optional, default is 'display'. How to sanitize user fields.
@ -2705,7 +2709,7 @@ function sanitize_user_object($user, $context = 'display') {
* Can either be start or end post relational link.
*
* @since 2.8.0
* @deprecated 3.3
* @deprecated 3.3.0
*
* @param string $title Optional. Link title format.
* @param bool $in_same_cat Optional. Whether link should be in a same category.
@ -2745,7 +2749,7 @@ function get_boundary_post_rel_link($title = '%title', $in_same_cat = false, $ex
* Display relational link for the first post.
*
* @since 2.8.0
* @deprecated 3.3
* @deprecated 3.3.0
*
* @param string $title Optional. Link title format.
* @param bool $in_same_cat Optional. Whether link should be in a same category.
@ -2761,7 +2765,7 @@ function start_post_rel_link($title = '%title', $in_same_cat = false, $excluded_
* Get site index relational link.
*
* @since 2.8.0
* @deprecated 3.3
* @deprecated 3.3.0
*
* @return string
*/
@ -2776,7 +2780,7 @@ function get_index_rel_link() {
* Display relational link for the site index.
*
* @since 2.8.0
* @deprecated 3.3
* @deprecated 3.3.0
*/
function index_rel_link() {
_deprecated_function( __FUNCTION__, '3.3' );
@ -2788,7 +2792,7 @@ function index_rel_link() {
* Get parent post relational link.
*
* @since 2.8.0
* @deprecated 3.3
* @deprecated 3.3.0
*
* @param string $title Optional. Link title format.
* @return string
@ -2819,7 +2823,7 @@ function get_parent_post_rel_link($title = '%title') {
* Display relational link for parent item
*
* @since 2.8.0
* @deprecated 3.3
* @deprecated 3.3.0
*/
function parent_post_rel_link($title = '%title') {
_deprecated_function( __FUNCTION__, '3.3' );
@ -2831,7 +2835,7 @@ function parent_post_rel_link($title = '%title') {
* Add the "Dashboard"/"Visit Site" menu.
*
* @since 3.2.0
* @deprecated 3.3
* @deprecated 3.3.0
*/
function wp_admin_bar_dashboard_view_site_menu( $wp_admin_bar ) {
_deprecated_function( __FUNCTION__, '3.3' );
@ -2852,7 +2856,7 @@ function wp_admin_bar_dashboard_view_site_menu( $wp_admin_bar ) {
* Checks if the current user belong to a given blog.
*
* @since MU
* @deprecated 3.3
* @deprecated 3.3.0
* @deprecated Use is_user_member_of_blog()
* @see is_user_member_of_blog()
*
@ -2864,3 +2868,42 @@ function is_blog_user( $blog_id = 0 ) {
return is_user_member_of_blog( get_current_user_id(), $blog_id );
}
/**
* Open the file handle for debugging.
*
* @since 0.71
* @deprecated Use error_log()
* @link http://www.php.net/manual/en/function.error-log.php
* @deprecated 3.4.0
*/
function debug_fopen( $filename, $mode ) {
_deprecated_function( __FUNCTION__, 'error_log()' );
return false;
}
/**
* Write contents to the file used for debugging.
*
* @since 0.71
* @deprecated Use error_log() instead.
* @link http://www.php.net/manual/en/function.error-log.php
* @deprecated 3.4.0
*/
function debug_fwrite( $fp, $string ) {
_deprecated_function( __FUNCTION__, 'error_log()' );
if ( ! empty( $GLOBALS['debug'] ) )
error_log( $string );
}
/**
* Close the debugging file handle.
*
* @since 0.71
* @deprecated Use error_log()
* @link http://www.php.net/manual/en/function.error-log.php
* @deprecated 3.4.0
*/
function debug_fclose( $fp ) {
_deprecated_function( __FUNCTION__, 'error_log()' );
}

View File

@ -394,71 +394,6 @@ function xmlrpc_removepostdata( $content ) {
return $content;
}
/**
* Open the file handle for debugging.
*
* This function is used for XMLRPC feature, but it is general purpose enough
* to be used in anywhere.
*
* @see fopen() for mode options.
* @package WordPress
* @subpackage Debug
* @since 0.71
* @uses $debug Used for whether debugging is enabled.
*
* @param string $filename File path to debug file.
* @param string $mode Same as fopen() mode parameter.
* @return bool|resource File handle. False on failure.
*/
function debug_fopen( $filename, $mode ) {
global $debug;
if ( 1 == $debug ) {
$fp = fopen( $filename, $mode );
return $fp;
} else {
return false;
}
}
/**
* Write contents to the file used for debugging.
*
* Technically, this can be used to write to any file handle when the global
* $debug is set to 1 or true.
*
* @package WordPress
* @subpackage Debug
* @since 0.71
* @uses $debug Used for whether debugging is enabled.
*
* @param resource $fp File handle for debugging file.
* @param string $string Content to write to debug file.
*/
function debug_fwrite( $fp, $string ) {
global $debug;
if ( 1 == $debug )
fwrite( $fp, $string );
}
/**
* Close the debugging file handle.
*
* Technically, this can be used to close any file handle when the global $debug
* is set to 1 or true.
*
* @package WordPress
* @subpackage Debug
* @since 0.71
* @uses $debug Used for whether debugging is enabled.
*
* @param resource $fp Debug File handle.
*/
function debug_fclose( $fp ) {
global $debug;
if ( 1 == $debug )
fclose( $fp );
}
/**
* Check content for video and audio links to add as enclosures.
*
@ -480,9 +415,7 @@ function do_enclose( $content, $post_ID ) {
//TODO: Tidy this ghetto code up and make the debug code optional
include_once( ABSPATH . WPINC . '/class-IXR.php' );
$log = debug_fopen( ABSPATH . 'enclosures.log', 'a' );
$post_links = array();
debug_fwrite( $log, 'BEGIN ' . date( 'YmdHis', time() ) . "\n" );
$pung = get_enclosed( $post_ID );
@ -493,9 +426,6 @@ function do_enclose( $content, $post_ID ) {
preg_match_all( "{\b http : [$any] +? (?= [$punc] * [^$any] | $)}x", $content, $post_links_temp );
debug_fwrite( $log, 'Post contents:' );
debug_fwrite( $log, $content . "\n" );
foreach ( $pung as $link_test ) {
if ( !in_array( $link_test, $post_links_temp[0] ) ) { // link no longer in post
$mid = $wpdb->get_col( $wpdb->prepare("SELECT meta_id FROM $wpdb->postmeta WHERE post_id = %d AND meta_key = 'enclosure' AND meta_value LIKE (%s)", $post_ID, like_escape( $link_test ) . '%') );

View File

@ -54,9 +54,6 @@ include_once(ABSPATH . 'wp-admin/includes/admin.php');
include_once(ABSPATH . WPINC . '/class-IXR.php');
include_once(ABSPATH . WPINC . '/class-wp-xmlrpc-server.php');
// Turn off all warnings and errors.
// error_reporting(0);
/**
* Posts submitted via the xmlrpc interface get that title
* @name post_default_title
@ -64,43 +61,26 @@ include_once(ABSPATH . WPINC . '/class-wp-xmlrpc-server.php');
*/
$post_default_title = "";
/**
* Whether to enable XMLRPC Logging.
*
* @name xmlrpc_logging
* @var int|bool
*/
$xmlrpc_logging = 0;
/**
* logIO() - Writes logging info to a file.
*
* @uses $xmlrpc_logging
* @package WordPress
* @subpackage Logging
*
* @param string $io Whether input or output
* @param string $msg Information describing logging reason.
* @return bool Always return true
*/
function logIO($io,$msg) {
global $xmlrpc_logging;
if ($xmlrpc_logging) {
$fp = fopen("../xmlrpc.log","a+");
$date = gmdate("Y-m-d H:i:s ");
$iot = ($io == "I") ? " Input: " : " Output: ";
fwrite($fp, "\n\n".$date.$iot.$msg);
fclose($fp);
}
return true;
}
if ( isset($HTTP_RAW_POST_DATA) )
logIO("I", $HTTP_RAW_POST_DATA);
// Allow for a plugin to insert a different class to handle requests.
$wp_xmlrpc_server_class = apply_filters('wp_xmlrpc_server_class', 'wp_xmlrpc_server');
$wp_xmlrpc_server = new $wp_xmlrpc_server_class;
// Fire off the request
$wp_xmlrpc_server->serve_request();
exit;
/**
* logIO() - Writes logging info to a file.
*
* @deprecated 3.4.0
* @deprecated Use error_log()
*
* @param string $io Whether input or output
* @param string $msg Information describing logging reason.
*/
function logIO( $io, $msg ) {
_deprecated_function( __FUNCTION__, '3.4', 'error_log()' );
if ( ! empty( $GLOBALS['xmlrpc_logging'] ) )
error_log( $io . ' - ' . $msg );
}