Make WordPress Core


Ignore:
Timestamp:
02/17/2012 12:02:42 AM (13 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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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 ) {
Note: See TracChangeset for help on using the changeset viewer.