[MediaWiki-commits] [Gerrit] mediawiki...GlobalPreferences[master]: Use CentralIdLookup instead of hardcoding CentralAuth
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/317014 ) Change subject: Use CentralIdLookup instead of hardcoding CentralAuth .. Use CentralIdLookup instead of hardcoding CentralAuth Change-Id: I636b231d1d141ad3bbe76c3834af5229e1f05e1d --- M GlobalPreferences.body.php 1 file changed, 3 insertions(+), 16 deletions(-) Approvals: Legoktm: Looks good to me, approved jenkins-bot: Verified diff --git a/GlobalPreferences.body.php b/GlobalPreferences.body.php index c98477c..74008a6 100644 --- a/GlobalPreferences.body.php +++ b/GlobalPreferences.body.php @@ -35,13 +35,8 @@ // No prefs for anons, sorry :( return false; } - if ( class_exists( 'CentralAuthUser' ) ) { - $caUser = CentralAuthUser::getInstance( $user ); - return $caUser->exists(); - } - // Assume that we're using shared user tables... - return true; + return self::getUserID( $user ) !== 0; } /** @@ -51,16 +46,8 @@ * @return int */ public static function getUserID( User $user ) { - if ( !self::isUserGlobalized( $user ) ) { - return 0; - } - if ( class_exists( 'CentralAuthUser' ) ) { - $caUser = CentralAuthUser::getInstance( $user ); - return $caUser->getId(); - } else { - // shared user tables use the same user_id - return $user->getId(); - } + $lookup = CentralIdLookup::factory(); + return $lookup->centralIdFromLocalUser( $user ); } /** -- To view, visit https://gerrit.wikimedia.org/r/317014 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I636b231d1d141ad3bbe76c3834af5229e1f05e1d Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/GlobalPreferences Gerrit-Branch: master Gerrit-Owner: LegoktmGerrit-Reviewer: Legoktm Gerrit-Reviewer: jenkins-bot <> ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki...GlobalPreferences[master]: Use CentralIdLookup instead of hardcoding CentralAuth
Legoktm has uploaded a new change for review. https://gerrit.wikimedia.org/r/317014 Change subject: Use CentralIdLookup instead of hardcoding CentralAuth .. Use CentralIdLookup instead of hardcoding CentralAuth Change-Id: I636b231d1d141ad3bbe76c3834af5229e1f05e1d --- M GlobalPreferences.body.php 1 file changed, 3 insertions(+), 16 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/GlobalPreferences refs/changes/14/317014/1 diff --git a/GlobalPreferences.body.php b/GlobalPreferences.body.php index c98477c..74008a6 100644 --- a/GlobalPreferences.body.php +++ b/GlobalPreferences.body.php @@ -35,13 +35,8 @@ // No prefs for anons, sorry :( return false; } - if ( class_exists( 'CentralAuthUser' ) ) { - $caUser = CentralAuthUser::getInstance( $user ); - return $caUser->exists(); - } - // Assume that we're using shared user tables... - return true; + return self::getUserID( $user ) !== 0; } /** @@ -51,16 +46,8 @@ * @return int */ public static function getUserID( User $user ) { - if ( !self::isUserGlobalized( $user ) ) { - return 0; - } - if ( class_exists( 'CentralAuthUser' ) ) { - $caUser = CentralAuthUser::getInstance( $user ); - return $caUser->getId(); - } else { - // shared user tables use the same user_id - return $user->getId(); - } + $lookup = CentralIdLookup::factory(); + return $lookup->centralIdFromLocalUser( $user ); } /** -- To view, visit https://gerrit.wikimedia.org/r/317014 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I636b231d1d141ad3bbe76c3834af5229e1f05e1d Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/GlobalPreferences Gerrit-Branch: master Gerrit-Owner: Legoktm___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits