Merge "RCFilters UI: Adopt conflict colors"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Fri, 3 Mar 2017 19:32:06 +0000 (19:32 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Fri, 3 Mar 2017 19:32:06 +0000 (19:32 +0000)
78 files changed:
autoload.php
includes/DefaultSettings.php
includes/Revision.php
includes/RevisionList.php
includes/TitleArray.php
includes/TitleArrayFromResult.php
includes/WatchedItemQueryServiceExtension.php
includes/actions/HistoryAction.php
includes/api/ApiPageSet.php
includes/api/ApiQueryBase.php
includes/cache/BacklinkCache.php
includes/cache/LinkBatch.php
includes/changes/ChangesFeed.php
includes/changes/ChangesList.php
includes/db/DatabaseOracle.php
includes/deferred/DeferredUpdates.php
includes/export/WikiExporter.php
includes/filerepo/LocalRepo.php
includes/libs/rdbms/database/Database.php
includes/libs/rdbms/database/DatabaseMssql.php
includes/libs/rdbms/database/DatabaseMysqlBase.php
includes/libs/rdbms/database/DatabaseMysqli.php
includes/libs/rdbms/database/DatabasePostgres.php
includes/libs/rdbms/database/DatabaseSqlite.php
includes/libs/rdbms/database/IDatabase.php
includes/libs/rdbms/database/resultwrapper/FakeResultWrapper.php
includes/libs/rdbms/database/resultwrapper/MssqlResultWrapper.php
includes/libs/rdbms/database/resultwrapper/ResultWrapper.php
includes/page/ImagePage.php
includes/page/WikiFilePage.php
includes/page/WikiPage.php
includes/pager/IndexPager.php
includes/revisiondelete/RevDelRevisionList.php
includes/search/SqlSearchResultSet.php
includes/specialpage/ChangesListSpecialPage.php
includes/specialpage/ImageQueryPage.php
includes/specialpage/PageQueryPage.php
includes/specialpage/QueryPage.php
includes/specialpage/WantedQueryPage.php
includes/specials/SpecialBrokenRedirects.php
includes/specials/SpecialDoubleRedirects.php
includes/specials/SpecialLinkSearch.php
includes/specials/SpecialListDuplicatedFiles.php
includes/specials/SpecialListredirects.php
includes/specials/SpecialMediaStatistics.php
includes/specials/SpecialMostcategories.php
includes/specials/SpecialMostinterwikis.php
includes/specials/SpecialMostlinked.php
includes/specials/SpecialMostlinkedcategories.php
includes/specials/SpecialMostlinkedtemplates.php
includes/specials/SpecialProtectedpages.php
includes/specials/SpecialRecentchanges.php
includes/specials/SpecialShortpages.php
includes/specials/SpecialUndelete.php
includes/specials/SpecialUnwatchedpages.php
includes/specials/SpecialWatchlist.php
includes/specials/pagers/AllMessagesTablePager.php
includes/specials/pagers/BlockListPager.php
includes/specials/pagers/ContribsPager.php
includes/specials/pagers/DeletedContribsPager.php
includes/specials/pagers/ImageListPager.php
includes/specials/pagers/ProtectedPagesPager.php [new file with mode: 0644]
includes/user/UserArray.php
includes/user/UserArrayFromResult.php
maintenance/convertUserOptions.php
maintenance/initUserPreference.php [new file with mode: 0644]
maintenance/namespaceDupes.php
maintenance/purgeChangedPages.php
maintenance/sql.php
resources/Resources.php
resources/src/dom-level2-skip.js [deleted file]
resources/src/mediawiki.rcfilters/mw.rcfilters.init.js
resources/src/mediawiki.rcfilters/ui/mw.rcfilters.ui.FilterWrapperWidget.js
resources/src/mediawiki/mediawiki.inspect.js
resources/src/polyfill-nodeTypes.js [deleted file]
tests/parser/ParserTestRunner.php
tests/phpunit/includes/deferred/DeferredUpdatesTest.php
tests/qunit/QUnitTestResources.php

index ad44273..329ccb3 100644 (file)
@@ -628,6 +628,7 @@ $wgAutoloadLocalClasses = [
        'InfoAction' => __DIR__ . '/includes/actions/InfoAction.php',
        'InitEditCount' => __DIR__ . '/maintenance/initEditCount.php',
        'InitSiteStats' => __DIR__ . '/maintenance/initSiteStats.php',
+       'InitUserPreference' => __DIR__ . '/maintenance/initUserPreference.php',
        'InstallDocFormatter' => __DIR__ . '/includes/installer/InstallDocFormatter.php',
        'Installer' => __DIR__ . '/includes/installer/Installer.php',
        'InstallerOverrides' => __DIR__ . '/includes/installer/InstallerOverrides.php',
@@ -973,7 +974,6 @@ $wgAutoloadLocalClasses = [
        'MovePage' => __DIR__ . '/includes/MovePage.php',
        'MovePageForm' => __DIR__ . '/includes/specials/SpecialMovepage.php',
        'MssqlInstaller' => __DIR__ . '/includes/installer/MssqlInstaller.php',
-       'MssqlResultWrapper' => __DIR__ . '/includes/libs/rdbms/database/resultwrapper/MssqlResultWrapper.php',
        'MssqlUpdater' => __DIR__ . '/includes/installer/MssqlUpdater.php',
        'MultiConfig' => __DIR__ . '/includes/config/MultiConfig.php',
        'MultiHttpClient' => __DIR__ . '/includes/libs/MultiHttpClient.php',
@@ -1117,7 +1117,7 @@ $wgAutoloadLocalClasses = [
        'Protect' => __DIR__ . '/maintenance/protect.php',
        'ProtectAction' => __DIR__ . '/includes/actions/ProtectAction.php',
        'ProtectLogFormatter' => __DIR__ . '/includes/logging/ProtectLogFormatter.php',
-       'ProtectedPagesPager' => __DIR__ . '/includes/specials/SpecialProtectedpages.php',
+       'ProtectedPagesPager' => __DIR__ . '/includes/specials/pagers/ProtectedPagesPager.php',
        'ProtectedTitlesPager' => __DIR__ . '/includes/specials/pagers/ProtectedTitlesPager.php',
        'ProtectionForm' => __DIR__ . '/includes/ProtectionForm.php',
        'ProxyLookup' => __DIR__ . '/includes/ProxyLookup.php',
@@ -1582,6 +1582,7 @@ $wgAutoloadLocalClasses = [
        'Wikimedia\\Rdbms\\ConnectionManager' => __DIR__ . '/includes/libs/rdbms/connectionmanager/ConnectionManager.php',
        'Wikimedia\\Rdbms\\DBMasterPos' => __DIR__ . '/includes/libs/rdbms/database/position/DBMasterPos.php',
        'Wikimedia\\Rdbms\\DatabaseDomain' => __DIR__ . '/includes/libs/rdbms/database/DatabaseDomain.php',
+       'Wikimedia\\Rdbms\\FakeResultWrapper' => __DIR__ . '/includes/libs/rdbms/database/resultwrapper/FakeResultWrapper.php',
        'Wikimedia\\Rdbms\\Field' => __DIR__ . '/includes/libs/rdbms/field/Field.php',
        'Wikimedia\\Rdbms\\IBlob' => __DIR__ . '/includes/libs/rdbms/encasing/IBlob.php',
        'Wikimedia\\Rdbms\\ILBFactory' => __DIR__ . '/includes/libs/rdbms/lbfactory/ILBFactory.php',
@@ -1600,10 +1601,12 @@ $wgAutoloadLocalClasses = [
        'Wikimedia\\Rdbms\\LoadMonitorNull' => __DIR__ . '/includes/libs/rdbms/loadmonitor/LoadMonitorNull.php',
        'Wikimedia\\Rdbms\\MssqlBlob' => __DIR__ . '/includes/libs/rdbms/encasing/MssqlBlob.php',
        'Wikimedia\\Rdbms\\MssqlField' => __DIR__ . '/includes/libs/rdbms/field/MssqlField.php',
+       'Wikimedia\\Rdbms\\MssqlResultWrapper' => __DIR__ . '/includes/libs/rdbms/database/resultwrapper/MssqlResultWrapper.php',
        'Wikimedia\\Rdbms\\MySQLField' => __DIR__ . '/includes/libs/rdbms/field/MySQLField.php',
        'Wikimedia\\Rdbms\\MySQLMasterPos' => __DIR__ . '/includes/libs/rdbms/database/position/MySQLMasterPos.php',
        'Wikimedia\\Rdbms\\PostgresBlob' => __DIR__ . '/includes/libs/rdbms/encasing/PostgresBlob.php',
        'Wikimedia\\Rdbms\\PostgresField' => __DIR__ . '/includes/libs/rdbms/field/PostgresField.php',
+       'Wikimedia\\Rdbms\\ResultWrapper' => __DIR__ . '/includes/libs/rdbms/database/resultwrapper/ResultWrapper.php',
        'Wikimedia\\Rdbms\\SQLiteField' => __DIR__ . '/includes/libs/rdbms/field/SQLiteField.php',
        'Wikimedia\\Rdbms\\SessionConsistentConnectionManager' => __DIR__ . '/includes/libs/rdbms/connectionmanager/SessionConsistentConnectionManager.php',
        'Wikimedia\\Rdbms\\TransactionProfiler' => __DIR__ . '/includes/libs/rdbms/TransactionProfiler.php',
index 1a82faf..3b08e07 100644 (file)
@@ -4870,9 +4870,7 @@ $wgDefaultUserOptions = [
 /**
  * An array of preferences to not show for the user
  */
-$wgHiddenPrefs = [
-       'rcenhancedfilters',
-];
+$wgHiddenPrefs = [];
 
 /**
  * Characters to prevent during new account creations.
index d6cfcd9..4b9435a 100644 (file)
@@ -21,6 +21,8 @@
  */
 use MediaWiki\Linker\LinkTarget;
 use MediaWiki\MediaWikiServices;
+use Wikimedia\Rdbms\ResultWrapper;
+use Wikimedia\Rdbms\FakeResultWrapper;
 
 /**
  * @todo document
@@ -1781,6 +1783,7 @@ class Revision implements IDBAccessObject {
         *
         * @param Title $title
         * @param int $id
+        * @param int $flags
         * @return string|bool False if not found
         */
        static function getTimestampFromId( $title, $id, $flags = 0 ) {
index 53cf699..d909a65 100644 (file)
@@ -21,6 +21,7 @@
  */
 
 use MediaWiki\MediaWikiServices;
+use Wikimedia\Rdbms\ResultWrapper;
 
 /**
  * List for revision table items for a single page
index 5a28b85..bf2344b 100644 (file)
@@ -24,6 +24,8 @@
  * @file
  */
 
+use Wikimedia\Rdbms\ResultWrapper;
+
 /**
  * The TitleArray class only exists to provide the newFromResult method at pre-
  * sent.
index 668ea54..189fb40 100644 (file)
@@ -24,6 +24,8 @@
  * @file
  */
 
+use Wikimedia\Rdbms\ResultWrapper;
+
 class TitleArrayFromResult extends TitleArray implements Countable {
        /** @var ResultWrapper */
        public $res;
index 8fcf131..6301576 100644 (file)
@@ -1,5 +1,7 @@
 <?php
 
+use Wikimedia\Rdbms\ResultWrapper;
+
 /**
  * Extension mechanism for WatchedItemQueryService
  *
index b381edc..d1be7d4 100644 (file)
@@ -24,6 +24,8 @@
  */
 
 use MediaWiki\MediaWikiServices;
+use Wikimedia\Rdbms\ResultWrapper;
+use Wikimedia\Rdbms\FakeResultWrapper;
 
 /**
  * This class handles printing the history page for an article. In order to
index 06019cf..7d16af8 100644 (file)
@@ -24,6 +24,7 @@
  * @file
  */
 use MediaWiki\MediaWikiServices;
+use Wikimedia\Rdbms\ResultWrapper;
 
 /**
  * This class contains a list of pages that the client has requested.
@@ -64,6 +65,7 @@ class ApiPageSet extends ApiBase {
        private $mMissingPageIDs = [];
        private $mRedirectTitles = [];
        private $mSpecialTitles = [];
+       private $mAllSpecials = []; // separate from mAllPages to avoid breaking getAllTitlesByNamespace()
        private $mNormalizedTitles = [];
        private $mInterwikiTitles = [];
        /** @var Title[] */
@@ -1061,7 +1063,7 @@ class ApiPageSet extends ApiBase {
         * @return LinkBatch
         */
        private function getRedirectTargets() {
-               $lb = new LinkBatch();
+               $titlesToResolve = [];
                $db = $this->getDB();
 
                $res = $db->select(
@@ -1088,8 +1090,8 @@ class ApiPageSet extends ApiBase {
                        unset( $this->mPendingRedirectIDs[$rdfrom] );
                        if ( $to->isExternal() ) {
                                $this->mInterwikiTitles[$to->getPrefixedText()] = $to->getInterwiki();
-                       } elseif ( !isset( $this->mAllPages[$row->rd_namespace][$row->rd_title] ) ) {
-                               $lb->add( $row->rd_namespace, $row->rd_title );
+                       } elseif ( !isset( $this->mAllPages[$to->getNamespace()][$to->getDBkey()] ) ) {
+                               $titlesToResolve[] = $to;
                        }
                        $this->mRedirectTitles[$from] = $to;
                }
@@ -1104,7 +1106,11 @@ class ApiPageSet extends ApiBase {
                                        // What the hell. Let's just ignore this
                                        continue;
                                }
-                               $lb->addObj( $rt );
+                               if ( $rt->isExternal() ) {
+                                       $this->mInterwikiTitles[$rt->getPrefixedText()] = $rt->getInterwiki();
+                               } elseif ( !isset( $this->mAllPages[$rt->getNamespace()][$rt->getDBkey()] ) ) {
+                                       $titlesToResolve[] = $rt;
+                               }
                                $from = $title->getPrefixedText();
                                $this->mResolvedRedirectTitles[$from] = $title;
                                $this->mRedirectTitles[$from] = $rt;
@@ -1112,7 +1118,7 @@ class ApiPageSet extends ApiBase {
                        }
                }
 
-               return $lb;
+               return $this->processTitlesArray( $titlesToResolve );
        }
 
        /**
@@ -1151,12 +1157,14 @@ class ApiPageSet extends ApiBase {
                                        $titleObj = Title::newFromTextThrow( $title, $this->mDefaultNamespace );
                                } catch ( MalformedTitleException $ex ) {
                                        // Handle invalid titles gracefully
-                                       $this->mAllPages[0][$title] = $this->mFakePageId;
-                                       $this->mInvalidTitles[$this->mFakePageId] = [
-                                               'title' => $title,
-                                               'invalidreason' => $this->getErrorFormatter()->formatException( $ex, [ 'bc' => true ] ),
-                                       ];
-                                       $this->mFakePageId--;
+                                       if ( !isset( $this->mAllPages[0][$title] ) ) {
+                                               $this->mAllPages[0][$title] = $this->mFakePageId;
+                                               $this->mInvalidTitles[$this->mFakePageId] = [
+                                                       'title' => $title,
+                                                       'invalidreason' => $this->getErrorFormatter()->formatException( $ex, [ 'bc' => true ] ),
+                                               ];
+                                               $this->mFakePageId--;
+                                       }
                                        continue; // There's nothing else we can do
                                }
                        } else {
@@ -1184,8 +1192,13 @@ class ApiPageSet extends ApiBase {
                                if ( $titleObj->getNamespace() < 0 ) {
                                        // Handle Special and Media pages
                                        $titleObj = $titleObj->fixSpecialName();
-                                       $this->mSpecialTitles[$this->mFakePageId] = $titleObj;
-                                       $this->mFakePageId--;
+                                       $ns = $titleObj->getNamespace();
+                                       $dbkey = $titleObj->getDBkey();
+                                       if ( !isset( $this->mAllSpecials[$ns][$dbkey] ) ) {
+                                               $this->mAllSpecials[$ns][$dbkey] = $this->mFakePageId;
+                                               $this->mSpecialTitles[$this->mFakePageId] = $titleObj;
+                                               $this->mFakePageId--;
+                                       }
                                } else {
                                        // Regular page
                                        $linkBatch->addObj( $titleObj );
index 2d21865..87bb6a7 100644 (file)
@@ -24,6 +24,8 @@
  * @file
  */
 
+use Wikimedia\Rdbms\ResultWrapper;
+
 /**
  * This is a base class for all Query modules.
  * It provides some common functionality such as constructing various SQL
index 349b773..0a07a93 100644 (file)
@@ -26,6 +26,9 @@
  * @copyright Â© 2011, Antoine Musso
  */
 
+use Wikimedia\Rdbms\ResultWrapper;
+use Wikimedia\Rdbms\FakeResultWrapper;
+
 /**
  * Class for fetching backlink lists, approximate backlink counts and
  * partitions. This is a shared cache.
index d773fff..77ab2d5 100644 (file)
@@ -22,6 +22,7 @@
  */
 use MediaWiki\Linker\LinkTarget;
 use MediaWiki\MediaWikiServices;
+use Wikimedia\Rdbms\ResultWrapper;
 
 /**
  * Class representing a list of titles
index 86c07ba..cffb59a 100644 (file)
@@ -20,6 +20,8 @@
  * @file
  */
 
+use Wikimedia\Rdbms\ResultWrapper;
+
 /**
  * Feed to Special:RecentChanges and Special:RecentChangesLiked
  *
index bc7d721..3f4ad14 100644 (file)
@@ -23,6 +23,7 @@
  */
 use MediaWiki\Linker\LinkRenderer;
 use MediaWiki\MediaWikiServices;
+use Wikimedia\Rdbms\ResultWrapper;
 
 class ChangesList extends ContextSource {
        /**
index 344aa3d..ef5a8fe 100644 (file)
@@ -21,6 +21,7 @@
  * @ingroup Database
  */
 use Wikimedia\Rdbms\Blob;
+use Wikimedia\Rdbms\ResultWrapper;
 
 /**
  * @ingroup Database
index 000b526..0a9755d 100644 (file)
@@ -336,6 +336,21 @@ class DeferredUpdates {
                return count( self::$preSendUpdates ) + count( self::$postSendUpdates );
        }
 
+       /**
+        * @param integer $stage DeferredUpdates constant (PRESEND, POSTSEND, or ALL)
+        * @since 1.29
+        */
+       public static function getPendingUpdates( $stage = self::ALL ) {
+               $updates = [];
+               if ( $stage === self::ALL || $stage === self::PRESEND ) {
+                       $updates = array_merge( $updates, self::$preSendUpdates );
+               }
+               if ( $stage === self::ALL || $stage === self::POSTSEND ) {
+                       $updates = array_merge( $updates, self::$postSendUpdates );
+               }
+               return $updates;
+       }
+
        /**
         * Clear all pending updates without performing them. Generally, you don't
         * want or need to call this. Unit tests need it though.
index 3949764..e41ab54 100644 (file)
@@ -27,6 +27,8 @@
  * @defgroup Dump Dump
  */
 
+use Wikimedia\Rdbms\ResultWrapper;
+
 /**
  * @ingroup SpecialPage Dump
  */
index d49ae7b..d5e29ab 100644 (file)
@@ -22,6 +22,8 @@
  * @ingroup FileRepo
  */
 
+use Wikimedia\Rdbms\ResultWrapper;
+
 /**
  * A repository that stores files in the local filesystem and registers them
  * in the wiki's own database. This is the most commonly used repository class.
index 654bb29..c5afe1e 100644 (file)
@@ -29,6 +29,7 @@ use Wikimedia\ScopedCallback;
 use Wikimedia\Rdbms\TransactionProfiler;
 use Wikimedia\Rdbms\LikeMatch;
 use Wikimedia\Rdbms\DatabaseDomain;
+use Wikimedia\Rdbms\ResultWrapper;
 use Wikimedia\Rdbms\DBMasterPos;
 use Wikimedia\Rdbms\Blob;
 use Wikimedia\Timestamp\ConvertibleTimestamp;
index 7c82479..75ddc9d 100644 (file)
@@ -27,6 +27,8 @@
 use Wikimedia\Rdbms\Blob;
 use Wikimedia\Rdbms\MssqlBlob;
 use Wikimedia\Rdbms\MssqlField;
+use Wikimedia\Rdbms\ResultWrapper;
+use Wikimedia\Rdbms\MssqlResultWrapper;
 
 /**
  * @ingroup Database
index 61ba498..9270589 100644 (file)
@@ -23,6 +23,7 @@
 use Wikimedia\Rdbms\DBMasterPos;
 use Wikimedia\Rdbms\MySQLMasterPos;
 use Wikimedia\Rdbms\MySQLField;
+use Wikimedia\Rdbms\ResultWrapper;
 
 /**
  * Database abstraction object for MySQL.
index 2f27ff9..7a2200a 100644 (file)
@@ -21,6 +21,8 @@
  * @ingroup Database
  */
 
+use Wikimedia\Rdbms\ResultWrapper;
+
 /**
  * Database abstraction object for PHP extension mysqli.
  *
index 5233932..af9716d 100644 (file)
@@ -25,6 +25,7 @@ use Wikimedia\WaitConditionLoop;
 use Wikimedia\Rdbms\Blob;
 use Wikimedia\Rdbms\PostgresBlob;
 use Wikimedia\Rdbms\PostgresField;
+use Wikimedia\Rdbms\ResultWrapper;
 
 /**
  * @ingroup Database
index 30bfcf8..090ce8e 100644 (file)
@@ -23,6 +23,7 @@
  */
 use Wikimedia\Rdbms\Blob;
 use Wikimedia\Rdbms\SQLiteField;
+use Wikimedia\Rdbms\ResultWrapper;
 
 /**
  * @ingroup Database
index f7bb6cf..6bc870b 100644 (file)
@@ -28,6 +28,7 @@ use Wikimedia\Rdbms\Blob;
 use Wikimedia\Rdbms\LikeMatch;
 use Wikimedia\Rdbms\DBMasterPos;
 use Wikimedia\Rdbms\Field;
+use Wikimedia\Rdbms\IResultWrapper;
 
 /**
  * Basic database interface for live and lazy-loaded relation database handles
@@ -363,7 +364,7 @@ interface IDatabase {
         * member variables.
         * If no more rows are available, false is returned.
         *
-        * @param ResultWrapper|stdClass $res Object as returned from IDatabase::query(), etc.
+        * @param IResultWrapper|stdClass $res Object as returned from IDatabase::query(), etc.
         * @return stdClass|bool
         * @throws DBUnexpectedError Thrown if the database returns an error
         */
@@ -374,7 +375,7 @@ interface IDatabase {
         * form. Fields are retrieved with $row['fieldname'].
         * If no more rows are available, false is returned.
         *
-        * @param ResultWrapper $res Result object as returned from IDatabase::query(), etc.
+        * @param IResultWrapper $res Result object as returned from IDatabase::query(), etc.
         * @return array|bool
         * @throws DBUnexpectedError Thrown if the database returns an error
         */
@@ -517,7 +518,7 @@ interface IDatabase {
         * @param bool $tempIgnore Whether to avoid throwing an exception on errors...
         *     maybe best to catch the exception instead?
         * @throws DBError
-        * @return bool|ResultWrapper True for a successful write query, ResultWrapper object
+        * @return bool|IResultWrapper True for a successful write query, IResultWrapper object
         *     for a successful read query, or false on failure if $tempIgnore set
         */
        public function query( $sql, $fname = __METHOD__, $tempIgnore = false );
@@ -731,7 +732,7 @@ interface IDatabase {
         *
         *    [ 'page' => [ 'LEFT JOIN', 'page_latest=rev_id' ] ]
         *
-        * @return ResultWrapper|bool If the query returned no rows, a ResultWrapper
+        * @return IResultWrapper|bool If the query returned no rows, a IResultWrapper
         *   with no rows in it will be returned. If there was a query error, a
         *   DBQueryError exception will be thrown, except if the "ignore errors"
         *   option was set, in which case false will be returned.
@@ -1196,7 +1197,7 @@ interface IDatabase {
         *   for the format. Use $conds == "*" to delete all rows
         * @param string $fname Name of the calling function
         * @throws DBUnexpectedError
-        * @return bool|ResultWrapper
+        * @return bool|IResultWrapper
         */
        public function delete( $table, $conds, $fname = __METHOD__ );
 
@@ -1224,7 +1225,7 @@ interface IDatabase {
         * @param array $selectOptions Options for the SELECT part of the query, see
         *    IDatabase::select() for details.
         *
-        * @return ResultWrapper
+        * @return IResultWrapper
         */
        public function insertSelect( $destTable, $srcTable, $varMap, $conds,
                $fname = __METHOD__,
index 1a046cf..fd7af11 100644 (file)
@@ -1,4 +1,9 @@
 <?php
+
+namespace Wikimedia\Rdbms;
+
+use stdClass;
+
 /**
  * Overloads the relevant methods of the real ResultsWrapper so it
  * doesn't go anywhere near an actual database.
@@ -56,3 +61,6 @@ class FakeResultWrapper extends ResultWrapper {
                return $this->fetchObject();
        }
 }
+
+class_alias( FakeResultWrapper::class, 'FakeResultWrapper' );
+
index b591f4f..4e28397 100644 (file)
@@ -1,4 +1,9 @@
 <?php
+
+namespace Wikimedia\Rdbms;
+
+use stdClass;
+
 class MssqlResultWrapper extends ResultWrapper {
        /** @var integer|null */
        private $mSeekTo = null;
index 88e7cdd..a76d66a 100644 (file)
@@ -1,6 +1,10 @@
 <?php
 
-use Wikimedia\Rdbms\IResultWrapper;
+namespace Wikimedia\Rdbms;
+
+use IDatabase;
+use stdClass;
+use RuntimeException;
 
 /**
  * Result wrapper for grabbing data queried from an IDatabase object
@@ -115,3 +119,5 @@ class ResultWrapper implements IResultWrapper {
                return $this->current() !== false;
        }
 }
+
+class_alias( ResultWrapper::class, 'ResultWrapper' );
index 714d3a9..f8202a6 100644 (file)
@@ -20,6 +20,8 @@
  * @file
  */
 
+use Wikimedia\Rdbms\ResultWrapper;
+
 /**
  * Class for viewing MediaWiki file description pages
  *
index 1fa4bfa..e4b524b 100644 (file)
@@ -20,6 +20,8 @@
  * @file
  */
 
+use Wikimedia\Rdbms\FakeResultWrapper;
+
 /**
  * Special handling for file pages
  *
index e49ef2a..4bc8ad6 100644 (file)
@@ -22,6 +22,7 @@
 
 use \MediaWiki\Logger\LoggerFactory;
 use \MediaWiki\MediaWikiServices;
+use Wikimedia\Rdbms\FakeResultWrapper;
 
 /**
  * Class representing a MediaWiki article and history.
index 395cee5..dc302a2 100644 (file)
@@ -21,6 +21,8 @@
  * @ingroup Pager
  */
 
+use Wikimedia\Rdbms\ResultWrapper;
+
 /**
  * IndexPager is an efficient pager which uses a (roughly unique) index in the
  * data set to implement paging, rather than a "LIMIT offset,limit" clause.
index f0b1907..453c6cc 100644 (file)
@@ -19,6 +19,8 @@
  * @ingroup RevisionDelete
  */
 
+use Wikimedia\Rdbms\FakeResultWrapper;
+
 /**
  * List for revision table items
  *
index c3985d1..53d09e8 100644 (file)
@@ -1,4 +1,7 @@
 <?php
+
+use Wikimedia\Rdbms\ResultWrapper;
+
 /**
  * This class is used for different SQL-based search engines shipped with MediaWiki
  * @ingroup Search
index 9cce266..f62b302 100644 (file)
@@ -21,6 +21,7 @@
  * @ingroup SpecialPage
  */
 use MediaWiki\Logger\LoggerFactory;
+use Wikimedia\Rdbms\ResultWrapper;
 
 /**
  * Special page which uses a ChangesList to show query results.
index c4e53ee..bafee65 100644 (file)
@@ -21,6 +21,8 @@
  * @ingroup SpecialPage
  */
 
+use Wikimedia\Rdbms\ResultWrapper;
+
 /**
  * Variant of QueryPage which uses a gallery to output results, thus
  * suited for reports generating images
index 3bb3f85..45cef2b 100644 (file)
@@ -21,6 +21,8 @@
  * @ingroup SpecialPage
  */
 
+use Wikimedia\Rdbms\ResultWrapper;
+
 /**
  * Variant of QueryPage which formats the result as a simple link to the page
  *
index 53f8930..40f82f5 100644 (file)
@@ -21,6 +21,8 @@
  * @ingroup SpecialPage
  */
 
+use Wikimedia\Rdbms\ResultWrapper;
+
 /**
  * This is a class for doing query pages; since they're almost all the same,
  * we factor out some of the functionality into a superclass, and let
index 00fca12..9d92cbd 100644 (file)
@@ -21,6 +21,8 @@
  * @ingroup SpecialPage
  */
 
+use Wikimedia\Rdbms\ResultWrapper;
+
 /**
  * Class definition for a wanted query page like
  * WantedPages, WantedTemplates, etc
index b730ecd..9aba41e 100644 (file)
@@ -21,6 +21,8 @@
  * @ingroup SpecialPage
  */
 
+use Wikimedia\Rdbms\ResultWrapper;
+
 /**
  * A special page listing redirects to non existent page. Those should be
  * fixed to point to an existing page.
index 90efef7..59351dc 100644 (file)
@@ -21,6 +21,8 @@
  * @ingroup SpecialPage
  */
 
+use Wikimedia\Rdbms\ResultWrapper;
+
 /**
  * A special page listing redirects to redirecting page.
  * The software will automatically not follow double redirects, to prevent loops.
index a2fa844..a1f5efa 100644 (file)
@@ -22,6 +22,8 @@
  * @author Brion Vibber
  */
 
+use Wikimedia\Rdbms\ResultWrapper;
+
 /**
  * Special:LinkSearch to search the external-links table.
  * @ingroup SpecialPage
index dbe5c2f..52c710d 100644 (file)
@@ -24,6 +24,8 @@
  * @author Brian Wolff
  */
 
+use Wikimedia\Rdbms\ResultWrapper;
+
 /**
  * Special:ListDuplicatedFiles Lists all files where the current version is
  *   a duplicate of the current version of some other file.
index d034a6c..b2d6a33 100644 (file)
@@ -24,6 +24,8 @@
  * @author Rob Church <robchur@gmail.com>
  */
 
+use Wikimedia\Rdbms\ResultWrapper;
+
 /**
  * Special:Listredirects - Lists all the redirects on the wiki.
  * @ingroup SpecialPage
index 1cb6549..a88767a 100644 (file)
@@ -22,6 +22,8 @@
  * @author Brian Wolff
  */
 
+use Wikimedia\Rdbms\ResultWrapper;
+
 /**
  * @ingroup SpecialPage
  */
index 6095412..0776eec 100644 (file)
@@ -24,6 +24,8 @@
  * @author Ã†var Arnfjörð Bjarmason <avarab@gmail.com>
  */
 
+use Wikimedia\Rdbms\ResultWrapper;
+
 /**
  * A special page that list pages that have highest category count
  *
index 210c4a2..8560dca 100644 (file)
@@ -24,6 +24,8 @@
  * @author Umherirrender
  */
 
+use Wikimedia\Rdbms\ResultWrapper;
+
 /**
  * A special page that listed pages that have highest interwiki count
  *
index 712574c..ff8550d 100644 (file)
@@ -25,6 +25,8 @@
  * @author Rob Church <robchur@gmail.com>
  */
 
+use Wikimedia\Rdbms\ResultWrapper;
+
 /**
  * A special page to show pages ordered by the number of pages linking to them.
  *
index 41678cb..699940b 100644 (file)
@@ -24,6 +24,8 @@
  * @author Ã†var Arnfjörð Bjarmason <avarab@gmail.com>
  */
 
+use Wikimedia\Rdbms\ResultWrapper;
+
 /**
  * A querypage to show categories ordered in descending order by the pages in them
  *
index d102791..f5c2c5f 100644 (file)
@@ -22,6 +22,8 @@
  * @author Rob Church <robchur@gmail.com>
  */
 
+use Wikimedia\Rdbms\ResultWrapper;
+
 /**
  * Special page lists templates with a large number of
  * transclusion links, i.e. "most used" templates
index 5bdae15..8e20d88 100644 (file)
@@ -21,8 +21,6 @@
  * @ingroup SpecialPage
  */
 
-use MediaWiki\Linker\LinkRenderer;
-
 /**
  * A special page that lists protected pages
  *
@@ -273,317 +271,3 @@ class SpecialProtectedpages extends SpecialPage {
                return 'maintenance';
        }
 }
-
-/**
- * @todo document
- * @ingroup Pager
- */
-class ProtectedPagesPager extends TablePager {
-       public $mForm, $mConds;
-       private $type, $level, $namespace, $sizetype, $size, $indefonly, $cascadeonly, $noredirect;
-
-       /**
-        * @var LinkRenderer
-        */
-       private $linkRenderer;
-
-       /**
-        * @param SpecialProtectedpages $form
-        * @param array $conds
-        * @param $type
-        * @param $level
-        * @param $namespace
-        * @param string $sizetype
-        * @param int $size
-        * @param bool $indefonly
-        * @param bool $cascadeonly
-        * @param bool $noredirect
-        * @param LinkRenderer $linkRenderer
-        */
-       function __construct( $form, $conds = [], $type, $level, $namespace,
-               $sizetype = '', $size = 0, $indefonly = false, $cascadeonly = false, $noredirect = false,
-               LinkRenderer $linkRenderer
-       ) {
-               $this->mForm = $form;
-               $this->mConds = $conds;
-               $this->type = ( $type ) ? $type : 'edit';
-               $this->level = $level;
-               $this->namespace = $namespace;
-               $this->sizetype = $sizetype;
-               $this->size = intval( $size );
-               $this->indefonly = (bool)$indefonly;
-               $this->cascadeonly = (bool)$cascadeonly;
-               $this->noredirect = (bool)$noredirect;
-               $this->linkRenderer = $linkRenderer;
-               parent::__construct( $form->getContext() );
-       }
-
-       function preprocessResults( $result ) {
-               # Do a link batch query
-               $lb = new LinkBatch;
-               $userids = [];
-
-               foreach ( $result as $row ) {
-                       $lb->add( $row->page_namespace, $row->page_title );
-                       // field is nullable, maybe null on old protections
-                       if ( $row->log_user !== null ) {
-                               $userids[] = $row->log_user;
-                       }
-               }
-
-               // fill LinkBatch with user page and user talk
-               if ( count( $userids ) ) {
-                       $userCache = UserCache::singleton();
-                       $userCache->doQuery( $userids, [], __METHOD__ );
-                       foreach ( $userids as $userid ) {
-                               $name = $userCache->getProp( $userid, 'name' );
-                               if ( $name !== false ) {
-                                       $lb->add( NS_USER, $name );
-                                       $lb->add( NS_USER_TALK, $name );
-                               }
-                       }
-               }
-
-               $lb->execute();
-       }
-
-       function getFieldNames() {
-               static $headers = null;
-
-               if ( $headers == [] ) {
-                       $headers = [
-                               'log_timestamp' => 'protectedpages-timestamp',
-                               'pr_page' => 'protectedpages-page',
-                               'pr_expiry' => 'protectedpages-expiry',
-                               'log_user' => 'protectedpages-performer',
-                               'pr_params' => 'protectedpages-params',
-                               'log_comment' => 'protectedpages-reason',
-                       ];
-                       foreach ( $headers as $key => $val ) {
-                               $headers[$key] = $this->msg( $val )->text();
-                       }
-               }
-
-               return $headers;
-       }
-
-       /**
-        * @param string $field
-        * @param string $value
-        * @return string HTML
-        * @throws MWException
-        */
-       function formatValue( $field, $value ) {
-               /** @var $row object */
-               $row = $this->mCurrentRow;
-
-               switch ( $field ) {
-                       case 'log_timestamp':
-                               // when timestamp is null, this is a old protection row
-                               if ( $value === null ) {
-                                       $formatted = Html::rawElement(
-                                               'span',
-                                               [ 'class' => 'mw-protectedpages-unknown' ],
-                                               $this->msg( 'protectedpages-unknown-timestamp' )->escaped()
-                                       );
-                               } else {
-                                       $formatted = htmlspecialchars( $this->getLanguage()->userTimeAndDate(
-                                               $value, $this->getUser() ) );
-                               }
-                               break;
-
-                       case 'pr_page':
-                               $title = Title::makeTitleSafe( $row->page_namespace, $row->page_title );
-                               if ( !$title ) {
-                                       $formatted = Html::element(
-                                               'span',
-                                               [ 'class' => 'mw-invalidtitle' ],
-                                               Linker::getInvalidTitleDescription(
-                                                       $this->getContext(),
-                                                       $row->page_namespace,
-                                                       $row->page_title
-                                               )
-                                       );
-                               } else {
-                                       $formatted = $this->linkRenderer->makeLink( $title );
-                               }
-                               if ( !is_null( $row->page_len ) ) {
-                                       $formatted .= $this->getLanguage()->getDirMark() .
-                                               ' ' . Html::rawElement(
-                                               'span',
-                                               [ 'class' => 'mw-protectedpages-length' ],
-                                               Linker::formatRevisionSize( $row->page_len )
-                                       );
-                               }
-                               break;
-
-                       case 'pr_expiry':
-                               $formatted = htmlspecialchars( $this->getLanguage()->formatExpiry(
-                                       $value, /* User preference timezone */true ) );
-                               $title = Title::makeTitleSafe( $row->page_namespace, $row->page_title );
-                               if ( $this->getUser()->isAllowed( 'protect' ) && $title ) {
-                                       $changeProtection = $this->linkRenderer->makeKnownLink(
-                                               $title,
-                                               $this->msg( 'protect_change' )->text(),
-                                               [],
-                                               [ 'action' => 'unprotect' ]
-                                       );
-                                       $formatted .= ' ' . Html::rawElement(
-                                               'span',
-                                               [ 'class' => 'mw-protectedpages-actions' ],
-                                               $this->msg( 'parentheses' )->rawParams( $changeProtection )->escaped()
-                                       );
-                               }
-                               break;
-
-                       case 'log_user':
-                               // when timestamp is null, this is a old protection row
-                               if ( $row->log_timestamp === null ) {
-                                       $formatted = Html::rawElement(
-                                               'span',
-                                               [ 'class' => 'mw-protectedpages-unknown' ],
-                                               $this->msg( 'protectedpages-unknown-performer' )->escaped()
-                                       );
-                               } else {
-                                       $username = UserCache::singleton()->getProp( $value, 'name' );
-                                       if ( LogEventsList::userCanBitfield(
-                                               $row->log_deleted,
-                                               LogPage::DELETED_USER,
-                                               $this->getUser()
-                                       ) ) {
-                                               if ( $username === false ) {
-                                                       $formatted = htmlspecialchars( $value );
-                                               } else {
-                                                       $formatted = Linker::userLink( $value, $username )
-                                                               . Linker::userToolLinks( $value, $username );
-                                               }
-                                       } else {
-                                               $formatted = $this->msg( 'rev-deleted-user' )->escaped();
-                                       }
-                                       if ( LogEventsList::isDeleted( $row, LogPage::DELETED_USER ) ) {
-                                               $formatted = '<span class="history-deleted">' . $formatted . '</span>';
-                                       }
-                               }
-                               break;
-
-                       case 'pr_params':
-                               $params = [];
-                               // Messages: restriction-level-sysop, restriction-level-autoconfirmed
-                               $params[] = $this->msg( 'restriction-level-' . $row->pr_level )->escaped();
-                               if ( $row->pr_cascade ) {
-                                       $params[] = $this->msg( 'protect-summary-cascade' )->escaped();
-                               }
-                               $formatted = $this->getLanguage()->commaList( $params );
-                               break;
-
-                       case 'log_comment':
-                               // when timestamp is null, this is an old protection row
-                               if ( $row->log_timestamp === null ) {
-                                       $formatted = Html::rawElement(
-                                               'span',
-                                               [ 'class' => 'mw-protectedpages-unknown' ],
-                                               $this->msg( 'protectedpages-unknown-reason' )->escaped()
-                                       );
-                               } else {
-                                       if ( LogEventsList::userCanBitfield(
-                                               $row->log_deleted,
-                                               LogPage::DELETED_COMMENT,
-                                               $this->getUser()
-                                       ) ) {
-                                               $formatted = Linker::formatComment( $value !== null ? $value : '' );
-                                       } else {
-                                               $formatted = $this->msg( 'rev-deleted-comment' )->escaped();
-                                       }
-                                       if ( LogEventsList::isDeleted( $row, LogPage::DELETED_COMMENT ) ) {
-                                               $formatted = '<span class="history-deleted">' . $formatted . '</span>';
-                                       }
-                               }
-                               break;
-
-                       default:
-                               throw new MWException( "Unknown field '$field'" );
-               }
-
-               return $formatted;
-       }
-
-       function getQueryInfo() {
-               $conds = $this->mConds;
-               $conds[] = 'pr_expiry > ' . $this->mDb->addQuotes( $this->mDb->timestamp() ) .
-                       ' OR pr_expiry IS NULL';
-               $conds[] = 'page_id=pr_page';
-               $conds[] = 'pr_type=' . $this->mDb->addQuotes( $this->type );
-
-               if ( $this->sizetype == 'min' ) {
-                       $conds[] = 'page_len>=' . $this->size;
-               } elseif ( $this->sizetype == 'max' ) {
-                       $conds[] = 'page_len<=' . $this->size;
-               }
-
-               if ( $this->indefonly ) {
-                       $infinity = $this->mDb->addQuotes( $this->mDb->getInfinity() );
-                       $conds[] = "pr_expiry = $infinity OR pr_expiry IS NULL";
-               }
-               if ( $this->cascadeonly ) {
-                       $conds[] = 'pr_cascade = 1';
-               }
-               if ( $this->noredirect ) {
-                       $conds[] = 'page_is_redirect = 0';
-               }
-
-               if ( $this->level ) {
-                       $conds[] = 'pr_level=' . $this->mDb->addQuotes( $this->level );
-               }
-               if ( !is_null( $this->namespace ) ) {
-                       $conds[] = 'page_namespace=' . $this->mDb->addQuotes( $this->namespace );
-               }
-
-               return [
-                       'tables' => [ 'page', 'page_restrictions', 'log_search', 'logging' ],
-                       'fields' => [
-                               'pr_id',
-                               'page_namespace',
-                               'page_title',
-                               'page_len',
-                               'pr_type',
-                               'pr_level',
-                               'pr_expiry',
-                               'pr_cascade',
-                               'log_timestamp',
-                               'log_user',
-                               'log_comment',
-                               'log_deleted',
-                       ],
-                       'conds' => $conds,
-                       'join_conds' => [
-                               'log_search' => [
-                                       'LEFT JOIN', [
-                                               'ls_field' => 'pr_id', 'ls_value = ' . $this->mDb->buildStringCast( 'pr_id' )
-                                       ]
-                               ],
-                               'logging' => [
-                                       'LEFT JOIN', [
-                                               'ls_log_id = log_id'
-                                       ]
-                               ]
-                       ]
-               ];
-       }
-
-       protected function getTableClass() {
-               return parent::getTableClass() . ' mw-protectedpages';
-       }
-
-       function getIndexField() {
-               return 'pr_id';
-       }
-
-       function getDefaultSort() {
-               return 'pr_id';
-       }
-
-       function isFieldSortable( $field ) {
-               // no index for sorting exists
-               return false;
-       }
-}
index 1505308..cdad926 100644 (file)
@@ -22,6 +22,7 @@
  */
 
 use MediaWiki\MediaWikiServices;
+use Wikimedia\Rdbms\ResultWrapper;
 
 /**
  * A special page that lists last changes made to the wiki
@@ -456,12 +457,7 @@ class SpecialRecentChanges extends ChangesListSpecialPage {
                $panelString = implode( "\n", $panel );
 
                // Insert a placeholder for RCFilters
-               if ( $this->getUser()->getOption(
-                               'rcenhancedfilters',
-                               /*default=*/ null,
-                               /*ignoreHidden=*/ true
-                       )
-               ) {
+               if ( $this->getUser()->getOption( 'rcenhancedfilters' ) ) {
                        $this->getOutput()->addHTML(
                                Html::element(
                                        'div',
@@ -541,12 +537,7 @@ class SpecialRecentChanges extends ChangesListSpecialPage {
                parent::addModules();
                $out = $this->getOutput();
                $out->addModules( 'mediawiki.special.recentchanges' );
-               if ( $this->getUser()->getOption(
-                               'rcenhancedfilters',
-                               /*default=*/ null,
-                               /*ignoreHidden=*/ true
-                       )
-               ) {
+               if ( $this->getUser()->getOption( 'rcenhancedfilters' ) ) {
                        $out->addModules( 'mediawiki.rcfilters.filters.ui' );
                        $out->addModuleStyles( 'mediawiki.rcfilters.filters.base.styles' );
                }
index a78b082..a5e5113 100644 (file)
@@ -21,6 +21,8 @@
  * @ingroup SpecialPage
  */
 
+use Wikimedia\Rdbms\ResultWrapper;
+
 /**
  * SpecialShortpages extends QueryPage. It is used to return the shortest
  * pages in the database.
index d5c24c2..56920b3 100644 (file)
@@ -21,6 +21,7 @@
  * @ingroup SpecialPage
  */
 use MediaWiki\MediaWikiServices;
+use Wikimedia\Rdbms\ResultWrapper;
 
 /**
  * Used to show archived pages and eventually restore them.
index 96878a3..e82279e 100644 (file)
@@ -24,6 +24,8 @@
  * @author Ã†var Arnfjörð Bjarmason <avarab@gmail.com>
  */
 
+use Wikimedia\Rdbms\ResultWrapper;
+
 /**
  * A special page that displays a list of pages that are not on anyones watchlist.
  *
index 85ac2de..822648b 100644 (file)
@@ -22,6 +22,7 @@
  */
 
 use MediaWiki\MediaWikiServices;
+use Wikimedia\Rdbms\ResultWrapper;
 
 /**
  * A special page that lists last changes made to the wiki,
index efc51ef..ca1b7dc 100644 (file)
@@ -19,6 +19,8 @@
  * @ingroup Pager
  */
 
+use Wikimedia\Rdbms\FakeResultWrapper;
+
 /**
  * Use TablePager for prettified output. We have to pretend that we're
  * getting data from a table when in fact not all of it comes from the database.
index a4124db..9a447ef 100644 (file)
@@ -23,6 +23,7 @@
  * @ingroup Pager
  */
 use MediaWiki\MediaWikiServices;
+use Wikimedia\Rdbms\ResultWrapper;
 
 class BlockListPager extends TablePager {
 
index fb8d8f6..5126bad 100644 (file)
@@ -24,6 +24,8 @@
  * @ingroup Pager
  */
 use MediaWiki\MediaWikiServices;
+use Wikimedia\Rdbms\ResultWrapper;
+use Wikimedia\Rdbms\FakeResultWrapper;
 
 class ContribsPager extends ReverseChronologicalPager {
 
index 2425dd5..a1f6b84 100644 (file)
@@ -23,6 +23,8 @@
  * @ingroup Pager
  */
 use MediaWiki\MediaWikiServices;
+use Wikimedia\Rdbms\ResultWrapper;
+use Wikimedia\Rdbms\FakeResultWrapper;
 
 class DeletedContribsPager extends IndexPager {
 
index 4c1e8ee..3789dfa 100644 (file)
@@ -23,6 +23,8 @@
  * @ingroup Pager
  */
 use MediaWiki\MediaWikiServices;
+use Wikimedia\Rdbms\ResultWrapper;
+use Wikimedia\Rdbms\FakeResultWrapper;
 
 class ImageListPager extends TablePager {
 
diff --git a/includes/specials/pagers/ProtectedPagesPager.php b/includes/specials/pagers/ProtectedPagesPager.php
new file mode 100644 (file)
index 0000000..45dced8
--- /dev/null
@@ -0,0 +1,335 @@
+<?php
+/**
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ * @ingroup Pager
+ */
+
+use \MediaWiki\Linker\LinkRenderer;
+
+/**
+ * @todo document
+ */
+class ProtectedPagesPager extends TablePager {
+       public $mForm, $mConds;
+       private $type, $level, $namespace, $sizetype, $size, $indefonly, $cascadeonly, $noredirect;
+
+       /**
+        * @var LinkRenderer
+        */
+       private $linkRenderer;
+
+       /**
+        * @param SpecialProtectedpages $form
+        * @param array $conds
+        * @param $type
+        * @param $level
+        * @param $namespace
+        * @param string $sizetype
+        * @param int $size
+        * @param bool $indefonly
+        * @param bool $cascadeonly
+        * @param bool $noredirect
+        * @param LinkRenderer $linkRenderer
+        */
+       function __construct( $form, $conds = [], $type, $level, $namespace,
+               $sizetype = '', $size = 0, $indefonly = false, $cascadeonly = false, $noredirect = false,
+               LinkRenderer $linkRenderer
+       ) {
+               $this->mForm = $form;
+               $this->mConds = $conds;
+               $this->type = ( $type ) ? $type : 'edit';
+               $this->level = $level;
+               $this->namespace = $namespace;
+               $this->sizetype = $sizetype;
+               $this->size = intval( $size );
+               $this->indefonly = (bool)$indefonly;
+               $this->cascadeonly = (bool)$cascadeonly;
+               $this->noredirect = (bool)$noredirect;
+               $this->linkRenderer = $linkRenderer;
+               parent::__construct( $form->getContext() );
+       }
+
+       function preprocessResults( $result ) {
+               # Do a link batch query
+               $lb = new LinkBatch;
+               $userids = [];
+
+               foreach ( $result as $row ) {
+                       $lb->add( $row->page_namespace, $row->page_title );
+                       // field is nullable, maybe null on old protections
+                       if ( $row->log_user !== null ) {
+                               $userids[] = $row->log_user;
+                       }
+               }
+
+               // fill LinkBatch with user page and user talk
+               if ( count( $userids ) ) {
+                       $userCache = UserCache::singleton();
+                       $userCache->doQuery( $userids, [], __METHOD__ );
+                       foreach ( $userids as $userid ) {
+                               $name = $userCache->getProp( $userid, 'name' );
+                               if ( $name !== false ) {
+                                       $lb->add( NS_USER, $name );
+                                       $lb->add( NS_USER_TALK, $name );
+                               }
+                       }
+               }
+
+               $lb->execute();
+       }
+
+       function getFieldNames() {
+               static $headers = null;
+
+               if ( $headers == [] ) {
+                       $headers = [
+                               'log_timestamp' => 'protectedpages-timestamp',
+                               'pr_page' => 'protectedpages-page',
+                               'pr_expiry' => 'protectedpages-expiry',
+                               'log_user' => 'protectedpages-performer',
+                               'pr_params' => 'protectedpages-params',
+                               'log_comment' => 'protectedpages-reason',
+                       ];
+                       foreach ( $headers as $key => $val ) {
+                               $headers[$key] = $this->msg( $val )->text();
+                       }
+               }
+
+               return $headers;
+       }
+
+       /**
+        * @param string $field
+        * @param string $value
+        * @return string HTML
+        * @throws MWException
+        */
+       function formatValue( $field, $value ) {
+               /** @var $row object */
+               $row = $this->mCurrentRow;
+
+               switch ( $field ) {
+                       case 'log_timestamp':
+                               // when timestamp is null, this is a old protection row
+                               if ( $value === null ) {
+                                       $formatted = Html::rawElement(
+                                               'span',
+                                               [ 'class' => 'mw-protectedpages-unknown' ],
+                                               $this->msg( 'protectedpages-unknown-timestamp' )->escaped()
+                                       );
+                               } else {
+                                       $formatted = htmlspecialchars( $this->getLanguage()->userTimeAndDate(
+                                               $value, $this->getUser() ) );
+                               }
+                               break;
+
+                       case 'pr_page':
+                               $title = Title::makeTitleSafe( $row->page_namespace, $row->page_title );
+                               if ( !$title ) {
+                                       $formatted = Html::element(
+                                               'span',
+                                               [ 'class' => 'mw-invalidtitle' ],
+                                               Linker::getInvalidTitleDescription(
+                                                       $this->getContext(),
+                                                       $row->page_namespace,
+                                                       $row->page_title
+                                               )
+                                       );
+                               } else {
+                                       $formatted = $this->linkRenderer->makeLink( $title );
+                               }
+                               if ( !is_null( $row->page_len ) ) {
+                                       $formatted .= $this->getLanguage()->getDirMark() .
+                                               ' ' . Html::rawElement(
+                                                       'span',
+                                                       [ 'class' => 'mw-protectedpages-length' ],
+                                                       Linker::formatRevisionSize( $row->page_len )
+                                               );
+                               }
+                               break;
+
+                       case 'pr_expiry':
+                               $formatted = htmlspecialchars( $this->getLanguage()->formatExpiry(
+                                       $value, /* User preference timezone */true ) );
+                               $title = Title::makeTitleSafe( $row->page_namespace, $row->page_title );
+                               if ( $this->getUser()->isAllowed( 'protect' ) && $title ) {
+                                       $changeProtection = $this->linkRenderer->makeKnownLink(
+                                               $title,
+                                               $this->msg( 'protect_change' )->text(),
+                                               [],
+                                               [ 'action' => 'unprotect' ]
+                                       );
+                                       $formatted .= ' ' . Html::rawElement(
+                                                       'span',
+                                                       [ 'class' => 'mw-protectedpages-actions' ],
+                                                       $this->msg( 'parentheses' )->rawParams( $changeProtection )->escaped()
+                                               );
+                               }
+                               break;
+
+                       case 'log_user':
+                               // when timestamp is null, this is a old protection row
+                               if ( $row->log_timestamp === null ) {
+                                       $formatted = Html::rawElement(
+                                               'span',
+                                               [ 'class' => 'mw-protectedpages-unknown' ],
+                                               $this->msg( 'protectedpages-unknown-performer' )->escaped()
+                                       );
+                               } else {
+                                       $username = UserCache::singleton()->getProp( $value, 'name' );
+                                       if ( LogEventsList::userCanBitfield(
+                                               $row->log_deleted,
+                                               LogPage::DELETED_USER,
+                                               $this->getUser()
+                                       ) ) {
+                                               if ( $username === false ) {
+                                                       $formatted = htmlspecialchars( $value );
+                                               } else {
+                                                       $formatted = Linker::userLink( $value, $username )
+                                                               . Linker::userToolLinks( $value, $username );
+                                               }
+                                       } else {
+                                               $formatted = $this->msg( 'rev-deleted-user' )->escaped();
+                                       }
+                                       if ( LogEventsList::isDeleted( $row, LogPage::DELETED_USER ) ) {
+                                               $formatted = '<span class="history-deleted">' . $formatted . '</span>';
+                                       }
+                               }
+                               break;
+
+                       case 'pr_params':
+                               $params = [];
+                               // Messages: restriction-level-sysop, restriction-level-autoconfirmed
+                               $params[] = $this->msg( 'restriction-level-' . $row->pr_level )->escaped();
+                               if ( $row->pr_cascade ) {
+                                       $params[] = $this->msg( 'protect-summary-cascade' )->escaped();
+                               }
+                               $formatted = $this->getLanguage()->commaList( $params );
+                               break;
+
+                       case 'log_comment':
+                               // when timestamp is null, this is an old protection row
+                               if ( $row->log_timestamp === null ) {
+                                       $formatted = Html::rawElement(
+                                               'span',
+                                               [ 'class' => 'mw-protectedpages-unknown' ],
+                                               $this->msg( 'protectedpages-unknown-reason' )->escaped()
+                                       );
+                               } else {
+                                       if ( LogEventsList::userCanBitfield(
+                                               $row->log_deleted,
+                                               LogPage::DELETED_COMMENT,
+                                               $this->getUser()
+                                       ) ) {
+                                               $formatted = Linker::formatComment( $value !== null ? $value : '' );
+                                       } else {
+                                               $formatted = $this->msg( 'rev-deleted-comment' )->escaped();
+                                       }
+                                       if ( LogEventsList::isDeleted( $row, LogPage::DELETED_COMMENT ) ) {
+                                               $formatted = '<span class="history-deleted">' . $formatted . '</span>';
+                                       }
+                               }
+                               break;
+
+                       default:
+                               throw new MWException( "Unknown field '$field'" );
+               }
+
+               return $formatted;
+       }
+
+       function getQueryInfo() {
+               $conds = $this->mConds;
+               $conds[] = 'pr_expiry > ' . $this->mDb->addQuotes( $this->mDb->timestamp() ) .
+                       ' OR pr_expiry IS NULL';
+               $conds[] = 'page_id=pr_page';
+               $conds[] = 'pr_type=' . $this->mDb->addQuotes( $this->type );
+
+               if ( $this->sizetype == 'min' ) {
+                       $conds[] = 'page_len>=' . $this->size;
+               } elseif ( $this->sizetype == 'max' ) {
+                       $conds[] = 'page_len<=' . $this->size;
+               }
+
+               if ( $this->indefonly ) {
+                       $infinity = $this->mDb->addQuotes( $this->mDb->getInfinity() );
+                       $conds[] = "pr_expiry = $infinity OR pr_expiry IS NULL";
+               }
+               if ( $this->cascadeonly ) {
+                       $conds[] = 'pr_cascade = 1';
+               }
+               if ( $this->noredirect ) {
+                       $conds[] = 'page_is_redirect = 0';
+               }
+
+               if ( $this->level ) {
+                       $conds[] = 'pr_level=' . $this->mDb->addQuotes( $this->level );
+               }
+               if ( !is_null( $this->namespace ) ) {
+                       $conds[] = 'page_namespace=' . $this->mDb->addQuotes( $this->namespace );
+               }
+
+               return [
+                       'tables' => [ 'page', 'page_restrictions', 'log_search', 'logging' ],
+                       'fields' => [
+                               'pr_id',
+                               'page_namespace',
+                               'page_title',
+                               'page_len',
+                               'pr_type',
+                               'pr_level',
+                               'pr_expiry',
+                               'pr_cascade',
+                               'log_timestamp',
+                               'log_user',
+                               'log_comment',
+                               'log_deleted',
+                       ],
+                       'conds' => $conds,
+                       'join_conds' => [
+                               'log_search' => [
+                                       'LEFT JOIN', [
+                                               'ls_field' => 'pr_id', 'ls_value = ' . $this->mDb->buildStringCast( 'pr_id' )
+                                       ]
+                               ],
+                               'logging' => [
+                                       'LEFT JOIN', [
+                                               'ls_log_id = log_id'
+                                       ]
+                               ]
+                       ]
+               ];
+       }
+
+       protected function getTableClass() {
+               return parent::getTableClass() . ' mw-protectedpages';
+       }
+
+       function getIndexField() {
+               return 'pr_id';
+       }
+
+       function getDefaultSort() {
+               return 'pr_id';
+       }
+
+       function isFieldSortable( $field ) {
+               // no index for sorting exists
+               return false;
+       }
+}
index dddc850..ab6683b 100644 (file)
@@ -20,6 +20,8 @@
  * @file
  */
 
+use Wikimedia\Rdbms\ResultWrapper;
+
 abstract class UserArray implements Iterator {
        /**
         * @param ResultWrapper $res
@@ -38,7 +40,7 @@ abstract class UserArray implements Iterator {
 
        /**
         * @param array $ids
-        * @return UserArrayFromResult
+        * @return UserArrayFromResult|ArrayIterator
         */
        static function newFromIDs( $ids ) {
                $ids = array_map( 'intval', (array)$ids ); // paranoia
@@ -59,7 +61,7 @@ abstract class UserArray implements Iterator {
        /**
         * @since 1.25
         * @param array $names
-        * @return UserArrayFromResult
+        * @return UserArrayFromResult|ArrayIterator
         */
        static function newFromNames( $names ) {
                $names = array_map( 'strval', (array)$names ); // paranoia
index fb533d0..527df7f 100644 (file)
@@ -20,6 +20,8 @@
  * @file
  */
 
+use Wikimedia\Rdbms\ResultWrapper;
+
 class UserArrayFromResult extends UserArray implements Countable {
        /** @var ResultWrapper */
        public $res;
@@ -27,7 +29,7 @@ class UserArrayFromResult extends UserArray implements Countable {
        /** @var int */
        public $key;
 
-       /** @var bool|stdClass */
+       /** @var bool|User */
        public $current;
 
        /**
index b8001a4..70f3654 100644 (file)
@@ -23,6 +23,8 @@
 
 require_once __DIR__ . '/Maintenance.php';
 
+use Wikimedia\Rdbms\ResultWrapper;
+
 /**
  * Maintenance script to convert user options to the new `user_properties` table.
  *
diff --git a/maintenance/initUserPreference.php b/maintenance/initUserPreference.php
new file mode 100644 (file)
index 0000000..f4da570
--- /dev/null
@@ -0,0 +1,84 @@
+<?php
+/**
+ * Initialize a user preference based on the value
+ * of another preference.
+ *
+ * @ingroup Maintenance
+ */
+
+require_once __DIR__ . '/Maintenance.php';
+
+/**
+ * Maintenance script that initializes a user preference
+ * based on the value of another preference.
+ *
+ * @ingroup Maintenance
+ */
+class InitUserPreference extends Maintenance {
+       public function __construct() {
+               parent::__construct();
+               $this->addOption(
+                       'target',
+                       'Name of the user preference to initialize',
+                       true,
+                       true,
+                       't'
+               );
+               $this->addOption(
+                       'source',
+                       'Name of the user preference to take the value from',
+                       true,
+                       true,
+                       's'
+               );
+               $this->setBatchSize( 300 );
+       }
+
+       public function execute() {
+               $target = $this->getOption( 'target' );
+               $source = $this->getOption( 'source' );
+               $this->output( "Initializing '$target' based on the value of '$source'\n" );
+
+               $dbr = $this->getDB( DB_REPLICA );
+               $dbw = $this->getDB( DB_MASTER );
+
+               $iterator = new BatchRowIterator(
+                       $dbr,
+                       'user_properties',
+                       [ 'up_user', 'up_property' ],
+                       $this->mBatchSize
+               );
+               $iterator->setFetchColumns( [ 'up_user', 'up_value' ] );
+               $iterator->addConditions( [
+                       'up_property' => $source,
+                       'up_value IS NOT NULL',
+                       'up_value != 0',
+               ] );
+
+               $processed = 0;
+               foreach ( $iterator as $batch ) {
+                       foreach ( $batch as $row ) {
+                               $values = [
+                                       'up_user' => $row->up_user,
+                                       'up_property' => $target,
+                                       'up_value' => $row->up_value,
+                               ];
+                               $dbw->upsert(
+                                       'user_properties',
+                                       $values,
+                                       [ 'up_user', 'up_property' ],
+                                       $values,
+                                       __METHOD__
+                               );
+
+                               $processed += $dbw->affectedRows();
+                       }
+               }
+
+               $this->output( "Processed $processed user(s)\n" );
+               $this->output( "Finished!\n" );
+       }
+}
+
+$maintClass = 'InitUserPreference'; // Tells it to run the class
+require_once RUN_MAINTENANCE_IF_MAIN;
index 522871d..80e8011 100644 (file)
@@ -26,6 +26,7 @@
 
 use MediaWiki\Linker\LinkTarget;
 use MediaWiki\MediaWikiServices;
+use Wikimedia\Rdbms\ResultWrapper;
 
 require_once __DIR__ . '/Maintenance.php';
 
@@ -571,7 +572,7 @@ class NamespaceConflictChecker extends Maintenance {
        /**
         * Merge page histories
         *
-        * @param integer $id The page_id
+        * @param stdClass $row Page row
         * @param Title $newTitle The new title
         * @return bool
         */
index b354399..cf65c69 100644 (file)
@@ -23,6 +23,8 @@
 
 require_once __DIR__ . '/Maintenance.php';
 
+use Wikimedia\Rdbms\ResultWrapper;
+
 /**
  * Maintenance script that sends purge requests for pages edited in a date
  * range to squid/varnish.
index e42a8ef..58472e9 100644 (file)
@@ -24,6 +24,8 @@
 
 require_once __DIR__ . '/Maintenance.php';
 
+use Wikimedia\Rdbms\ResultWrapper;
+
 /**
  * Maintenance script that sends SQL queries from the specified file to the database.
  *
@@ -50,7 +52,7 @@ class MwSql extends Maintenance {
                $wiki = $this->hasOption( 'wikidb' ) ? $this->getOption( 'wikidb' ) : false;
                // Get the appropriate load balancer (for this wiki)
                if ( $this->hasOption( 'cluster' ) ) {
-                       $lb = wfGetLBFactory()->getExternalLB( $this->getOption( 'cluster' ), $wiki );
+                       $lb = wfGetLBFactory()->getExternalLB( $this->getOption( 'cluster' ) );
                } else {
                        $lb = wfGetLB( $wiki );
                }
@@ -159,7 +161,7 @@ class MwSql extends Maintenance {
 
        /**
         * Print the results, callback for $db->sourceStream()
-        * @param ResultWrapper $res The results object
+        * @param ResultWrapper|bool $res The results object
         * @param IDatabase $db
         */
        public function sqlPrintResult( $res, $db ) {
index 5406480..ea97337 100644 (file)
@@ -251,7 +251,6 @@ return [
                'scripts' => 'resources/src/jquery/jquery.highlightText.js',
                'dependencies' => [
                        'mediawiki.RegExp',
-                       'dom-level2-shim',
                ],
                'targets' => [ 'desktop', 'mobile' ],
        ],
@@ -345,7 +344,6 @@ return [
                'styles' => 'resources/src/jquery/jquery.tablesorter.less',
                'messages' => [ 'sort-descending', 'sort-ascending' ],
                'dependencies' => [
-                       'dom-level2-shim',
                        'mediawiki.RegExp',
                        'mediawiki.language.months',
                ],
@@ -736,7 +734,7 @@ return [
 
        // Deprecated since MediaWiki 1.29.0
        'json' => [
-               'deprecated' => 'Use of the "json" MediaWiki module is deprecated since MediaWiki 1.29.0',
+               'deprecated' => 'Use of the "json" module is deprecated since MediaWiki 1.29.0',
                'targets' => [ 'desktop', 'mobile' ],
        ],
 
@@ -937,7 +935,6 @@ return [
        'mediawiki.api.upload' => [
                'scripts' => 'resources/src/mediawiki/api/upload.js',
                'dependencies' => [
-                       'dom-level2-shim',
                        'mediawiki.api',
                        'mediawiki.api.edit',
                ],
@@ -1220,7 +1217,6 @@ return [
        'mediawiki.Upload' => [
                'scripts' => 'resources/src/mediawiki/mediawiki.Upload.js',
                'dependencies' => [
-                       'dom-level2-shim',
                        'mediawiki.api.upload',
                ],
        ],
@@ -1612,7 +1608,6 @@ return [
                        'mediawiki.util',
                        'mediawiki.language',
                        'user.options',
-                       'dom-level2-shim',
                ],
                'targets' => [ 'desktop', 'mobile' ],
        ],
@@ -2490,11 +2485,10 @@ return [
        ],
 
        /* dom-level2-shim */
-       // IE 8
+       // Deprecated since MediaWiki 1.29.0
        'dom-level2-shim' => [
-               'scripts' => 'resources/src/polyfill-nodeTypes.js',
+               'deprecated' => 'Use of the "dom-level2-shim" module is deprecated since MediaWiki 1.29.0',
                'targets' => [ 'desktop', 'mobile' ],
-               'skipFunction' => 'resources/src/dom-level2-skip.js',
        ],
 
        /* OOjs */
diff --git a/resources/src/dom-level2-skip.js b/resources/src/dom-level2-skip.js
deleted file mode 100644 (file)
index 484c295..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-/*!
- * Skip function for dom-level2-shim module.
- *
- * Tests for window.Node because that's the only thing that this shim is adding.
- */
-return !!window.Node;
index af42f34..746907b 100644 (file)
                        window.addEventListener( 'popstate', function () {
                                controller.updateChangesList();
                        } );
+
+                       $( 'a.mw-helplink' ).attr(
+                               'href',
+                               'https://www.mediawiki.org/wiki/Special:MyLanguage/Help:New_filters_for_edit_review'
+                       );
                }
        };
 
index cad3dce..5d6c30d 100644 (file)
@@ -40,7 +40,7 @@
                                icon: 'feedback',
                                flags: [ 'progressive' ],
                                label: mw.msg( 'rcfilters-filterlist-feedbacklink' ),
-                               href: 'https://www.mediawiki.org/wiki/Help_talk:Edit_Review_Improvements/RC_filters'
+                               href: 'https://www.mediawiki.org/wiki/Help_talk:New_filters_for_edit_review'
                        } ).$element
                );
 
index fdaa989..6b3971e 100644 (file)
                                payload += $.byteLength( module.script.toString() );
                        }
 
+                       // Tally templates and messages. Calculate their JSON size so that keys
+                       // are included in the module size - in the case of messages, keys can be
+                       // longer than values - and so that empty objects are also included.
+                       $.each( [ module.templates, module.messages ], function ( i, object ) {
+                               if ( object ) {
+                                       payload += $.byteLength( JSON.stringify( object ) );
+                               }
+                       } );
+
                        return payload;
                },
 
diff --git a/resources/src/polyfill-nodeTypes.js b/resources/src/polyfill-nodeTypes.js
deleted file mode 100644 (file)
index c8acc86..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-/**
- * Adds window.Node with node types according to:
- * https://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-1950641247
- */
-
-window.Node = window.Node || {
-       ELEMENT_NODE: 1,
-       ATTRIBUTE_NODE: 2,
-       TEXT_NODE: 3,
-       CDATA_SECTION_NODE: 4,
-       ENTITY_REFERENCE_NODE: 5,
-       ENTITY_NODE: 6,
-       PROCESSING_INSTRUCTION_NODE: 7,
-       COMMENT_NODE: 8,
-       DOCUMENT_NODE: 9,
-       DOCUMENT_TYPE_NODE: 10,
-       DOCUMENT_FRAGMENT_NODE: 11,
-       NOTATION_NODE: 12
-};
index 7edde2a..35c2480 100644 (file)
@@ -974,10 +974,9 @@ class ParserTestRunner {
                        'wgEnableUploads' => self::getOptionValue( 'wgEnableUploads', $opts, true ),
                        'wgLanguageCode' => $langCode,
                        'wgRawHtml' => self::getOptionValue( 'wgRawHtml', $opts, false ),
-                       'wgNamespacesWithSubpages' => [
-                               0 => isset( $opts['subpage'] ),
-                               2 => isset( $opts['subpage'] ),
-                       ],
+                       'wgNamespacesWithSubpages' => array_fill_keys(
+                               MWNamespace::getValidNamespaces(), isset( $opts['subpage'] )
+                       ),
                        'wgMaxTocLevel' => $maxtoclevel,
                        'wgAllowExternalImages' => self::getOptionValue( 'wgAllowExternalImages', $opts, true ),
                        'wgThumbLimits' => [ self::getOptionValue( 'thumbsize', $opts, 180 ) ],
index 4227693..d7ad1d1 100644 (file)
@@ -1,6 +1,40 @@
 <?php
 
 class DeferredUpdatesTest extends MediaWikiTestCase {
+
+       /**
+        * @covers DeferredUpdates::getPendingUpdates
+        */
+       public function testGetPendingUpdates() {
+               # Prevent updates from running
+               $this->setMwGlobals( 'wgCommandLineMode', false );
+
+               $pre = DeferredUpdates::PRESEND;
+               $post = DeferredUpdates::POSTSEND;
+               $all = DeferredUpdates::ALL;
+
+               $update = $this->getMockBuilder( 'DeferrableUpdate' )
+                             ->getMock();
+               $update->expects( $this->never() )
+                       ->method( 'doUpdate' );
+
+               DeferredUpdates::addUpdate( $update, $pre );
+               $this->assertCount( 1, DeferredUpdates::getPendingUpdates( $pre ) );
+               $this->assertCount( 0, DeferredUpdates::getPendingUpdates( $post ) );
+               $this->assertCount( 1, DeferredUpdates::getPendingUpdates( $all ) );
+               $this->assertCount( 1, DeferredUpdates::getPendingUpdates() );
+               DeferredUpdates::clearPendingUpdates();
+               $this->assertCount( 0, DeferredUpdates::getPendingUpdates() );
+
+               DeferredUpdates::addUpdate( $update, $post );
+               $this->assertCount( 0, DeferredUpdates::getPendingUpdates( $pre ) );
+               $this->assertCount( 1, DeferredUpdates::getPendingUpdates( $post ) );
+               $this->assertCount( 1, DeferredUpdates::getPendingUpdates( $all ) );
+               $this->assertCount( 1, DeferredUpdates::getPendingUpdates() );
+               DeferredUpdates::clearPendingUpdates();
+               $this->assertCount( 0, DeferredUpdates::getPendingUpdates() );
+       }
+
        public function testDoUpdatesWeb() {
                $this->setMwGlobals( 'wgCommandLineMode', false );
 
index 94d25ee..0bd190b 100644 (file)
@@ -32,7 +32,6 @@ return [
                        'mediawiki.page.ready',
                        'mediawiki.page.startup',
                        'test.sinonjs',
-                       'dom-level2-shim',
                ],
                'position' => 'top',
                'targets' => [ 'desktop', 'mobile' ],