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

Change subject: Avoid calling User::setPassword() on users not in database
......................................................................


Avoid calling User::setPassword() on users not in database

MediaWiki core change Id3d4074 is removing the ability to call
$user->setPassword() before the user is added to the database. This change
updates the extension to avoid such calls. It remains backwards-compatible with
older versions of MediaWiki through adding a saveSettings() call when
necessary.

Change-Id: Iea3e4787ec4d6d8fbd97582405afaf5440e1dd17
---
M maintenance/BSImportUsers.php
1 file changed, 7 insertions(+), 6 deletions(-)

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



diff --git a/maintenance/BSImportUsers.php b/maintenance/BSImportUsers.php
index 2187278..b1b7a2a 100644
--- a/maintenance/BSImportUsers.php
+++ b/maintenance/BSImportUsers.php
@@ -41,11 +41,6 @@
                                $oUser->setEmail( $sUserEmail );
                        }
 
-                       $sUserPassword = $this->getOption( 'defaultpw', '' );
-                       if( !empty ( $sUserPassword ) ) {
-                               $oUser->setPassword( $sUserPassword );
-                       }
-
                        //TODO: maybe write 'touched', 'registration', etc. 
directly to DB?
 
                        $oProperties = 
$oUserNode->getElementsByTagName('property');
@@ -63,6 +58,12 @@
                        else {
                                $this->error( $oUser->getName().' could not be 
added to database. Message '.$oStatus->getMessage()->plain() );
                                continue;
+                       }
+
+                       $sUserPassword = $this->getOption( 'defaultpw', '' );
+                       if( !empty ( $sUserPassword ) ) {
+                               $oUser->setPassword( $sUserPassword );
+                               $oUser->saveSettings();
                        }
 
                        $oGroups = $oUserNode->getElementsByTagName('group');
@@ -118,4 +119,4 @@
        require_once( RUN_MAINTENANCE_IF_MAIN );
 } else {
        require_once( DO_MAINTENANCE ); # Make this work on versions before 1.17
-}
\ No newline at end of file
+}

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Iea3e4787ec4d6d8fbd97582405afaf5440e1dd17
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/BlueSpiceFoundation
Gerrit-Branch: master
Gerrit-Owner: Anomie <[email protected]>
Gerrit-Reviewer: Mglaser <[email protected]>
Gerrit-Reviewer: Pwirth <[email protected]>
Gerrit-Reviewer: Robert Vogel <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to