Merge "Ensure users are able to edit the page after changing the content model"
[lhc/web/wiklou.git] / includes / specials / SpecialBotPasswords.php
index 1027f1f..9975e41 100644 (file)
@@ -162,7 +162,8 @@ class SpecialBotPasswords extends FormSpecialPage {
                        ];
 
                } else {
-                       $dbr = BotPassword::getDB( DB_SLAVE );
+                       $linkRenderer = $this->getLinkRenderer();
+                       $dbr = BotPassword::getDB( DB_REPLICA );
                        $res = $dbr->select(
                                'bot_passwords',
                                [ 'bp_app_id' ],
@@ -174,12 +175,9 @@ class SpecialBotPasswords extends FormSpecialPage {
                                        'section' => 'existing',
                                        'type' => 'info',
                                        'raw' => true,
-                                       'default' => Linker::link(
+                                       'default' => $linkRenderer->makeKnownLink(
                                                $this->getPageTitle( $row->bp_app_id ),
-                                               htmlspecialchars( $row->bp_app_id ),
-                                               [],
-                                               [],
-                                               [ 'known' ]
+                                               $row->bp_app_id
                                        ),
                                ];
                        }
@@ -292,9 +290,7 @@ class SpecialBotPasswords extends FormSpecialPage {
                ] );
 
                if ( $this->operation === 'insert' || !empty( $data['resetPassword'] ) ) {
-                       $this->password = PasswordFactory::generateRandomPasswordString(
-                               max( 32, $this->getConfig()->get( 'MinimalPasswordLength' ) )
-                       );
+                       $this->password = BotPassword::generatePassword( $this->getConfig() );
                        $passwordFactory = new PasswordFactory();
                        $passwordFactory->init( RequestContext::getMain()->getConfig() );
                        $password = $passwordFactory->newFromPlaintext( $this->password );
@@ -337,7 +333,9 @@ class SpecialBotPasswords extends FormSpecialPage {
                        $out->addWikiMsg(
                                'botpasswords-newpassword',
                                htmlspecialchars( $username . $sep . $this->par ),
-                               htmlspecialchars( $this->password )
+                               htmlspecialchars( $this->password ),
+                               htmlspecialchars( $username ),
+                               htmlspecialchars( $this->par . $sep . $this->password )
                        );
                        $this->password = null;
                }