Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change deprecation error handling #574

Merged
merged 1 commit into from
Oct 24, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions WP_Auth0.php
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@ private function autoloader( $class ) {
*/
public function a0_render_message() {
// phpcs:ignore
trigger_error( sprintf( __( 'Method %s is deprecated.', 'wp-auth0' ), __METHOD__ ), E_USER_DEPRECATED );
@trigger_error( sprintf( __( 'Method %s is deprecated.', 'wp-auth0' ), __METHOD__ ), E_USER_DEPRECATED );

$message = null;

Expand All @@ -538,7 +538,7 @@ public function a0_render_message() {
*/
public function check_signup_status() {
// phpcs:ignore
trigger_error( sprintf( __( 'Method %s is deprecated.', 'wp-auth0' ), __METHOD__ ), E_USER_DEPRECATED );
@trigger_error( sprintf( __( 'Method %s is deprecated.', 'wp-auth0' ), __METHOD__ ), E_USER_DEPRECATED );

$app_token = $this->a0_options->get( 'auth0_app_token' );

Expand Down Expand Up @@ -572,15 +572,15 @@ public function check_signup_status() {
}

/**
* @deprecated 3.6.0 - Use WPA0_PLUGIN_URL constant
* @deprecated - 3.6.0, use WPA0_PLUGIN_URL constant
*
* @return string
*
* @codeCoverageIgnore - Deprecated
*/
public static function get_plugin_dir_url() {
// phpcs:ignore
trigger_error( sprintf( __( 'Method %s is deprecated.', 'wp-auth0' ), __METHOD__ ), E_USER_DEPRECATED );
@trigger_error( sprintf( __( 'Method %s is deprecated.', 'wp-auth0' ), __METHOD__ ), E_USER_DEPRECATED );
return WPA0_PLUGIN_URL;
}
}
Expand Down
28 changes: 13 additions & 15 deletions lib/WP_Auth0_Api_Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -857,7 +857,7 @@ public static function get_client_grant_types() {
*
* @see https://auth0.com/docs/api-auth/intro#other-authentication-api-endpoints
*
* @deprecated 3.6.0
* @deprecated - 3.6.0, not used and no replacement provided.
*
* @param $domain
* @param $client_id
Expand All @@ -871,10 +871,8 @@ public static function get_client_grant_types() {
* @codeCoverageIgnore - Deprecated
*/
public static function ro( $domain, $client_id, $username, $password, $connection, $scope ) {

$deprecation_msg = sprintf( __( 'Method %s is deprecated.', 'wp-auth0' ), __METHOD__ );
trigger_error( $deprecation_msg, E_USER_DEPRECATED );
WP_Auth0_ErrorManager::insert_auth0_error( __METHOD__, $deprecation_msg );
// phpcs:ignore
@trigger_error( sprintf( __( 'Method %s is deprecated.', 'wp-auth0' ), __METHOD__ ), E_USER_DEPRECATED );

$endpoint = "https://$domain/";

Expand Down Expand Up @@ -926,7 +924,7 @@ public static function ro( $domain, $client_id, $username, $password, $connectio
*/
public static function validate_user_token( $app_token ) {
// phpcs:ignore
trigger_error( sprintf( __( 'Method %s is deprecated.', 'wp-auth0' ), __METHOD__ ), E_USER_DEPRECATED );
@trigger_error( sprintf( __( 'Method %s is deprecated.', 'wp-auth0' ), __METHOD__ ), E_USER_DEPRECATED );

if ( empty( $app_token ) ) {
return false;
Expand Down Expand Up @@ -961,7 +959,7 @@ public static function validate_user_token( $app_token ) {
*/
public static function search_users( $domain, $jwt, $q = '', $page = 0, $per_page = 100, $include_totals = false, $sort = 'user_id:1' ) {
// phpcs:ignore
trigger_error( sprintf( __( 'Method %s is deprecated.', 'wp-auth0' ), __METHOD__ ), E_USER_DEPRECATED );
@trigger_error( sprintf( __( 'Method %s is deprecated.', 'wp-auth0' ), __METHOD__ ), E_USER_DEPRECATED );

$include_totals = $include_totals ? 'true' : 'false';

Expand Down Expand Up @@ -996,7 +994,7 @@ public static function search_users( $domain, $jwt, $q = '', $page = 0, $per_pag
*/
public static function resend_verification_email( $user_id ) {
// phpcs:ignore
trigger_error( sprintf( __( 'Method %s is deprecated.', 'wp-auth0' ), __METHOD__ ), E_USER_DEPRECATED );
@trigger_error( sprintf( __( 'Method %s is deprecated.', 'wp-auth0' ), __METHOD__ ), E_USER_DEPRECATED );

$response = wp_remote_post(
self::get_endpoint( 'api/v2/jobs/verification-email' ),
Expand Down Expand Up @@ -1033,7 +1031,7 @@ public static function resend_verification_email( $user_id ) {
*/
public static function create_user( $domain, $jwt, $data ) {
// phpcs:ignore
trigger_error( sprintf( __( 'Method %s is deprecated.', 'wp-auth0' ), __METHOD__ ), E_USER_DEPRECATED );
@trigger_error( sprintf( __( 'Method %s is deprecated.', 'wp-auth0' ), __METHOD__ ), E_USER_DEPRECATED );

$endpoint = "https://$domain/api/v2/users";

Expand Down Expand Up @@ -1072,7 +1070,7 @@ public static function create_user( $domain, $jwt, $data ) {
*/
public static function search_clients( $domain, $app_token ) {
// phpcs:ignore
trigger_error( sprintf( __( 'Method %s is deprecated.', 'wp-auth0' ), __METHOD__ ), E_USER_DEPRECATED );
@trigger_error( sprintf( __( 'Method %s is deprecated.', 'wp-auth0' ), __METHOD__ ), E_USER_DEPRECATED );

$endpoint = "https://$domain/api/v2/clients";

Expand Down Expand Up @@ -1113,7 +1111,7 @@ public static function search_clients( $domain, $app_token ) {
*/
public static function get_current_user( $domain, $app_token ) {
// phpcs:ignore
trigger_error( sprintf( __( 'Method %s is deprecated.', 'wp-auth0' ), __METHOD__ ), E_USER_DEPRECATED );
@trigger_error( sprintf( __( 'Method %s is deprecated.', 'wp-auth0' ), __METHOD__ ), E_USER_DEPRECATED );

list( $head, $payload, $signature ) = explode( '.', $app_token );
$decoded = json_decode( JWT::urlsafeB64Decode( $payload ) );
Expand All @@ -1128,7 +1126,7 @@ public static function get_current_user( $domain, $app_token ) {
*/
public static function delete_connection( $domain, $app_token, $id ) {
// phpcs:ignore
trigger_error( sprintf( __( 'Method %s is deprecated.', 'wp-auth0' ), __METHOD__ ), E_USER_DEPRECATED );
@trigger_error( sprintf( __( 'Method %s is deprecated.', 'wp-auth0' ), __METHOD__ ), E_USER_DEPRECATED );

$endpoint = "https://$domain/api/v2/connections/$id";

Expand Down Expand Up @@ -1167,7 +1165,7 @@ public static function delete_connection( $domain, $app_token, $id ) {
*/
public static function delete_user_mfa( $domain, $app_token, $user_id, $provider ) {
// phpcs:ignore
trigger_error( sprintf( __( 'Method %s is deprecated.', 'wp-auth0' ), __METHOD__ ), E_USER_DEPRECATED );
@trigger_error( sprintf( __( 'Method %s is deprecated.', 'wp-auth0' ), __METHOD__ ), E_USER_DEPRECATED );

$endpoint = "https://$domain/api/v2/users/$user_id/multifactor/$provider";

Expand Down Expand Up @@ -1206,7 +1204,7 @@ public static function delete_user_mfa( $domain, $app_token, $user_id, $provider
*/
public static function change_password( $domain, $payload ) {
// phpcs:ignore
trigger_error( sprintf( __( 'Method %s is deprecated.', 'wp-auth0' ), __METHOD__ ), E_USER_DEPRECATED );
@trigger_error( sprintf( __( 'Method %s is deprecated.', 'wp-auth0' ), __METHOD__ ), E_USER_DEPRECATED );

$endpoint = "https://$domain/dbconnections/change_password";

Expand Down Expand Up @@ -1249,7 +1247,7 @@ public static function change_password( $domain, $payload ) {
*/
public static function link_users( $domain, $app_token, $main_user_id, $user_id, $provider, $connection_id = null ) {
// phpcs:ignore
trigger_error( sprintf( __( 'Method %s is deprecated.', 'wp-auth0' ), __METHOD__ ), E_USER_DEPRECATED );
@trigger_error( sprintf( __( 'Method %s is deprecated.', 'wp-auth0' ), __METHOD__ ), E_USER_DEPRECATED );

$endpoint = "https://$domain/api/v2/users/$main_user_id/identities";

Expand Down
4 changes: 2 additions & 2 deletions lib/WP_Auth0_Api_Operations.php
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ public function toggle_rule( $app_token, $rule_id, $rule_name, $rule_script ) {
*/
public function disable_signup_wordpress_connection( $app_token, $disable_signup ) {
// phpcs:ignore
trigger_error( sprintf( __( 'Method %s is deprecated.', 'wp-auth0' ), __METHOD__ ), E_USER_DEPRECATED );
@trigger_error( sprintf( __( 'Method %s is deprecated.', 'wp-auth0' ), __METHOD__ ), E_USER_DEPRECATED );

$domain = $this->a0_options->get( 'domain' );
$client_id = $this->a0_options->get( 'client_id' );
Expand Down Expand Up @@ -210,7 +210,7 @@ public function disable_signup_wordpress_connection( $app_token, $disable_signup
*/
public function social_validation( $app_token, $old_options, $input, $strategy, $connection_options ) {
// phpcs:ignore
trigger_error( sprintf( __( 'Method %s is deprecated.', 'wp-auth0' ), __METHOD__ ), E_USER_DEPRECATED );
@trigger_error( sprintf( __( 'Method %s is deprecated.', 'wp-auth0' ), __METHOD__ ), E_USER_DEPRECATED );

$domain = $this->a0_options->get( 'domain' );
$client_id = $this->a0_options->get( 'client_id' );
Expand Down
5 changes: 3 additions & 2 deletions lib/WP_Auth0_Configure_JWTAUTH.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,13 @@ public function notify_jwt() {
}

/**
* @deprecated - 3.6.0, not needed, handled in WP_Auth0_Admin::admin_enqueue()
*
* @deprecated 3.6.0 - Not needed, handled in WP_Auth0_Admin::admin_enqueue()
* @codeCoverageIgnore - Deprecated
*/
public function admin_enqueue() {
// phpcs:ignore
trigger_error( sprintf( __( 'Method %s is deprecated.', 'wp-auth0' ), __METHOD__ ), E_USER_DEPRECATED );
@trigger_error( sprintf( __( 'Method %s is deprecated.', 'wp-auth0' ), __METHOD__ ), E_USER_DEPRECATED );
}

public function render_settings_page() {
Expand Down
16 changes: 8 additions & 8 deletions lib/WP_Auth0_EditProfile.php
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ public function override_email_update() {
*/
public function validate_new_password( $errors, $update, $user ) {
// phpcs:ignore
trigger_error( sprintf( __( 'Method %s is deprecated.', 'wp-auth0' ), __METHOD__ ), E_USER_DEPRECATED );
@trigger_error( sprintf( __( 'Method %s is deprecated.', 'wp-auth0' ), __METHOD__ ), E_USER_DEPRECATED );

$auth0_password = isset( $_POST['auth0_password'] ) ? $_POST['auth0_password'] : null;
$auth0_repeat_password = isset( $_POST['auth0_repeat_password'] ) ? $_POST['auth0_repeat_password'] : null;
Expand All @@ -220,7 +220,7 @@ public function validate_new_password( $errors, $update, $user ) {
*/
public function update_change_password() {
// phpcs:ignore
trigger_error( sprintf( __( 'Method %s is deprecated.', 'wp-auth0' ), __METHOD__ ), E_USER_DEPRECATED );
@trigger_error( sprintf( __( 'Method %s is deprecated.', 'wp-auth0' ), __METHOD__ ), E_USER_DEPRECATED );

$current_user = get_currentauth0user();
$user_profile = $current_user->auth0_obj;
Expand Down Expand Up @@ -283,7 +283,7 @@ public function update_change_password() {
*/
public function delete_user_data() {
// phpcs:ignore
trigger_error( sprintf( __( 'Method %s is deprecated.', 'wp-auth0' ), __METHOD__ ), E_USER_DEPRECATED );
@trigger_error( sprintf( __( 'Method %s is deprecated.', 'wp-auth0' ), __METHOD__ ), E_USER_DEPRECATED );

if ( ! is_admin() ) {
return;
Expand All @@ -303,7 +303,7 @@ public function delete_user_data() {
*/
public function delete_mfa() {
// phpcs:ignore
trigger_error( sprintf( __( 'Method %s is deprecated.', 'wp-auth0' ), __METHOD__ ), E_USER_DEPRECATED );
@trigger_error( sprintf( __( 'Method %s is deprecated.', 'wp-auth0' ), __METHOD__ ), E_USER_DEPRECATED );

if ( ! is_admin() ) {
return;
Expand Down Expand Up @@ -334,7 +334,7 @@ public function delete_mfa() {
*/
public function show_delete_identity() {
// phpcs:ignore
trigger_error( sprintf( __( 'Method %s is deprecated.', 'wp-auth0' ), __METHOD__ ), E_USER_DEPRECATED );
@trigger_error( sprintf( __( 'Method %s is deprecated.', 'wp-auth0' ), __METHOD__ ), E_USER_DEPRECATED );

if ( ! is_admin() ) {
return;
Expand Down Expand Up @@ -387,7 +387,7 @@ function DeleteAuth0Data(event) {
*/
public function show_delete_mfa() {
// phpcs:ignore
trigger_error( sprintf( __( 'Method %s is deprecated.', 'wp-auth0' ), __METHOD__ ), E_USER_DEPRECATED );
@trigger_error( sprintf( __( 'Method %s is deprecated.', 'wp-auth0' ), __METHOD__ ), E_USER_DEPRECATED );

if ( ! is_admin() ) {
return;
Expand Down Expand Up @@ -442,7 +442,7 @@ function DeleteMFA(event) {
*/
public function show_change_password() {
// phpcs:ignore
trigger_error( sprintf( __( 'Method %s is deprecated.', 'wp-auth0' ), __METHOD__ ), E_USER_DEPRECATED );
@trigger_error( sprintf( __( 'Method %s is deprecated.', 'wp-auth0' ), __METHOD__ ), E_USER_DEPRECATED );

$current_user = get_currentauth0user();
$user_profile = $current_user->auth0_obj;
Expand Down Expand Up @@ -499,7 +499,7 @@ public function show_change_password() {
*/
public function disable_email_field() {
// phpcs:ignore
trigger_error( sprintf( __( 'Method %s is deprecated.', 'wp-auth0' ), __METHOD__ ), E_USER_DEPRECATED );
@trigger_error( sprintf( __( 'Method %s is deprecated.', 'wp-auth0' ), __METHOD__ ), E_USER_DEPRECATED );

$current_user = get_currentauth0user();
$user_profile = $current_user->auth0_obj;
Expand Down
2 changes: 1 addition & 1 deletion lib/WP_Auth0_Email_Verification.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public function resend_verification_email() {
*/
public static function ajax_resend_email() {
// phpcs:ignore
trigger_error( sprintf( __( 'Method %s is deprecated.', 'wp-auth0' ), __METHOD__ ), E_USER_DEPRECATED );
@trigger_error( sprintf( __( 'Method %s is deprecated.', 'wp-auth0' ), __METHOD__ ), E_USER_DEPRECATED );

check_ajax_referer( self::RESEND_NONCE_ACTION );
if ( ! empty( $_POST['sub'] ) ) {
Expand Down
4 changes: 2 additions & 2 deletions lib/WP_Auth0_ErrorLog.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,13 +124,13 @@ private function update( array $log ) {
/**
* Enqueue scripts and styles.
*
* @deprecated 3.6.0 - Not needed, handled in WP_Auth0_Admin::admin_enqueue()
* @deprecated - 3.6.0, not used, handled in WP_Auth0_Admin::admin_enqueue()
*
* @codeCoverageIgnore
*/
public function admin_enqueue() {
// phpcs:ignore
trigger_error( sprintf( __( 'Method %s is deprecated.', 'wp-auth0' ), __METHOD__ ), E_USER_DEPRECATED );
@trigger_error( sprintf( __( 'Method %s is deprecated.', 'wp-auth0' ), __METHOD__ ), E_USER_DEPRECATED );
}
}

Expand Down
5 changes: 3 additions & 2 deletions lib/WP_Auth0_Export_Users.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,13 @@ public function init() {
}

/**
* @deprecated - 3.6.0, not used, handled in WP_Auth0_Admin::admin_enqueue()
*
* @deprecated 3.6.0 - Not needed, handled in WP_Auth0_Admin::admin_enqueue()
* @codeCoverageIgnore - Deprecated
*/
public function admin_enqueue() {
// phpcs:ignore
trigger_error( sprintf( __( 'Method %s is deprecated.', 'wp-auth0' ), __METHOD__ ), E_USER_DEPRECATED );
@trigger_error( sprintf( __( 'Method %s is deprecated.', 'wp-auth0' ), __METHOD__ ), E_USER_DEPRECATED );
}

public function a0_add_users_export() {
Expand Down
Loading