From 4582b738ee8257f124cbf2da4aa2cd9a1f5bc06c Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Thu, 26 Mar 2015 15:47:33 -0700 Subject: [PATCH] Removed view event from $wgAutopromoteOnce * This avoids master queries on view. It could use local jobs, but nothing was using this by default anyway. Bug: T92357 Change-Id: Id6353942215a3c704848d3bcc31c2b76225c78be --- RELEASE-NOTES-1.25 | 2 ++ includes/DefaultSettings.php | 2 -- includes/MediaWiki.php | 10 ---------- includes/page/WikiPage.php | 1 + 4 files changed, 3 insertions(+), 12 deletions(-) diff --git a/RELEASE-NOTES-1.25 b/RELEASE-NOTES-1.25 index 6462767144..b7a1a8e601 100644 --- a/RELEASE-NOTES-1.25 +++ b/RELEASE-NOTES-1.25 @@ -45,6 +45,8 @@ production. * The 'daemonized' flag must be set to true in $wgJobTypeConf for any redis job queues. This means that mediawiki/services/jobrunner service has to be installed and running for any such queues to work. +* $wgAutopromoteOnce no longer supports the 'view' event. For keeping some + compatibility, any 'view' event triggers will still trigger on 'edit'. === New features in 1.25 === * (T64861) Updated plural rules to CLDR 26. Includes incompatible changes diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 1df809e480..5ab557eb8a 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -4863,7 +4863,6 @@ $wgAutopromote = array( * @endcode * Where event is either: * - 'onEdit' (when user edits) - * - 'onView' (when user views the wiki) * * Criteria has the same format as $wgAutopromote * @@ -4872,7 +4871,6 @@ $wgAutopromote = array( */ $wgAutopromoteOnce = array( 'onEdit' => array(), - 'onView' => array() ); /** diff --git a/includes/MediaWiki.php b/includes/MediaWiki.php index 26440239ab..c086a39d1e 100644 --- a/includes/MediaWiki.php +++ b/includes/MediaWiki.php @@ -199,8 +199,6 @@ class MediaWiki { throw new PermissionsError( 'read', $permErrors ); } - $pageView = false; // was an article or special page viewed? - // Interwiki redirects if ( $title->isExternal() ) { $rdfrom = $request->getVal( 'rdfrom' ); @@ -263,7 +261,6 @@ class MediaWiki { } // Special pages } elseif ( NS_SPECIAL == $title->getNamespace() ) { - $pageView = true; // Actions that need to be made when we have a special pages SpecialPageFactory::executePath( $title, $this->context ); } else { @@ -271,7 +268,6 @@ class MediaWiki { // may be a redirect to another article or URL. $article = $this->initializeArticle(); if ( is_object( $article ) ) { - $pageView = true; $this->performAction( $article, $requestTitle ); } elseif ( is_string( $article ) ) { $output->redirect( $article ); @@ -280,12 +276,6 @@ class MediaWiki { . " returned neither an object nor a URL" ); } } - - if ( $pageView ) { - // Promote user to any groups they meet the criteria for - $user->addAutopromoteOnceGroups( 'onView' ); - } - } /** diff --git a/includes/page/WikiPage.php b/includes/page/WikiPage.php index 2315dc7466..0452c41500 100644 --- a/includes/page/WikiPage.php +++ b/includes/page/WikiPage.php @@ -1992,6 +1992,7 @@ class WikiPage implements Page, IDBAccessObject { // Promote user to any groups they meet the criteria for $dbw->onTransactionIdle( function () use ( $user ) { $user->addAutopromoteOnceGroups( 'onEdit' ); + $user->addAutopromoteOnceGroups( 'onView' ); // b/c } ); return $status; -- 2.20.1