jenkins-bot has submitted this change and it was merged.

Change subject: Minor documentation updates
......................................................................


Minor documentation updates

Update DatabaseBase type hint

Update some deprecated code usages

Change-Id: I86aa4507447040754d0c9f20171f7e22aed4a0cc
---
M OATHAuth.hooks.php
M OATHAuthUtils.php
M OATHUserRepository.php
M special/SpecialOATHLogin.php
4 files changed, 24 insertions(+), 8 deletions(-)

Approvals:
  BryanDavis: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/OATHAuth.hooks.php b/OATHAuth.hooks.php
index a9100f0..39f269b 100644
--- a/OATHAuth.hooks.php
+++ b/OATHAuth.hooks.php
@@ -2,6 +2,7 @@
 
 use MediaWiki\Auth\AuthenticationRequest;
 use MediaWiki\Auth\AuthManager;
+use MediaWiki\MediaWikiServices;
 
 /**
  * Hooks for Extension:OATHAuth
@@ -20,7 +21,8 @@
                static $service = null;
 
                if ( $service == null ) {
-                       $service = new OATHUserRepository( wfGetLB( 
$wgOATHAuthDatabase ) );
+                       $factory = 
MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
+                       $service = new OATHUserRepository( $factory->getMainLB( 
$wgOATHAuthDatabase ) );
                }
 
                return $service;
@@ -167,10 +169,10 @@
         * Helper function for converting old users to the new schema
         * @see OATHAuthHooks::OATHAuthSchemaUpdates
         *
-        * @param DatabaseBase $db
+        * @param IDatabase $db
         * @return bool
         */
-       public static function schemaUpdateOldUsers( DatabaseBase $db ) {
+       public static function schemaUpdateOldUsers( IDatabase $db ) {
                if ( !$db->fieldExists( 'oathauth_users', 'secret_reset' ) ) {
                        return true;
                }
diff --git a/OATHAuthUtils.php b/OATHAuthUtils.php
index 00fe248..5fcf018 100644
--- a/OATHAuthUtils.php
+++ b/OATHAuthUtils.php
@@ -48,6 +48,8 @@
        /**
         * Generate encryption and hmac keys, unique to this user, based on a 
single
         * wiki secret. Use a moderate pbkdf2 work factor in case we ever leak 
keys.
+        * @param string $secret
+        * @param string|int $userid
         * @return array including key for encryption and integrity checking
         */
        private static function getUserKeys( $secret, $userid ) {
@@ -61,6 +63,9 @@
        /**
         * Actually encrypt the data, using a new random IV, and prepend the 
hmac
         * of the encrypted data + IV, using a separate hmac key.
+        * @param string $data
+        * @param string $encKey
+        * @param string $hmacKey
         * @return string $hmac.$iv.$ciphertext, each component b64 encoded
         */
        private static function seal( $data, $encKey, $hmacKey ) {
@@ -80,9 +85,9 @@
        /**
         * Decrypt data sealed using seal(). First checks the hmac to prevent 
various
         * attacks.
-        * @param $encrypted
-        * @param $encKey
-        * @param $hmacKey
+        * @param string $encrypted
+        * @param string $encKey
+        * @param string $hmacKey
         * @return string plaintext
         * @throws Exception
         */
diff --git a/OATHUserRepository.php b/OATHUserRepository.php
index a7f6a33..8185187 100644
--- a/OATHUserRepository.php
+++ b/OATHUserRepository.php
@@ -4,6 +4,10 @@
        /** @var LoadBalancer */
        protected $lb;
 
+       /**
+        * OATHUserRepository constructor.
+        * @param LoadBalancer $lb
+        */
        public function __construct( LoadBalancer $lb ) {
                $this->lb = $lb;
        }
@@ -26,6 +30,9 @@
                return $oathUser;
        }
 
+       /**
+        * @param OATHUser $user
+        */
        public function persist( OATHUser $user ) {
                $this->getDB( DB_MASTER )->replace(
                        'oathauth_users',
@@ -39,6 +46,9 @@
                );
        }
 
+       /**
+        * @param OATHUser $user
+        */
        public function remove( OATHUser $user ) {
                $this->getDB( DB_MASTER )->delete(
                        'oathauth_users',
diff --git a/special/SpecialOATHLogin.php b/special/SpecialOATHLogin.php
index a50cc6c..c7a7681 100644
--- a/special/SpecialOATHLogin.php
+++ b/special/SpecialOATHLogin.php
@@ -109,8 +109,7 @@
         * @return bool
         */
        public function onAbortLogin( User $user, $password, &$abort, 
&$errorMsg ) {
-               $result = $this->OATHUser
-                       ->getKey()
+               $result = $this->OATHUser->getKey()
                        ->verifyToken( $this->getRequest()->getVal( 'token' ), 
$this->OATHUser );
 
                if ( $result ) {

-- 
To view, visit https://gerrit.wikimedia.org/r/313621
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I86aa4507447040754d0c9f20171f7e22aed4a0cc
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/OATHAuth
Gerrit-Branch: master
Gerrit-Owner: Reedy <[email protected]>
Gerrit-Reviewer: BryanDavis <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to