Merge pull request #12767 from woocommerce/deprecated-actions

Add hooks when error_logging deprecation notices on AJAX calls.
This commit is contained in:
Mike Jolley 2017-01-06 12:05:16 +00:00 committed by GitHub
commit 54352de9b4
1 changed files with 3 additions and 0 deletions

View File

@ -40,6 +40,7 @@ function wc_do_deprecated_action( $action, $args, $deprecated_in, $replacement )
*/
function wc_deprecated_function( $function, $version, $replacement = null ) {
if ( is_ajax() ) {
do_action( 'deprecated_function_run', $function, $replacement, $version );
$log_string = "The {$function} function is deprecated since version {$version}.";
$log_string .= $replacement ? "Replace with {$replacement}." : '';
error_log( $log_string );
@ -59,6 +60,7 @@ function wc_deprecated_function( $function, $version, $replacement = null ) {
*/
function wc_doing_it_wrong( $function, $message, $version ) {
if ( is_ajax() ) {
do_action( 'doing_it_wrong_run', $function, $message, $version );
error_log( "{$function} was called incorrectly. {$message}. This message was added in version {$version}." );
} else {
_doing_it_wrong( $function, $message, $version );
@ -75,6 +77,7 @@ function wc_doing_it_wrong( $function, $message, $version ) {
*/
function wc_deprecated_argument( $argument, $version, $message = null ) {
if ( is_ajax() ) {
do_action( 'deprecated_argument_run', $function, $message, $version );
error_log( "The {$argument} argument is deprecated since version {$version}. {$message}" );
} else {
_deprecated_argument( $argument, $version, $message );