From ab5666274083ffc4a34d4770106b85ab45f0ef3a Mon Sep 17 00:00:00 2001 From: Rebecca Hum Date: Mon, 8 Apr 2024 16:11:33 -0600 Subject: [PATCH] Deprecate suggesting using wpcom_vip_get_page_by_path --- .../Sniffs/Functions/RestrictedFunctionsSniff.php | 7 ------- .../Tests/Functions/RestrictedFunctionsUnitTest.inc | 4 ++-- .../Tests/Functions/RestrictedFunctionsUnitTest.php | 1 - 3 files changed, 2 insertions(+), 10 deletions(-) diff --git a/WordPressVIPMinimum/Sniffs/Functions/RestrictedFunctionsSniff.php b/WordPressVIPMinimum/Sniffs/Functions/RestrictedFunctionsSniff.php index 152f4499..4513140c 100644 --- a/WordPressVIPMinimum/Sniffs/Functions/RestrictedFunctionsSniff.php +++ b/WordPressVIPMinimum/Sniffs/Functions/RestrictedFunctionsSniff.php @@ -269,13 +269,6 @@ public function getGroups() { 'create_function', ], ], - 'get_page_by_path' => [ - 'type' => 'warning', - 'message' => '%s() is highly discouraged due to not being cached; please use wpcom_vip_get_page_by_path() instead.', - 'functions' => [ - 'get_page_by_path', - ], - ], ]; $deprecated_vip_helpers = [ diff --git a/WordPressVIPMinimum/Tests/Functions/RestrictedFunctionsUnitTest.inc b/WordPressVIPMinimum/Tests/Functions/RestrictedFunctionsUnitTest.inc index 10851408..19cba6b3 100644 --- a/WordPressVIPMinimum/Tests/Functions/RestrictedFunctionsUnitTest.inc +++ b/WordPressVIPMinimum/Tests/Functions/RestrictedFunctionsUnitTest.inc @@ -222,8 +222,8 @@ $wp_random_testing = create_function3( '$a, $b', 'return ( $b / $a ); '); // Ok. -wpcom_vip_get_page_by_path(); // Ok - VIP recommended version of get_page_by_path(). -get_page_by_path( $page_path ); // Warning. + + $popular = stats_get_csv( 'postviews', [ 'days' => 2, 'limit' => 20 ] ); // Error. $popular = custom_stats_get_csv( 'postviews', [ 'days' => 2, 'limit' => 20 ] ); // Ok. diff --git a/WordPressVIPMinimum/Tests/Functions/RestrictedFunctionsUnitTest.php b/WordPressVIPMinimum/Tests/Functions/RestrictedFunctionsUnitTest.php index 036bd4f7..0b4fcc5c 100644 --- a/WordPressVIPMinimum/Tests/Functions/RestrictedFunctionsUnitTest.php +++ b/WordPressVIPMinimum/Tests/Functions/RestrictedFunctionsUnitTest.php @@ -121,7 +121,6 @@ public function getWarningList() { 138 => 1, 139 => 1, 208 => 1, - 226 => 1, ]; } }