From: jenkins-bot Date: Wed, 28 Nov 2018 19:55:12 +0000 (+0000) Subject: Merge "Add block notice stats on EditPage." X-Git-Tag: 1.34.0-rc.0~3413 X-Git-Url: https://git.cyclocoop.org/%7B%24admin_url%7Dmembres/cotisations/rappels.php?a=commitdiff_plain;h=2cf4a2c2966d5679cd8935a0807bba1fe21a7381;hp=-c;p=lhc%2Fweb%2Fwiklou.git Merge "Add block notice stats on EditPage." --- 2cf4a2c2966d5679cd8935a0807bba1fe21a7381 diff --combined includes/DefaultSettings.php index 5175543e22,d05867fdc1..44c53646e2 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@@ -4520,8 -4520,6 +4520,8 @@@ $wgCentralIdLookupProvider = 'local' * commonly chosen. Set to integer n to ban the top n passwords. * If you want to ban all common passwords on file, use the * PHP_INT_MAX constant. + * - PasswordNotInLargeBlacklist - Password not in best practices list of + * 100,000 commonly used passwords. * @since 1.26 */ $wgPasswordPolicy = [ @@@ -4531,34 -4529,29 +4531,34 @@@ 'MinimumPasswordLengthToLogin' => 1, 'PasswordCannotMatchUsername' => true, 'PasswordCannotBePopular' => 25, + 'PasswordNotInLargeBlacklist' => true, ], 'sysop' => [ 'MinimalPasswordLength' => 8, 'MinimumPasswordLengthToLogin' => 1, 'PasswordCannotMatchUsername' => true, 'PasswordCannotBePopular' => 25, + 'PasswordNotInLargeBlacklist' => true, ], 'interface-admin' => [ 'MinimalPasswordLength' => 8, 'MinimumPasswordLengthToLogin' => 1, 'PasswordCannotMatchUsername' => true, 'PasswordCannotBePopular' => 25, + 'PasswordNotInLargeBlacklist' => true, ], 'bot' => [ 'MinimalPasswordLength' => 8, 'MinimumPasswordLengthToLogin' => 1, 'PasswordCannotMatchUsername' => true, + 'PasswordNotInLargeBlacklist' => true, ], 'default' => [ 'MinimalPasswordLength' => 1, 'PasswordCannotMatchUsername' => true, 'PasswordCannotMatchBlacklist' => true, 'MaximalPasswordLength' => 4096, + 'PasswordNotInLargeBlacklist' => false, ], ], 'checks' => [ @@@ -4567,8 -4560,7 +4567,8 @@@ 'PasswordCannotMatchUsername' => 'PasswordPolicyChecks::checkPasswordCannotMatchUsername', 'PasswordCannotMatchBlacklist' => 'PasswordPolicyChecks::checkPasswordCannotMatchBlacklist', 'MaximalPasswordLength' => 'PasswordPolicyChecks::checkMaximalPasswordLength', - 'PasswordCannotBePopular' => 'PasswordPolicyChecks::checkPopularPasswordBlacklist' + 'PasswordCannotBePopular' => 'PasswordPolicyChecks::checkPopularPasswordBlacklist', + 'PasswordNotInLargeBlacklist' => 'PasswordPolicyChecks::checkPasswordNotInLargeBlacklist', ], ]; @@@ -8931,9 -8923,6 +8931,9 @@@ $wgCSPFalsePositiveUrls = 'https://rtb.metrigo.com' => true, 'https://d5p.de17a.com' => true, 'https://ad.lkqd.net/vpaid/vpaid.js' => true, + 'https://ad.lkqd.net/vpaid/vpaid.js?fusion=1.0' => true, + 'https://t.lkqd.net/t' => true, + 'chrome-extension' => true, ]; /** @@@ -9042,7 -9031,19 +9042,7 @@@ $wgActorTableSchemaMigrationStage = SCH * @since 1.32 * @var int One of the MIGRATION_* constants */ -$wgChangeTagsSchemaMigrationStage = MIGRATION_WRITE_BOTH; - -/** - * Temporarily flag to use change_tag_def table as backend of change tag statistics. - * For example in case of Special:Tags. If set to false, it will use change_tag table. - * Before setting it to true set $wgChangeTagsSchemaMigrationStage to MIGRATION_WRITE_BOTH and run - * PopulateChangeTagDef maintaince script. - * It's redundant when $wgChangeTagsSchemaMigrationStage is set to MIGRATION_NEW - * - * @since 1.32 - * @var bool - */ -$wgTagStatisticsNewTable = false; +$wgChangeTagsSchemaMigrationStage = MIGRATION_NEW; /** * Flag to enable Partial Blocks. This allows an admin to prevent a user from editing specific pages @@@ -9054,6 -9055,16 +9054,16 @@@ */ $wgEnablePartialBlocks = false; + /** + * Enable stats monitoring when Block Notices are displayed in different places around core + * and extensions. + * + * @since 1.34 + * @deprecated 1.34 + * @var bool + */ + $wgEnableBlockNoticeStats = false; + /** * For really cool vim folding this needs to be at the end: * vim: foldmarker=@{,@} foldmethod=marker diff --combined includes/EditPage.php index 5f4c3aeb87,6b4325e104..9e278afcf8 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@@ -476,15 -476,7 +476,15 @@@ class EditPage $this->mArticle = $article; $this->page = $article->getPage(); // model object $this->mTitle = $article->getTitle(); - $this->context = $article->getContext(); + + // Make sure the local context is in sync with other member variables. + // Particularly make sure everything is using the same WikiPage instance. + // This should probably be the case in Article as well, but it's + // particularly important for EditPage, to make use of the in-place caching + // facility in WikiPage::prepareContentForEdit. + $this->context = new DerivativeContext( $article->getContext() ); + $this->context->setWikiPage( $this->page ); + $this->context->setTitle( $this->mTitle ); $this->contentModel = $this->mTitle->getContentModel(); @@@ -627,14 -619,23 +627,23 @@@ if ( $permErrors ) { wfDebug( __METHOD__ . ": User can't edit\n" ); - // track block with a cookie if it doesn't exists already - $this->context->getUser()->trackBlockWithCookie(); - - // Auto-block user's IP if the account was "hard" blocked - if ( !wfReadOnly() ) { - DeferredUpdates::addCallableUpdate( function () { - $this->context->getUser()->spreadAnyEditBlock(); - } ); + if ( $this->context->getUser()->getBlock() ) { + // track block with a cookie if it doesn't exists already + $this->context->getUser()->trackBlockWithCookie(); + + // Auto-block user's IP if the account was "hard" blocked + if ( !wfReadOnly() ) { + DeferredUpdates::addCallableUpdate( function () { + $this->context->getUser()->spreadAnyEditBlock(); + } ); + } + + $config = $this->context->getConfig(); + if ( $config->get( 'EnableBlockNoticeStats' ) ) { + $wiki = $config->get( 'DBname' ); + $statsd = MediaWikiServices::getInstance()->getStatsdDataFactory(); + $statsd->increment( 'BlockNotices.' . $wiki . '.WikitextEditor.shown' ); + } } $this->displayPermissionsError( $permErrors ); @@@ -3131,10 -3132,7 +3140,10 @@@ ERROR if ( !$revision->isCurrent() ) { $this->mArticle->setOldSubtitle( $revision->getId() ); - $out->addWikiMsg( 'editingold' ); + $out->wrapWikiMsg( + Html::warningBox( "\n$1\n" ), + 'editingold' + ); $this->isOldRev = true; } } elseif ( $this->mTitle->exists() ) { @@@ -3153,22 -3151,16 +3162,22 @@@ ); } elseif ( $user->isAnon() ) { if ( $this->formtype != 'preview' ) { + $returntoquery = array_diff_key( + $this->context->getRequest()->getValues(), + [ 'title' => true, 'returnto' => true, 'returntoquery' => true ] + ); $out->wrapWikiMsg( "
\n$1\n
", [ 'anoneditwarning', // Log-in link SpecialPage::getTitleFor( 'Userlogin' )->getFullURL( [ - 'returnto' => $this->getTitle()->getPrefixedDBkey() + 'returnto' => $this->getTitle()->getPrefixedDBkey(), + 'returntoquery' => wfArrayToCgi( $returntoquery ), ] ), // Sign-up link SpecialPage::getTitleFor( 'CreateAccount' )->getFullURL( [ - 'returnto' => $this->getTitle()->getPrefixedDBkey() + 'returnto' => $this->getTitle()->getPrefixedDBkey(), + 'returntoquery' => wfArrayToCgi( $returntoquery ), ] ) ] );