mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-11 20:30:23 +00:00
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: https://develop.svn.wordpress.org/trunk@19935 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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.
|
||||
|
||||
+56
-13
@@ -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()' );
|
||||
}
|
||||
@@ -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 ) . '%') );
|
||||
|
||||
Reference in New Issue
Block a user