MaxSem has uploaded a new change for review. https://gerrit.wikimedia.org/r/133046
Change subject: Revert "Add API action=watch 'entirewatchlist' param to bulk-clear watchlist." ...................................................................... Revert "Add API action=watch 'entirewatchlist' param to bulk-clear watchlist." Unbounded modification = replication lag. And this function is specifically intended for clearing very large watchlists which would easily escalate to pageable lags of several minutes. This reverts commit 66b07ea38133992f98bb158c95103b720fe958ec. Change-Id: Ie34be712884407e671d715e56bda3bff4a7e78f4 --- M includes/api/ApiWatch.php 1 file changed, 17 insertions(+), 42 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/46/133046/1 diff --git a/includes/api/ApiWatch.php b/includes/api/ApiWatch.php index 953df58..6dfb1b4 100644 --- a/includes/api/ApiWatch.php +++ b/includes/api/ApiWatch.php @@ -47,49 +47,26 @@ // by default we use pageset to extract the page to work on. // title is still supported for backward compatibility if ( !isset( $params['title'] ) ) { - if ( $params['entirewatchlist'] && $pageSet->getDataSource() !== null ) { - $this->dieUsage( - "Cannot use 'entirewatchlist' at the same time as '{$pageSet->getDataSource()}'", - 'multisource' - ); + $pageSet->execute(); + $res = $pageSet->getInvalidTitlesAndRevisions( array( + 'invalidTitles', + 'special', + 'missingIds', + 'missingRevIds', + 'interwikiTitles' + ) ); + + foreach ( $pageSet->getMissingTitles() as $title ) { + $r = $this->watchTitle( $title, $user, $params ); + $r['missing'] = 1; + $res[] = $r; } - if ( $params['entirewatchlist'] ) { - if ( !$params['unwatch'] ) { - $this->dieUsage( - "'entirewatchlist' option can only be used with 'unwatch' parameter.", - 'invalidparammix' - ); - } else { - // We're going to do this in the database as a bulk operation - // instead of one at a time, so it doesn't time out on largeish lists. - $dbw = wfGetDB( DB_MASTER ); - $dbw->delete( 'watchlist', array( 'wl_user' => $user->getId() ), __METHOD__ ); - $user->invalidateCache(); - $res = array(); - } - } else { - $pageSet->execute(); - $res = $pageSet->getInvalidTitlesAndRevisions( array( - 'invalidTitles', - 'special', - 'missingIds', - 'missingRevIds', - 'interwikiTitles' - ) ); - - foreach ( $pageSet->getMissingTitles() as $title ) { - $r = $this->watchTitle( $title, $user, $params ); - $r['missing'] = 1; - $res[] = $r; - } - - foreach ( $pageSet->getGoodTitles() as $title ) { - $r = $this->watchTitle( $title, $user, $params ); - $res[] = $r; - } - $this->getResult()->setIndexedTagName( $res, 'w' ); + foreach ( $pageSet->getGoodTitles() as $title ) { + $r = $this->watchTitle( $title, $user, $params ); + $res[] = $r; } + $this->getResult()->setIndexedTagName( $res, 'w' ); } else { // dont allow use of old title parameter with new pageset parameters. $extraParams = array_keys( array_filter( $pageSet->extractRequestParams(), function ( $x ) { @@ -198,7 +175,6 @@ ApiBase::PARAM_DEPRECATED => true ), 'unwatch' => false, - 'entirewatchlist' => false, 'uselang' => null, 'token' => array( ApiBase::PARAM_TYPE => 'string', @@ -218,7 +194,6 @@ return $psModule->getParamDescription() + array( 'title' => 'The page to (un)watch. use titles instead', 'unwatch' => 'If set the page will be unwatched rather than watched', - 'entirewatchlist' => 'Work on all watched pages without returning a list; can only be used together with \'unwatch\' option.', 'uselang' => 'Language to show the message in', 'token' => 'A token previously acquired via prop=info', ); -- To view, visit https://gerrit.wikimedia.org/r/133046 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ie34be712884407e671d715e56bda3bff4a7e78f4 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: MaxSem <maxsem.w...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits