WordPress.org

Make WordPress Core

Changeset 19935


Ignore:
Timestamp:
02/17/2012 12:02:42 AM (6 years ago)
Author:
nacin
Message:

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.

Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/upgrade.php

    r19799 r19935  
    13601360 */
    13611361function maybe_add_column($table_name, $column_name, $create_ddl) {
    1362     global $wpdb, $debug;
     1362    global $wpdb;
    13631363    foreach ($wpdb->get_col("DESC $table_name", 0) as $column ) {
    1364         if ($debug) echo("checking $column == $column_name<br />");
    13651364        if ($column == $column_name) {
    13661365            return true;
  • trunk/wp-admin/install-helper.php

    r19712 r19935  
    1010 * needing to use these functions a lot, you might experience time outs. If you
    1111 * do, then it is advised to just write the SQL code yourself.
    12  *
    13  * You can turn debugging on, by setting $debug to 1 after you include this
    14  * file.
    1512 *
    1613 * <code>
     
    4138/** Load WordPress Bootstrap */
    4239require_once(dirname(dirname(__FILE__)).'/wp-load.php');
    43 
    44 /**
    45  * Turn debugging on or off.
    46  * @global bool|int $debug
    47  * @name $debug
    48  * @var bool|int
    49  * @since 1.0.0
    50  */
    51 $debug = 0;
    5240
    5341if ( ! function_exists('maybe_create_table') ) :
     
    9179 * @subpackage Plugin
    9280 * @uses $wpdb
    93  * @uses $debug
    9481 *
    9582 * @param string $table_name Database table name
     
    9986 */
    10087function maybe_add_column($table_name, $column_name, $create_ddl) {
    101     global $wpdb, $debug;
     88    global $wpdb;
    10289    foreach ($wpdb->get_col("DESC $table_name",0) as $column ) {
    103         if ($debug) echo("checking $column == $column_name<br />");
    10490
    10591        if ($column == $column_name) {
     
    180166 */
    181167function check_column($table_name, $col_name, $col_type, $is_null = null, $key = null, $default = null, $extra = null) {
    182     global $wpdb, $debug;
     168    global $wpdb;
    183169    $diffs = 0;
    184170    $results = $wpdb->get_results("DESC $table_name");
    185171
    186172    foreach ($results as $row ) {
    187         if ($debug > 1) print_r($row);
    188173
    189174        if ($row->Field == $col_name) {
    190175            // got our column, check the params
    191             if ($debug) echo ("checking $row->Type against $col_type\n");
    192176            if (($col_type != null) && ($row->Type != $col_type)) {
    193177                ++$diffs;
     
    206190            }
    207191            if ($diffs > 0) {
    208                 if ($debug) echo ("diffs = $diffs returning false\n");
    209192                return false;
    210193            }
  • trunk/wp-app.php

    r19926 r19935  
    2323
    2424$_SERVER['PATH_INFO'] = preg_replace( '/.*\/wp-app\.php/', '', $_SERVER['REQUEST_URI'] );
    25 
    26 /**
    27  * Whether to enable Atom Publishing Protocol Logging.
    28  *
    29  * @name app_logging
    30  * @var int|bool
    31  */
    32 $app_logging = 0;
    3325
    3426/**
     
    4537 *
    4638 * @since 2.2.0
    47  * @uses $app_logging
    48  * @package WordPress
    49  * @subpackage Logging
     39 * @deprecated 3.4.0
     40 * @deprecated Use error_log()
     41 * @link http://www.php.net/manual/en/function.error-log.php
    5042 *
    5143 * @param string $label Type of logging
    5244 * @param string $msg Information describing logging reason.
    5345 */
    54 function log_app($label,$msg) {
    55     global $app_logging;
    56     if ($app_logging) {
    57         $fp = fopen( 'wp-app.log', 'a+');
    58         $date = gmdate( 'Y-m-d H:i:s' );
    59         fwrite($fp, "\n\n$date - $label\n$msg\n");
    60         fclose($fp);
    61     }
     46function log_app( $label, $msg ) {
     47    _deprecated_function( __FUNCTION__, '3.4', 'error_log()' );
     48    if ( ! empty( $GLOBALS['app_logging'] ) )
     49        error_log( $label . ' - ' . $message );
    6250}
    6351
     
    269257        $method = $_SERVER['REQUEST_METHOD'];
    270258
    271         log_app('REQUEST',"$method $path\n================");
    272 
    273259        $this->process_conditionals();
    274260        //$this->process_conditionals();
     
    320306     */
    321307    function get_service() {
    322         log_app('function','get_service()');
    323 
    324308        if ( !current_user_can( 'edit_posts' ) )
    325309            $this->auth_required( __( 'Sorry, you do not have the right to access this site.' ) );
     
    361345     */
    362346    function get_categories_xml() {
    363         log_app('function','get_categories_xml()');
    364 
    365347        if ( !current_user_can( 'edit_posts' ) )
    366348            $this->auth_required( __( 'Sorry, you do not have the right to access this site.' ) );
     
    397379
    398380        $entry = array_pop($parser->feed->entries);
    399 
    400         log_app('Received entry:', print_r($entry,true));
    401381
    402382        $catnames = array();
     
    452432
    453433        $this->escape($post_data);
    454         log_app('Inserting Post. Data:', print_r($post_data,true));
    455434
    456435        $postID = wp_insert_post($post_data);
     
    471450        $output = $this->get_entry($postID);
    472451
    473         log_app('function',"create_post($postID)");
    474452        $this->created($postID, $output);
    475453    }
     
    490468        $this->set_current_entry($postID);
    491469        $output = $this->get_entry($postID);
    492         log_app('function',"get_post($postID)");
    493470        $this->output($output);
    494471
     
    512489
    513490        $parsed = array_pop($parser->feed->entries);
    514 
    515         log_app('Received UPDATED entry:', print_r($parsed,true));
    516491
    517492        // check for not found
     
    547522        do_action( 'atompub_put_post', $ID, $parsed );
    548523
    549         log_app('function',"put_post($postID)");
    550524        $this->ok();
    551525    }
     
    576550            }
    577551
    578             log_app('function',"delete_post($postID)");
    579552            $this->ok();
    580553        }
     
    598571            $this->set_current_entry($postID);
    599572            $output = $this->get_entry($postID, 'attachment');
    600             log_app('function',"get_attachment($postID)");
    601573            $this->output($output);
    602574        }
     
    633605        $file = wp_upload_bits( $slug, null, $bits);
    634606
    635         log_app('wp_upload_bits returns:',print_r($file,true));
    636 
    637607        $url = $file['url'];
    638608        $file = $file['file'];
     
    659629
    660630        $this->created($postID, $output, 'attachment');
    661         log_app('function',"create_attachment($postID)");
    662631    }
    663632
     
    704673            $this->internal_error(__('For some strange yet very annoying reason, this post could not be edited.'));
    705674
    706         log_app('function',"put_attachment($postID)");
    707675        $this->ok();
    708676    }
     
    716684     */
    717685    function delete_attachment($postID) {
    718         log_app('function',"delete_attachment($postID). File '$location' deleted.");
    719 
    720686        // check for not found
    721687        global $entry;
     
    740706            $this->internal_error(__('For some strange yet very annoying reason, this post could not be deleted.'));
    741707
    742         log_app('function',"delete_attachment($postID). File '$location' deleted.");
    743708        $this->ok();
    744709    }
     
    786751        }
    787752
    788         log_app('function',"get_file($postID)");
    789753        exit;
    790754    }
     
    844808        wp_update_attachment_metadata( $postID, wp_generate_attachment_metadata( $postID, $location ) );
    845809
    846         log_app('function',"put_file($postID)");
    847810        $this->ok();
    848811    }
     
    955918        $url = $this->app_base . $this->ENTRY_PATH . "/$postID";
    956919
    957         log_app('function',"get_entry_url() = $url");
    958920        return $url;
    959921    }
     
    986948        $url = $this->app_base . $this->MEDIA_SINGLE_PATH ."/file/$postID";
    987949
    988         log_app('function',"get_media_url() = $url");
    989950        return $url;
    990951    }
     
    1010971    function set_current_entry($postID) {
    1011972        global $entry;
    1012         log_app('function',"set_current_entry($postID)");
    1013973
    1014974        if (!isset($postID)) {
     
    1034994     */
    1035995    function get_posts($page = 1, $post_type = 'post') {
    1036             log_app('function',"get_posts($page, '$post_type')");
    1037996            $feed = $this->get_feed($page, $post_type);
    1038997            $this->output($feed);
     
    10481007     */
    10491008    function get_attachments($page = 1, $post_type = 'attachment') {
    1050         log_app('function',"get_attachments($page, '$post_type')");
    10511009        $GLOBALS['post_type'] = $post_type;
    10521010        $feed = $this->get_feed($page, $post_type);
     
    10651023    function get_feed($page = 1, $post_type = 'post') {
    10661024        global $post, $wp, $wp_query, $posts, $wpdb, $blog_id;
    1067         log_app('function',"get_feed($page, '$post_type')");
    10681025        ob_start();
    10691026
     
    10851042        $wpdb = $GLOBALS['wpdb'];
    10861043        $blog_id = (int) $GLOBALS['blog_id'];
    1087         log_app('function',"query_posts(# " . print_r($wp_query, true) . "#)");
    1088 
    1089         log_app('function',"total_count(# $wp_query->max_num_pages #)");
     1044
    10901045        $last_page = $wp_query->max_num_pages;
    10911046        $next_page = (($page + 1) > $last_page) ? null : $page + 1;
     
    11321087     */
    11331088    function get_entry($postID, $post_type = 'post') {
    1134         log_app('function',"get_entry($postID, '$post_type')");
    11351089        ob_start();
    11361090        switch($post_type) {
     
    11481102                the_post();
    11491103                $this->echo_entry();
    1150                 log_app('$post',print_r($GLOBALS['post'],true));
    11511104                $entry = ob_get_contents();
    11521105                break;
     
    11551108        ob_end_clean();
    11561109
    1157         log_app('get_entry returning:',$entry);
    11581110        return $entry;
    11591111    }
     
    12061158     */
    12071159    function ok() {
    1208         log_app('Status','200: OK');
    12091160        header('Content-Type: text/plain');
    12101161        status_header('200');
     
    12181169     */
    12191170    function no_content() {
    1220         log_app('Status','204: No Content');
    12211171        header('Content-Type: text/plain');
    12221172        status_header('204');
     
    12331183     */
    12341184    function internal_error($msg = 'Internal Server Error') {
    1235         log_app('Status','500: Server Error');
    12361185        header('Content-Type: text/plain');
    12371186        status_header('500');
     
    12461195     */
    12471196    function bad_request() {
    1248         log_app('Status','400: Bad Request');
    12491197        header('Content-Type: text/plain');
    12501198        status_header('400');
     
    12581206     */
    12591207    function length_required() {
    1260         log_app('Status','411: Length Required');
    12611208        header("HTTP/1.1 411 Length Required");
    12621209        header('Content-Type: text/plain');
     
    12711218     */
    12721219    function invalid_media() {
    1273         log_app('Status','415: Unsupported Media Type');
    12741220        header("HTTP/1.1 415 Unsupported Media Type");
    12751221        header('Content-Type: text/plain');
     
    12831229     */
    12841230    function forbidden($reason='') {
    1285         log_app('Status','403: Forbidden');
    12861231        header('Content-Type: text/plain');
    12871232        status_header('403');
     
    12961241     */
    12971242    function not_found() {
    1298         log_app('Status','404: Not Found');
    12991243        header('Content-Type: text/plain');
    13001244        status_header('404');
     
    13081252     */
    13091253    function not_allowed($allow) {
    1310         log_app('Status','405: Not Allowed');
    13111254        header('Allow: ' . join(',', $allow));
    13121255        status_header('405');
     
    13201263     */
    13211264    function redirect($url) {
    1322 
    1323         log_app('Status','302: Redirect');
    13241265        $escaped_url = esc_attr($url);
    13251266        $content = <<<EOD
     
    13501291     */
    13511292    function client_error($msg = 'Client Error') {
    1352         log_app('Status','400: Client Error');
    13531293        header('Content-Type: text/plain');
    13541294        status_header('400');
     
    13641304     */
    13651305    function created($post_ID, $content, $post_type = 'post') {
    1366         log_app('created()::$post_ID',"$post_ID, $post_type");
    13671306        $edit = $this->get_entry_url($post_ID);
    13681307        switch($post_type) {
     
    13911330     */
    13921331    function auth_required($msg) {
    1393         log_app('Status','401: Auth Required');
    13941332        nocache_headers();
    13951333        header('WWW-Authenticate: Basic realm="WordPress Atom Protocol"');
     
    14321370            if ($this->do_output)
    14331371                echo $xml;
    1434             log_app('function', "output:\n$xml");
    14351372            exit;
    14361373    }
     
    14651402     */
    14661403    function authenticate() {
    1467         log_app("authenticate()",print_r($_ENV, true));
    1468 
    14691404        // if using mod_rewrite/ENV hack
    14701405        // http://www.besthostratings.com/articles/http-auth-php-cgi.html
     
    14811416        // If Basic Auth is working...
    14821417        if (isset($_SERVER['PHP_AUTH_USER']) && isset($_SERVER['PHP_AUTH_PW'])) {
    1483             log_app("Basic Auth",$_SERVER['PHP_AUTH_USER']);
    1484 
    14851418            $user = wp_authenticate($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']);
    14861419            if ( $user && !is_wp_error($user) ) {
    14871420                wp_set_current_user($user->ID);
    1488                 log_app("authenticate()", $user->user_login);
    14891421                return true;
    14901422            }
     
    15151447        list($type,$subtype) = explode('/',$type);
    15161448        list($subtype) = explode(";",$subtype); // strip MIME parameters
    1517         log_app("get_accepted_content_type", "type=$type, subtype=$subtype");
    15181449
    15191450        foreach($types as $t) {
  • trunk/wp-includes/class-wp-xmlrpc-server.php

    r19914 r19935  
    27012701        $this->attach_uploads( $post_ID, $post_content );
    27022702
    2703         logIO('O', "Posted ! ID: $post_ID");
    2704 
    27052703        return $post_ID;
    27062704    }
     
    30473045        if ( isset( $content_struct['categories'] ) ) {
    30483046            $catnames = $content_struct['categories'];
    3049             logIO('O', 'Post cats: ' . var_export($catnames,true));
    30503047
    30513048            if ( is_array($catnames) ) {
     
    30883085        if ( !$post_ID )
    30893086            return new IXR_Error(500, __('Sorry, your entry could not be posted. Something wrong happened.'));
    3090 
    3091         logIO('O', "Posted ! ID: $post_ID");
    30923087
    30933088        return strval($post_ID);
     
    33813376        if ( isset( $content_struct['wp_post_format'] ) )
    33823377            wp_set_post_terms( $post_ID, array( 'post-format-' . $content_struct['wp_post_format'] ), 'post_format' );
    3383 
    3384         logIO('O',"(MW) Edited ! ID: $post_ID");
    33853378
    33863379        return true;
     
    36963689        $bits = $data['bits'];
    36973690
    3698         logIO('O', '(MW) Received '.strlen($bits).' bytes');
    3699 
    37003691        if ( !$user = $this->login($username, $password) )
    37013692            return $this->error;
     
    37043695
    37053696        if ( !current_user_can('upload_files') ) {
    3706             logIO('O', '(MW) User does not have upload_files capability');
    37073697            $this->error = new IXR_Error(401, __('You are not allowed to upload files to this site.'));
    37083698            return $this->error;
     
    37333723        if ( ! empty($upload['error']) ) {
    37343724            $errorString = sprintf(__('Could not write file %1$s (%2$s)'), $name, $upload['error']);
    3735             logIO('O', '(MW) ' . $errorString);
    37363725            return new IXR_Error(500, $errorString);
    37373726        }
     
    41204109        $post_ID = (int) $post_ID;
    41214110
    4122         logIO("O","(PB) URL='$pagelinkedto' ID='$post_ID' Found='$way'");
    4123 
    41244111        $post = get_post($post_ID);
    41254112
  • trunk/wp-includes/class-wp.php

    r19892 r19935  
    1616     * @var array
    1717     */
    18     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');
     18    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');
    1919
    2020    /**
  • trunk/wp-includes/deprecated.php

    r19684 r19935  
    25652565 *
    25662566 * @since 1.5.0
    2567  * @deprecated 3.1
     2567 * @deprecated 3.1.0
    25682568 * @deprecated Use global $plugin_page and/or get_plugin_page_hookname() hooks.
    25692569 *
     
    25912591 *
    25922592 * @since 1.5.0
    2593  * @deprecated 3.1
     2593 * @deprecated 3.1.0
    25942594 *
    25952595 * @return bool Always return True
     
    26052605 *
    26062606 * @since 2.9.0
    2607  * @deprecated 3.2
     2607 * @deprecated 3.2.0
    26082608 *
    26092609 * @return bool
     
    26192619 *
    26202620 * @since 2.1.0
    2621  * @deprecated 3.3
     2621 * @deprecated 3.3.0
     2622 * @deprecated Use wp_editor()
     2623 * @see wp_editor()
    26222624 *
    26232625 * @param string $content Textarea content.
     
    26282630 */
    26292631function the_editor($content, $id = 'content', $prev_id = 'title', $media_buttons = true, $tab_index = 2, $extended = true) {
     2632    _deprecated_function( __FUNCTION__, '3.3', 'wp_editor()' );
    26302633
    26312634    wp_editor( $content, $id, array( 'media_buttons' => $media_buttons ) );
     
    26372640 *
    26382641 * @since 3.0.0
     2642 * @deprecated 3.3.0
     2643 *
    26392644 * @param array $ids User ID numbers list.
    26402645 * @return array of arrays. The array is indexed by user_id, containing $metavalues object arrays.
     
    26692674 * @since 2.3.0
    26702675 * @deprecated 3.3.0
    2671  * @uses sanitize_user_field() Used to sanitize the fields.
    26722676 *
    26732677 * @param object|array $user The User Object or Array
     
    27062710 *
    27072711 * @since 2.8.0
    2708  * @deprecated 3.3
     2712 * @deprecated 3.3.0
    27092713 *
    27102714 * @param string $title Optional. Link title format.
     
    27462750 *
    27472751 * @since 2.8.0
    2748  * @deprecated 3.3
     2752 * @deprecated 3.3.0
    27492753 *
    27502754 * @param string $title Optional. Link title format.
     
    27622766 *
    27632767 * @since 2.8.0
    2764  * @deprecated 3.3
     2768 * @deprecated 3.3.0
    27652769 *
    27662770 * @return string
     
    27772781 *
    27782782 * @since 2.8.0
    2779  * @deprecated 3.3
     2783 * @deprecated 3.3.0
    27802784 */
    27812785function index_rel_link() {
     
    27892793 *
    27902794 * @since 2.8.0
    2791  * @deprecated 3.3
     2795 * @deprecated 3.3.0
    27922796 *
    27932797 * @param string $title Optional. Link title format.
     
    28202824 *
    28212825 * @since 2.8.0
    2822  * @deprecated 3.3
     2826 * @deprecated 3.3.0
    28232827 */
    28242828function parent_post_rel_link($title = '%title') {
     
    28322836 *
    28332837 * @since 3.2.0
    2834  * @deprecated 3.3
     2838 * @deprecated 3.3.0
    28352839 */
    28362840function wp_admin_bar_dashboard_view_site_menu( $wp_admin_bar ) {
     
    28532857 *
    28542858 * @since MU
    2855  * @deprecated 3.3
     2859 * @deprecated 3.3.0
    28562860 * @deprecated Use is_user_member_of_blog()
    28572861 * @see is_user_member_of_blog()
     
    28652869    return is_user_member_of_blog( get_current_user_id(), $blog_id );
    28662870}
     2871
     2872/**
     2873 * Open the file handle for debugging.
     2874 *
     2875 * @since 0.71
     2876 * @deprecated Use error_log()
     2877 * @link http://www.php.net/manual/en/function.error-log.php
     2878 * @deprecated 3.4.0
     2879 */
     2880function debug_fopen( $filename, $mode ) {
     2881    _deprecated_function( __FUNCTION__, 'error_log()' );
     2882    return false;
     2883}
     2884
     2885/**
     2886 * Write contents to the file used for debugging.
     2887 *
     2888 * @since 0.71
     2889 * @deprecated Use error_log() instead.
     2890 * @link http://www.php.net/manual/en/function.error-log.php
     2891 * @deprecated 3.4.0
     2892 */
     2893function debug_fwrite( $fp, $string ) {
     2894    _deprecated_function( __FUNCTION__, 'error_log()' );
     2895    if ( ! empty( $GLOBALS['debug'] ) )
     2896        error_log( $string );
     2897}
     2898
     2899/**
     2900 * Close the debugging file handle.
     2901 *
     2902 * @since 0.71
     2903 * @deprecated Use error_log()
     2904 * @link http://www.php.net/manual/en/function.error-log.php
     2905 * @deprecated 3.4.0
     2906 */
     2907function debug_fclose( $fp ) {
     2908    _deprecated_function( __FUNCTION__, 'error_log()' );
     2909}
  • trunk/wp-includes/functions.php

    r19923 r19935  
    396396
    397397/**
    398  * Open the file handle for debugging.
    399  *
    400  * This function is used for XMLRPC feature, but it is general purpose enough
    401  * to be used in anywhere.
    402  *
    403  * @see fopen() for mode options.
    404  * @package WordPress
    405  * @subpackage Debug
    406  * @since 0.71
    407  * @uses $debug Used for whether debugging is enabled.
    408  *
    409  * @param string $filename File path to debug file.
    410  * @param string $mode Same as fopen() mode parameter.
    411  * @return bool|resource File handle. False on failure.
    412  */
    413 function debug_fopen( $filename, $mode ) {
    414     global $debug;
    415     if ( 1 == $debug ) {
    416         $fp = fopen( $filename, $mode );
    417         return $fp;
    418     } else {
    419         return false;
    420     }
    421 }
    422 
    423 /**
    424  * Write contents to the file used for debugging.
    425  *
    426  * Technically, this can be used to write to any file handle when the global
    427  * $debug is set to 1 or true.
    428  *
    429  * @package WordPress
    430  * @subpackage Debug
    431  * @since 0.71
    432  * @uses $debug Used for whether debugging is enabled.
    433  *
    434  * @param resource $fp File handle for debugging file.
    435  * @param string $string Content to write to debug file.
    436  */
    437 function debug_fwrite( $fp, $string ) {
    438     global $debug;
    439     if ( 1 == $debug )
    440         fwrite( $fp, $string );
    441 }
    442 
    443 /**
    444  * Close the debugging file handle.
    445  *
    446  * Technically, this can be used to close any file handle when the global $debug
    447  * is set to 1 or true.
    448  *
    449  * @package WordPress
    450  * @subpackage Debug
    451  * @since 0.71
    452  * @uses $debug Used for whether debugging is enabled.
    453  *
    454  * @param resource $fp Debug File handle.
    455  */
    456 function debug_fclose( $fp ) {
    457     global $debug;
    458     if ( 1 == $debug )
    459         fclose( $fp );
    460 }
    461 
    462 /**
    463398 * Check content for video and audio links to add as enclosures.
    464399 *
     
    481416    include_once( ABSPATH . WPINC . '/class-IXR.php' );
    482417
    483     $log = debug_fopen( ABSPATH . 'enclosures.log', 'a' );
    484418    $post_links = array();
    485     debug_fwrite( $log, 'BEGIN ' . date( 'YmdHis', time() ) . "\n" );
    486419
    487420    $pung = get_enclosed( $post_ID );
     
    493426
    494427    preg_match_all( "{\b http : [$any] +? (?= [$punc] * [^$any] | $)}x", $content, $post_links_temp );
    495 
    496     debug_fwrite( $log, 'Post contents:' );
    497     debug_fwrite( $log, $content . "\n" );
    498428
    499429    foreach ( $pung as $link_test ) {
  • trunk/xmlrpc.php

    r19801 r19935  
    5555include_once(ABSPATH . WPINC . '/class-wp-xmlrpc-server.php');
    5656
    57 // Turn off all warnings and errors.
    58 // error_reporting(0);
    59 
    6057/**
    6158 * Posts submitted via the xmlrpc interface get that title
     
    6562$post_default_title = "";
    6663
    67 /**
    68  * Whether to enable XMLRPC Logging.
    69  *
    70  * @name xmlrpc_logging
    71  * @var int|bool
    72  */
    73 $xmlrpc_logging = 0;
    74 
    75 /**
    76  * logIO() - Writes logging info to a file.
    77  *
    78  * @uses $xmlrpc_logging
    79  * @package WordPress
    80  * @subpackage Logging
    81  *
    82  * @param string $io Whether input or output
    83  * @param string $msg Information describing logging reason.
    84  * @return bool Always return true
    85  */
    86 function logIO($io,$msg) {
    87     global $xmlrpc_logging;
    88     if ($xmlrpc_logging) {
    89         $fp = fopen("../xmlrpc.log","a+");
    90         $date = gmdate("Y-m-d H:i:s ");
    91         $iot = ($io == "I") ? " Input: " : " Output: ";
    92         fwrite($fp, "\n\n".$date.$iot.$msg);
    93         fclose($fp);
    94     }
    95     return true;
    96 }
    97 
    98 if ( isset($HTTP_RAW_POST_DATA) )
    99     logIO("I", $HTTP_RAW_POST_DATA);
    100 
    10164// Allow for a plugin to insert a different class to handle requests.
    10265$wp_xmlrpc_server_class = apply_filters('wp_xmlrpc_server_class', 'wp_xmlrpc_server');
     
    10568// Fire off the request
    10669$wp_xmlrpc_server->serve_request();
     70
     71exit;
     72
     73/**
     74 * logIO() - Writes logging info to a file.
     75 *
     76 * @deprecated 3.4.0
     77 * @deprecated Use error_log()
     78 *
     79 * @param string $io Whether input or output
     80 * @param string $msg Information describing logging reason.
     81 */
     82function logIO( $io, $msg ) {
     83    _deprecated_function( __FUNCTION__, '3.4', 'error_log()' );
     84    if ( ! empty( $GLOBALS['xmlrpc_logging'] ) )
     85        error_log( $io . ' - ' . $msg );
     86}
Note: See TracChangeset for help on using the changeset viewer.