Merge "Add semantic tags to license info text"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Fri, 5 Jan 2018 23:57:59 +0000 (23:57 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Fri, 5 Jan 2018 23:57:59 +0000 (23:57 +0000)
605 files changed:
.mailmap
.phpcs.xml
.travis.yml
CREDITS
RELEASE-NOTES-1.31
autoload.php
composer.json
docs/hooks.txt
includes/DefaultSettings.php
includes/DeprecatedGlobal.php
includes/EditPage.php
includes/GlobalFunctions.php
includes/HistoryBlob.php
includes/HtmlFormatter.php [deleted file]
includes/Linker.php
includes/MediaWiki.php
includes/MediaWikiServices.php
includes/OutputPage.php
includes/PHPVersionCheck.php
includes/Preferences.php
includes/Revision.php
includes/ServiceWiring.php
includes/Setup.php
includes/Storage/BlobStoreFactory.php [new file with mode: 0644]
includes/Storage/RevisionLookup.php
includes/Storage/RevisionStore.php
includes/Storage/RevisionStoreRecord.php
includes/Storage/SqlBlobStore.php
includes/Title.php
includes/actions/InfoAction.php
includes/actions/WatchAction.php
includes/api/ApiBlock.php
includes/api/ApiComparePages.php
includes/api/ApiEmailUser.php
includes/api/ApiErrorFormatter.php
includes/api/ApiFormatNone.php
includes/api/ApiOptions.php
includes/api/ApiRevisionDelete.php
includes/api/ApiTag.php
includes/api/i18n/ar.json
includes/api/i18n/en.json
includes/api/i18n/es.json
includes/api/i18n/eu.json
includes/api/i18n/lb.json
includes/api/i18n/nb.json
includes/api/i18n/nl.json
includes/api/i18n/pl.json
includes/api/i18n/pt-br.json
includes/api/i18n/pt.json
includes/api/i18n/qqq.json
includes/cache/CacheDependency.php
includes/cache/CacheHelper.php
includes/cache/localisation/LocalisationCache.php
includes/changetags/ChangeTagsLogList.php
includes/changetags/ChangeTagsRevisionList.php
includes/config/ConfigFactory.php
includes/content/Content.php
includes/content/TextContentHandler.php
includes/context/MutableContext.php
includes/context/RequestContext.php
includes/db/CloneDatabase.php
includes/editpage/TextConflictHelper.php
includes/editpage/TextboxBuilder.php
includes/exception/MWExceptionHandler.php
includes/filebackend/FileBackendGroup.php
includes/filerepo/RepoGroup.php
includes/htmlform/HTMLForm.php
includes/htmlform/HTMLFormElement.php
includes/htmlform/fields/HTMLEditTools.php
includes/htmlform/fields/HTMLTextAreaField.php
includes/installer/DatabaseUpdater.php
includes/installer/Installer.php
includes/installer/MssqlUpdater.php
includes/installer/MysqlUpdater.php
includes/installer/OracleInstaller.php
includes/installer/OracleUpdater.php
includes/installer/PostgresUpdater.php
includes/installer/SqliteUpdater.php
includes/installer/i18n/ca.json
includes/installer/i18n/eu.json
includes/installer/i18n/nl-informal.json
includes/installer/i18n/nl.json
includes/installer/i18n/pl.json
includes/installer/i18n/pt.json
includes/installer/i18n/tr.json
includes/interwiki/ClassicInterwikiLookup.php
includes/jobqueue/JobQueueFederated.php
includes/jobqueue/jobs/DeleteLinksJob.php
includes/libs/CSSMin.php
includes/libs/JavaScriptMinifier.php
includes/libs/jsminplus.php
includes/libs/lockmanager/ScopedLock.php
includes/libs/objectcache/MemcachedClient.php
includes/libs/rdbms/database/Database.php
includes/libs/rdbms/exception/DBError.php
includes/libs/rdbms/loadbalancer/ILoadBalancer.php
includes/libs/rdbms/loadbalancer/LoadBalancer.php
includes/libs/stats/BufferingStatsdDataFactory.php
includes/libs/stats/IBufferingStatsdDataFactory.php
includes/libs/stats/NullStatsdDataFactory.php
includes/libs/xmp/XMP.php
includes/libs/xmp/XMPValidate.php
includes/media/Bitmap_ClientOnly.php
includes/media/FormatMetadata.php
includes/objectcache/SqlBagOStuff.php
includes/page/ImagePage.php
includes/page/PageArchive.php
includes/page/WikiPage.php
includes/parser/Parser.php
includes/parser/Preprocessor_DOM.php
includes/parser/Preprocessor_Hash.php
includes/parser/Sanitizer.php
includes/password/PasswordPolicyChecks.php
includes/poolcounter/PoolCounter.php
includes/poolcounter/PoolCounterRedis.php
includes/preferences/DefaultPreferencesFactory.php [new file with mode: 0644]
includes/preferences/PreferencesFactory.php [new file with mode: 0644]
includes/resourceloader/ResourceLoader.php
includes/resourceloader/ResourceLoaderFileModule.php
includes/resourceloader/ResourceLoaderFilePath.php
includes/resourceloader/ResourceLoaderModule.php
includes/resourceloader/ResourceLoaderUserTokensModule.php
includes/search/SearchExactMatchRescorer.php
includes/shell/Command.php
includes/shell/Shell.php
includes/skins/SkinFallbackTemplate.php
includes/specialpage/QueryPage.php
includes/specials/SpecialEditTags.php
includes/specials/SpecialExpandTemplates.php
includes/specials/SpecialExport.php
includes/specials/SpecialPreferences.php
includes/specials/SpecialProtectedpages.php
includes/specials/SpecialRecentchanges.php
includes/specials/SpecialRevisiondelete.php
includes/specials/SpecialUncategorizedcategories.php
includes/specials/SpecialUserrights.php
includes/specials/pagers/ContribsPager.php
includes/specials/pagers/ImageListPager.php
includes/specials/pagers/ProtectedPagesPager.php
includes/specials/pagers/UsersPager.php
includes/tidy/Balancer.php
includes/upload/UploadBase.php
includes/user/User.php
includes/user/UserGroupMembership.php
includes/utils/AutoloadGenerator.php
includes/utils/BatchRowWriter.php
includes/widget/ComplexNamespaceInputWidget.php
includes/widget/ComplexTitleInputWidget.php
includes/widget/DateInputWidget.php
includes/widget/DateTimeInputWidget.php
includes/widget/NamespaceInputWidget.php
includes/widget/SearchInputWidget.php
includes/widget/SelectWithInputWidget.php
includes/widget/TitleInputWidget.php
includes/widget/UserInputWidget.php
includes/widget/UsersMultiselectWidget.php
includes/widget/search/BasicSearchResultSetWidget.php
includes/widget/search/SearchFormWidget.php
includes/widget/search/SimpleSearchResultSetWidget.php
index.php
languages/Language.php
languages/LanguageConverter.php
languages/classes/LanguageBe_tarask.php
languages/classes/LanguageBg.php [deleted file]
languages/classes/LanguageEs.php [deleted file]
languages/classes/LanguageEt.php [deleted file]
languages/classes/LanguageHy.php
languages/classes/LanguageKaa.php
languages/classes/LanguageKk_cyrl.php
languages/classes/LanguageKsh.php
languages/classes/LanguageKu.php
languages/classes/LanguageKu_ku.php [deleted file]
languages/classes/LanguagePl.php [deleted file]
languages/classes/LanguageRu.php [deleted file]
languages/classes/LanguageUk.php [deleted file]
languages/classes/LanguageZh_hans.php
languages/data/CrhExceptions.php
languages/data/ZhConversion.php
languages/i18n/an.json
languages/i18n/ar.json
languages/i18n/ast.json
languages/i18n/az.json
languages/i18n/be-tarask.json
languages/i18n/bg.json
languages/i18n/bho.json
languages/i18n/bn.json
languages/i18n/br.json
languages/i18n/bs.json
languages/i18n/ca.json
languages/i18n/ce.json
languages/i18n/cs.json
languages/i18n/da.json
languages/i18n/de.json
languages/i18n/el.json
languages/i18n/en.json
languages/i18n/es.json
languages/i18n/eu.json
languages/i18n/fa.json
languages/i18n/fi.json
languages/i18n/fr.json
languages/i18n/frr.json
languages/i18n/gl.json
languages/i18n/he.json
languages/i18n/hi.json
languages/i18n/hr.json
languages/i18n/hsb.json
languages/i18n/hu.json
languages/i18n/ia.json
languages/i18n/is.json
languages/i18n/it.json
languages/i18n/ja.json
languages/i18n/kk-cyrl.json
languages/i18n/ko.json
languages/i18n/lad.json
languages/i18n/lb.json
languages/i18n/lt.json
languages/i18n/lv.json
languages/i18n/lzh.json
languages/i18n/mk.json
languages/i18n/ml.json
languages/i18n/ms.json
languages/i18n/mwl.json
languages/i18n/nb.json
languages/i18n/nl.json
languages/i18n/pl.json
languages/i18n/pnb.json
languages/i18n/ps.json
languages/i18n/pt-br.json
languages/i18n/pt.json
languages/i18n/qqq.json
languages/i18n/ru.json
languages/i18n/sd.json
languages/i18n/skr-arab.json
languages/i18n/sl.json
languages/i18n/sr-ec.json
languages/i18n/sr-el.json
languages/i18n/sv.json
languages/i18n/ta.json
languages/i18n/th.json
languages/i18n/tr.json
languages/i18n/uk.json
languages/i18n/ur.json
languages/messages/MessagesBe_tarask.php
languages/messages/MessagesBg.php
languages/messages/MessagesEs.php
languages/messages/MessagesEt.php
languages/messages/MessagesHy.php
languages/messages/MessagesKaa.php
languages/messages/MessagesKk_cyrl.php
languages/messages/MessagesKsh.php
languages/messages/MessagesKu_latn.php
languages/messages/MessagesPl.php
languages/messages/MessagesRu.php
languages/messages/MessagesUk.php
maintenance/Maintenance.php
maintenance/archives/patch-content.sql [new file with mode: 0644]
maintenance/archives/patch-content_models.sql [new file with mode: 0644]
maintenance/archives/patch-slot_roles.sql [new file with mode: 0644]
maintenance/archives/patch-slots.sql [new file with mode: 0644]
maintenance/benchmarks/Benchmarker.php
maintenance/benchmarks/bench_utf8_title_check.php
maintenance/cdb.php
maintenance/commandLine.inc
maintenance/deleteBatch.php
maintenance/doMaintenance.php
maintenance/dumpTextPass.php
maintenance/findDeprecated.php
maintenance/generateSitemap.php
maintenance/language/checkLanguage.inc
maintenance/language/zhtable/simp2trad.manual
maintenance/language/zhtable/toCN.manual
maintenance/language/zhtable/toHK.manual
maintenance/language/zhtable/toSimp.manual
maintenance/language/zhtable/toTW.manual
maintenance/language/zhtable/toTrad.manual
maintenance/language/zhtable/trad2simp.manual
maintenance/language/zhtable/tradphrases.manual
maintenance/language/zhtable/tradphrases_exclude.manual
maintenance/mergeMessageFileList.php
maintenance/moveBatch.php
maintenance/mssql/archives/patch-content.sql [new file with mode: 0644]
maintenance/mssql/archives/patch-content_models.sql [new file with mode: 0644]
maintenance/mssql/archives/patch-slot_roles.sql [new file with mode: 0644]
maintenance/mssql/archives/patch-slots.sql [new file with mode: 0644]
maintenance/mssql/tables.sql
maintenance/oracle/archives/patch-content.sql [new file with mode: 0644]
maintenance/oracle/archives/patch-content_models.sql [new file with mode: 0644]
maintenance/oracle/archives/patch-slot_roles.sql [new file with mode: 0644]
maintenance/oracle/archives/patch-slots.sql [new file with mode: 0644]
maintenance/oracle/tables.sql
maintenance/postgres/archives/patch-content-table.sql [new file with mode: 0644]
maintenance/postgres/archives/patch-content_models-table.sql [new file with mode: 0644]
maintenance/postgres/archives/patch-slot_roles-table.sql [new file with mode: 0644]
maintenance/postgres/archives/patch-slots-table.sql [new file with mode: 0644]
maintenance/postgres/tables.sql
maintenance/storage/compressOld.php
maintenance/tables.sql
maintenance/update.php
maintenance/userOptions.php
mw-config/index.php
profileinfo.php
resources/Resources.php
resources/lib/jquery.chosen/LICENSE
resources/lib/jquery.chosen/README.md [new file with mode: 0644]
resources/lib/jquery.chosen/chosen-sprite.png
resources/lib/jquery.chosen/chosen-sprite@2x.png
resources/lib/jquery.chosen/chosen.css
resources/lib/jquery.chosen/chosen.jquery.js
resources/lib/oojs-ui/oojs-ui-apex.js
resources/lib/oojs-ui/oojs-ui-core-apex.css
resources/lib/oojs-ui/oojs-ui-core-wikimediaui.css
resources/lib/oojs-ui/oojs-ui-core.js
resources/lib/oojs-ui/oojs-ui-core.js.map
resources/lib/oojs-ui/oojs-ui-toolbars-apex.css
resources/lib/oojs-ui/oojs-ui-toolbars-wikimediaui.css
resources/lib/oojs-ui/oojs-ui-toolbars.js
resources/lib/oojs-ui/oojs-ui-widgets-apex.css
resources/lib/oojs-ui/oojs-ui-widgets-wikimediaui.css
resources/lib/oojs-ui/oojs-ui-widgets.js
resources/lib/oojs-ui/oojs-ui-widgets.js.map
resources/lib/oojs-ui/oojs-ui-wikimediaui.js
resources/lib/oojs-ui/oojs-ui-windows-apex.css
resources/lib/oojs-ui/oojs-ui-windows-wikimediaui.css
resources/lib/oojs-ui/oojs-ui-windows.js
resources/lib/oojs-ui/themes/apex/icons-alerts.json
resources/lib/oojs-ui/themes/apex/icons-editing-advanced.json
resources/lib/oojs-ui/themes/apex/icons-interactions.json
resources/lib/oojs-ui/themes/apex/icons-media.json
resources/lib/oojs-ui/themes/apex/images/icons/lightbulb.png [new file with mode: 0644]
resources/lib/oojs-ui/themes/apex/images/icons/lightbulb.svg [new file with mode: 0644]
resources/lib/oojs-ui/themes/apex/images/icons/stop.png [new file with mode: 0644]
resources/lib/oojs-ui/themes/apex/images/icons/stop.svg [new file with mode: 0644]
resources/lib/oojs-ui/themes/wikimediaui/icons-alerts.json
resources/lib/oojs-ui/themes/wikimediaui/icons-editing-advanced.json
resources/lib/oojs-ui/themes/wikimediaui/icons-interactions.json
resources/lib/oojs-ui/themes/wikimediaui/images/icons/lightbulb-invert.png [new file with mode: 0644]
resources/lib/oojs-ui/themes/wikimediaui/images/icons/lightbulb-invert.svg [new file with mode: 0644]
resources/lib/oojs-ui/themes/wikimediaui/images/icons/lightbulb-progressive.png [new file with mode: 0644]
resources/lib/oojs-ui/themes/wikimediaui/images/icons/lightbulb-progressive.svg [new file with mode: 0644]
resources/lib/oojs-ui/themes/wikimediaui/images/icons/lightbulb.png [new file with mode: 0644]
resources/lib/oojs-ui/themes/wikimediaui/images/icons/lightbulb.svg [new file with mode: 0644]
resources/src/mediawiki.action/mediawiki.action.edit.styles.less
resources/src/mediawiki.rcfilters/dm/mw.rcfilters.dm.FiltersViewModel.js
resources/src/mediawiki.rcfilters/dm/mw.rcfilters.dm.SavedQueriesModel.js
resources/src/mediawiki.rcfilters/mw.rcfilters.js
resources/src/mediawiki.rcfilters/styles/mw.rcfilters.ui.Overlay.vector.less [new file with mode: 0644]
resources/src/mediawiki.rcfilters/styles/mw.rcfilters.ui.RclTargetPageWidget.less [new file with mode: 0644]
resources/src/mediawiki.rcfilters/styles/mw.rcfilters.ui.RclToOrFromWidget.less
resources/src/mediawiki.rcfilters/ui/mw.rcfilters.ui.ChangesLimitAndDateButtonWidget.js
resources/src/mediawiki.rcfilters/ui/mw.rcfilters.ui.FilterWrapperWidget.js
resources/src/mediawiki.rcfilters/ui/mw.rcfilters.ui.RclTargetPageWidget.js
resources/src/mediawiki.rcfilters/ui/mw.rcfilters.ui.SaveFiltersPopupButtonWidget.js
resources/src/mediawiki.skinning/interface.css
resources/src/mediawiki.widgets/mw.widgets.DateInputWidget.js
resources/src/mediawiki/htmlform/multiselect.js
resources/src/oojs-ui-local.css
tests/common/TestsAutoLoader.php
tests/parser/ParserTestParserHook.php
tests/parser/editTests.php
tests/parser/parserTests.txt
tests/phan/stubs/hhvm.php
tests/phan/stubs/mail.php
tests/phan/stubs/memcached.php
tests/phan/stubs/tideways.php
tests/phan/stubs/wikidiff.php
tests/phpunit/MediaWikiCoversValidator.php [new file with mode: 0644]
tests/phpunit/MediaWikiTestCase.php
tests/phpunit/includes/AutopromoteTest.php
tests/phpunit/includes/BlockTest.php
tests/phpunit/includes/FauxRequestTest.php
tests/phpunit/includes/GlobalFunctions/GlobalTest.php
tests/phpunit/includes/HooksTest.php
tests/phpunit/includes/HtmlTest.php
tests/phpunit/includes/LinkFilterTest.php
tests/phpunit/includes/LinkerTest.php
tests/phpunit/includes/ListToggleTest.php [new file with mode: 0644]
tests/phpunit/includes/MWNamespaceTest.php
tests/phpunit/includes/MediaWikiServicesTest.php
tests/phpunit/includes/MediaWikiVersionFetcherTest.php
tests/phpunit/includes/OutputPageTest.php
tests/phpunit/includes/PagePropsTest.php
tests/phpunit/includes/PathRouterTest.php
tests/phpunit/includes/PreferencesTest.php
tests/phpunit/includes/RevisionDbTestBase.php
tests/phpunit/includes/RevisionTest.php
tests/phpunit/includes/SampleTest.php
tests/phpunit/includes/SanitizerValidateEmailTest.php
tests/phpunit/includes/Services/ServiceContainerTest.php [deleted file]
tests/phpunit/includes/Services/TestWiring1.php [deleted file]
tests/phpunit/includes/Services/TestWiring2.php [deleted file]
tests/phpunit/includes/StatusTest.php
tests/phpunit/includes/Storage/BlobStoreFactoryTest.php [new file with mode: 0644]
tests/phpunit/includes/Storage/RevisionStoreDbTest.php
tests/phpunit/includes/Storage/RevisionStoreTest.php
tests/phpunit/includes/TemplateParserTest.php
tests/phpunit/includes/TitleArrayFromResultTest.php
tests/phpunit/includes/TitleMethodsTest.php
tests/phpunit/includes/TitleTest.php
tests/phpunit/includes/WikiReferenceTest.php
tests/phpunit/includes/XmlJsTest.php
tests/phpunit/includes/XmlTest.php
tests/phpunit/includes/api/ApiBaseTest.php
tests/phpunit/includes/api/ApiCheckTokenTest.php [new file with mode: 0644]
tests/phpunit/includes/api/ApiClearHasMsgTest.php [new file with mode: 0644]
tests/phpunit/includes/api/ApiComparePagesTest.php
tests/phpunit/includes/api/ApiOpenSearchTest.php
tests/phpunit/includes/api/ApiPageSetTest.php
tests/phpunit/includes/api/ApiParseTest.php
tests/phpunit/includes/api/ApiQueryAllPagesTest.php
tests/phpunit/includes/api/ApiQueryRecentChangesIntegrationTest.php [new file with mode: 0644]
tests/phpunit/includes/api/ApiTestCase.php
tests/phpunit/includes/api/ApiUploadTest.php
tests/phpunit/includes/api/ApiUsageExceptionTest.php
tests/phpunit/includes/api/ApiWatchTest.php
tests/phpunit/includes/api/format/ApiFormatBaseTest.php [new file with mode: 0644]
tests/phpunit/includes/api/format/ApiFormatPhpTest.php
tests/phpunit/includes/api/format/ApiFormatRawTest.php [new file with mode: 0644]
tests/phpunit/includes/api/format/ApiFormatTestBase.php
tests/phpunit/includes/api/format/ApiFormatXmlTest.php
tests/phpunit/includes/changes/ChangesListFilterGroupTest.php
tests/phpunit/includes/changes/ChangesListFilterTest.php
tests/phpunit/includes/collation/CollationFaTest.php
tests/phpunit/includes/collation/CustomUppercaseCollationTest.php
tests/phpunit/includes/composer/ComposerVersionNormalizerTest.php
tests/phpunit/includes/config/EtcdConfigTest.php
tests/phpunit/includes/content/ContentHandlerTest.php
tests/phpunit/includes/content/CssContentHandlerTest.php
tests/phpunit/includes/content/CssContentTest.php
tests/phpunit/includes/content/FileContentHandlerTest.php
tests/phpunit/includes/content/JavaScriptContentHandlerTest.php
tests/phpunit/includes/content/JavaScriptContentTest.php
tests/phpunit/includes/content/TextContentHandlerTest.php
tests/phpunit/includes/content/WikitextContentHandlerTest.php
tests/phpunit/includes/content/WikitextStructureTest.php
tests/phpunit/includes/db/DatabaseSqliteTest.php
tests/phpunit/includes/db/LBFactoryTest.php
tests/phpunit/includes/db/LoadBalancerTest.php
tests/phpunit/includes/debug/logger/monolog/AvroFormatterTest.php
tests/phpunit/includes/debug/logger/monolog/KafkaHandlerTest.php
tests/phpunit/includes/deferred/LinksUpdateTest.php
tests/phpunit/includes/deferred/MWCallableUpdateTest.php
tests/phpunit/includes/deferred/TransactionRoundDefiningUpdateTest.php
tests/phpunit/includes/editpage/TextboxBuilderTest.php [new file with mode: 0644]
tests/phpunit/includes/exception/MWExceptionTest.php
tests/phpunit/includes/externalstore/ExternalStoreFactoryTest.php
tests/phpunit/includes/filerepo/MigrateFileRepoLayoutTest.php
tests/phpunit/includes/filerepo/RepoGroupTest.php
tests/phpunit/includes/filerepo/file/FileTest.php
tests/phpunit/includes/htmlform/HTMLFormTest.php
tests/phpunit/includes/htmlform/HTMLRestrictionsFieldTest.php
tests/phpunit/includes/http/HttpTest.php
tests/phpunit/includes/import/ImportTest.php
tests/phpunit/includes/jobqueue/JobQueueMemoryTest.php
tests/phpunit/includes/jobqueue/RefreshLinksPartitionTest.php
tests/phpunit/includes/libs/ArrayUtilsTest.php
tests/phpunit/includes/libs/CSSMinTest.php
tests/phpunit/includes/libs/DeferredStringifierTest.php
tests/phpunit/includes/libs/DnsSrvDiscovererTest.php
tests/phpunit/includes/libs/GenericArrayObjectTest.php
tests/phpunit/includes/libs/HashRingTest.php
tests/phpunit/includes/libs/HtmlArmorTest.php
tests/phpunit/includes/libs/IEUrlExtensionTest.php
tests/phpunit/includes/libs/IPTest.php
tests/phpunit/includes/libs/JavaScriptMinifierTest.php
tests/phpunit/includes/libs/MWMessagePackTest.php
tests/phpunit/includes/libs/MapCacheLRUTest.php
tests/phpunit/includes/libs/MemoizedCallableTest.php
tests/phpunit/includes/libs/ObjectFactoryTest.php
tests/phpunit/includes/libs/ProcessCacheLRUTest.php
tests/phpunit/includes/libs/SamplingStatsdClientTest.php
tests/phpunit/includes/libs/StringUtilsTest.php
tests/phpunit/includes/libs/TimingTest.php
tests/phpunit/includes/libs/XhprofDataTest.php
tests/phpunit/includes/libs/XhprofTest.php
tests/phpunit/includes/libs/XmlTypeCheckTest.php
tests/phpunit/includes/libs/mime/MimeAnalyzerTest.php
tests/phpunit/includes/libs/objectcache/BagOStuffTest.php
tests/phpunit/includes/libs/objectcache/CachedBagOStuffTest.php
tests/phpunit/includes/libs/objectcache/HashBagOStuffTest.php
tests/phpunit/includes/libs/objectcache/WANObjectCacheTest.php
tests/phpunit/includes/libs/rdbms/TransactionProfilerTest.php
tests/phpunit/includes/libs/rdbms/connectionmanager/ConnectionManagerTest.php
tests/phpunit/includes/libs/rdbms/connectionmanager/SessionConsistentConnectionManagerTest.php
tests/phpunit/includes/libs/rdbms/database/DBConnRefTest.php [new file with mode: 0644]
tests/phpunit/includes/libs/rdbms/database/DatabaseDomainTest.php
tests/phpunit/includes/libs/rdbms/database/DatabaseMysqlBaseTest.php
tests/phpunit/includes/libs/rdbms/database/DatabaseSQLTest.php
tests/phpunit/includes/libs/rdbms/database/DatabaseTest.php
tests/phpunit/includes/libs/xmp/XMPTest.php
tests/phpunit/includes/libs/xmp/XMPValidateTest.php
tests/phpunit/includes/logging/BlockLogFormatterTest.php
tests/phpunit/includes/logging/DeleteLogFormatterTest.php
tests/phpunit/includes/logging/ImportLogFormatterTest.php
tests/phpunit/includes/logging/MergeLogFormatterTest.php
tests/phpunit/includes/logging/MoveLogFormatterTest.php
tests/phpunit/includes/logging/NewUsersLogFormatterTest.php
tests/phpunit/includes/logging/PageLangLogFormatterTest.php
tests/phpunit/includes/logging/PatrolLogFormatterTest.php
tests/phpunit/includes/logging/ProtectLogFormatterTest.php
tests/phpunit/includes/logging/RightsLogFormatterTest.php
tests/phpunit/includes/logging/UploadLogFormatterTest.php
tests/phpunit/includes/media/ExifBitmapTest.php
tests/phpunit/includes/media/ExifRotationTest.php
tests/phpunit/includes/media/GIFTest.php
tests/phpunit/includes/media/JpegTest.php
tests/phpunit/includes/media/PNGTest.php
tests/phpunit/includes/media/SVGMetadataExtractorTest.php
tests/phpunit/includes/media/TiffTest.php
tests/phpunit/includes/media/WebPTest.php
tests/phpunit/includes/objectcache/MemcachedBagOStuffTest.php
tests/phpunit/includes/objectcache/RESTBagOStuffTest.php
tests/phpunit/includes/objectcache/RedisBagOStuffTest.php
tests/phpunit/includes/page/ImagePage404Test.php
tests/phpunit/includes/page/ImagePageTest.php
tests/phpunit/includes/page/WikiPageDbTestBase.php
tests/phpunit/includes/parser/MagicVariableTest.php
tests/phpunit/includes/parser/ParserIntegrationTest.php
tests/phpunit/includes/parser/ParserOptionsTest.php
tests/phpunit/includes/parser/ParserOutputTest.php
tests/phpunit/includes/parser/PreprocessorTest.php
tests/phpunit/includes/parser/SanitizerTest.php
tests/phpunit/includes/password/BcryptPasswordTest.php
tests/phpunit/includes/password/EncryptedPasswordTest.php
tests/phpunit/includes/password/LayeredParameterizedPasswordTest.php
tests/phpunit/includes/poolcounter/PoolCounterTest.php
tests/phpunit/includes/preferences/DefaultPreferencesFactoryTest.php [new file with mode: 0644]
tests/phpunit/includes/registration/ExtensionProcessorTest.php
tests/phpunit/includes/registration/VersionCheckerTest.php
tests/phpunit/includes/resourceloader/DerivativeResourceLoaderContextTest.php
tests/phpunit/includes/resourceloader/MessageBlobStoreTest.php
tests/phpunit/includes/resourceloader/ResourceLoaderClientHtmlTest.php
tests/phpunit/includes/resourceloader/ResourceLoaderContextTest.php
tests/phpunit/includes/resourceloader/ResourceLoaderSkinModuleTest.php
tests/phpunit/includes/services/ServiceContainerTest.php [new file with mode: 0644]
tests/phpunit/includes/services/TestWiring1.php [new file with mode: 0644]
tests/phpunit/includes/services/TestWiring2.php [new file with mode: 0644]
tests/phpunit/includes/shell/CommandFactoryTest.php
tests/phpunit/includes/shell/CommandTest.php
tests/phpunit/includes/shell/FirejailCommandTest.php
tests/phpunit/includes/shell/ShellTest.php
tests/phpunit/includes/site/DBSiteStoreTest.php
tests/phpunit/includes/site/FileBasedSiteLookupTest.php
tests/phpunit/includes/site/MediaWikiPageNameNormalizerTest.php
tests/phpunit/includes/site/SiteExporterTest.php
tests/phpunit/includes/site/SiteImporterTest.php
tests/phpunit/includes/site/SiteListTest.php
tests/phpunit/includes/site/SitesCacheFileBuilderTest.php
tests/phpunit/includes/specials/ContribsPagerTest.php
tests/phpunit/includes/specials/SpecialMIMESearchTest.php
tests/phpunit/includes/specials/SpecialPreferencesTest.php
tests/phpunit/includes/specials/SpecialUncategorizedcategoriesTest.php
tests/phpunit/includes/tidy/RemexDriverTest.php
tests/phpunit/includes/upload/UploadBaseTest.php
tests/phpunit/includes/user/PasswordResetTest.php
tests/phpunit/includes/user/UserTest.php
tests/phpunit/includes/utils/AvroValidatorTest.php
tests/phpunit/includes/utils/BatchRowUpdateTest.php
tests/phpunit/includes/utils/ClassCollectorTest.php
tests/phpunit/includes/utils/FileContentsHasherTest.php
tests/phpunit/includes/utils/MWCryptHKDFTest.php
tests/phpunit/includes/utils/MWCryptHashTest.php
tests/phpunit/includes/utils/MWRestrictionsTest.php
tests/phpunit/includes/utils/UIDGeneratorTest.php
tests/phpunit/includes/utils/ZipDirectoryReaderTest.php
tests/phpunit/includes/watcheditem/WatchedItemQueryServiceUnitTest.php
tests/phpunit/languages/LanguageCodeTest.php
tests/phpunit/languages/LanguageConverterTest.php
tests/phpunit/languages/LanguageTest.php
tests/phpunit/languages/classes/LanguageArTest.php
tests/phpunit/languages/classes/LanguageBe_taraskTest.php
tests/phpunit/languages/classes/LanguageBsTest.php
tests/phpunit/languages/classes/LanguageCrhTest.php
tests/phpunit/languages/classes/LanguageCuTest.php
tests/phpunit/languages/classes/LanguageDsbTest.php
tests/phpunit/languages/classes/LanguageGanTest.php
tests/phpunit/languages/classes/LanguageHsbTest.php
tests/phpunit/languages/classes/LanguageHuTest.php
tests/phpunit/languages/classes/LanguageHyTest.php
tests/phpunit/languages/classes/LanguageIuTest.php
tests/phpunit/languages/classes/LanguageKkTest.php
tests/phpunit/languages/classes/LanguageKshTest.php
tests/phpunit/languages/classes/LanguageKuTest.php
tests/phpunit/languages/classes/LanguageMlTest.php
tests/phpunit/languages/classes/LanguagePlTest.php
tests/phpunit/languages/classes/LanguageRuTest.php
tests/phpunit/languages/classes/LanguageShiTest.php
tests/phpunit/languages/classes/LanguageSlTest.php
tests/phpunit/languages/classes/LanguageSrTest.php
tests/phpunit/languages/classes/LanguageTgTest.php
tests/phpunit/languages/classes/LanguageTrTest.php
tests/phpunit/languages/classes/LanguageUkTest.php
tests/phpunit/languages/classes/LanguageUzTest.php
tests/phpunit/languages/classes/LanguageWaTest.php
tests/phpunit/languages/classes/LanguageZhTest.php
tests/phpunit/maintenance/BenchmarkerTest.php [new file with mode: 0644]
tests/phpunit/maintenance/backupPrefetchTest.php
tests/phpunit/maintenance/categoriesRdfTest.php
tests/phpunit/skins/SideBarTest.php
tests/phpunit/structure/AvailableRightsTest.php
tests/phpunit/structure/ExtensionJsonValidationTest.php
tests/phpunit/tests/MediaWikiTestCaseSchema1Test.php [new file with mode: 0644]
tests/phpunit/tests/MediaWikiTestCaseSchema2Test.php [new file with mode: 0644]
tests/phpunit/tests/MediaWikiTestCaseSchemaTest.sql [new file with mode: 0644]
tests/phpunit/tests/MediaWikiTestCaseTest.php
tests/qunit/suites/resources/mediawiki/mediawiki.toc.test.js

index c4f8604..c101be3 100644 (file)
--- a/.mailmap
+++ b/.mailmap
@@ -281,6 +281,7 @@ Matthew Walker <mwalker@wikimedia.org>
 Matthias Mullie <git@mullie.eu>
 Matthias Mullie <git@mullie.eu> <mmullie@wikimedia.org>
 Matěj Grabovský <mgrabovsky@yahoo.com> <mgrabovsky@users.mediawiki.org>
+Matěj Suchánek <matejsuchanek97@gmail.com>
 Max Semenik <maxsem.wiki@gmail.com>
 Max Semenik <maxsem.wiki@gmail.com> <maxsem@users.mediawiki.org>
 Max Semenik <maxsem.wiki@gmail.com> <semenik@gmail.com>
@@ -383,7 +384,7 @@ Sam Reed <reedy@wikimedia.org> <reedy@users.mediawiki.org>
 Sam Smith <git@samsmith.io>
 Santhosh Thottingal <santhosh.thottingal@gmail.com>
 Santhosh Thottingal <santhosh.thottingal@gmail.com> <santhosh@users.mediawiki.org>
-Schnark <listenleser@gmail.com>
+Schnark (Michael M.) <listenleser@gmail.com>
 Scimonster <tehalmightyscimonster@gmail.com>
 Sean Colombo <sean.colombo@gmail.com> <sean_colombo@users.mediawiki.org>
 Sean Pringle <springle@wikimedia.org>
index 3170381..7f90f27 100644 (file)
                <exclude name="MediaWiki.Usage.SuperGlobalsUsage.SuperGlobals" />
                <exclude name="MediaWiki.Files.ClassMatchesFilename.WrongCase" />
                <exclude name="MediaWiki.Files.ClassMatchesFilename.NotMatch" />
-               <exclude name="MediaWiki.Files.OneClassPerFile.MultipleFound" />
+               <exclude name="Generic.Files.OneObjectStructurePerFile.MultipleFound" />
                <exclude name="MediaWiki.VariableAnalysis.ForbiddenGlobalVariables.ForbiddenGlobal$wgTitle" />
                <exclude name="MediaWiki.Usage.DeprecatedConstantUsage.NS_IMAGE" />
                <exclude name="MediaWiki.Usage.DeprecatedConstantUsage.NS_IMAGE_TALK" />
                <exclude name="MediaWiki.Commenting.FunctionComment.SpacingDocStar" />
                <exclude name="MediaWiki.Commenting.FunctionComment.SpacingDocTag" />
+               <exclude name="Squiz.Scope.MethodScope.Missing" />
+               <exclude name="Squiz.Scope.MemberVarScope.Missing" />
        </rule>
        <rule ref="MediaWiki.NamingConventions.PrefixedGlobalFunctions">
                <properties>
index 64414b5..32763b5 100644 (file)
@@ -27,8 +27,6 @@ matrix:
     - env: dbtype=postgres dbuser=travis
       php: 5.5
     # https://docs.travis-ci.com/user/languages/php#HHVM-versions
-    - env: dbtype=mysql dbuser=root
-      php: hhvm-3.12
     - env: dbtype=mysql dbuser=root
       php: hhvm-3.18
     - env: dbtype=mysql dbuser=root
diff --git a/CREDITS b/CREDITS
index 6ab4ad3..ea011e8 100644 (file)
--- a/CREDITS
+++ b/CREDITS
@@ -394,7 +394,6 @@ The following list can be found parsed under Special:Version/Credits -->
 * Massaf
 * Matěj Grabovský
 * Matěj Suchánek
-* matejsuchanek
 * Mathias Ertl
 * mati
 * Matt Fitzpatrick
@@ -420,7 +419,6 @@ The following list can be found parsed under Special:Version/Credits -->
 * Michael Dale
 * Michael De La Rue
 * Michael Holloway
-* Michael M.
 * Michael Newton
 * Michael Walsh
 * Michał Łazowik
@@ -573,7 +571,7 @@ The following list can be found parsed under Special:Version/Credits -->
 * Sam Wilson
 * Santhosh Thottingal
 * saptaks
-* Schnark
+* Schnark (Michael M.)
 * Scimonster
 * scnd
 * Scott Colcord
@@ -670,7 +668,6 @@ The following list can be found parsed under Special:Version/Credits -->
 * Victor Barbu
 * Victor Porton
 * Victor Vasiliev
-* victorbarbu
 * Ville Stadista
 * vishnu
 * Vitaliy Filippov
index 7f67feb..30a174a 100644 (file)
@@ -19,6 +19,8 @@ production.
   maintenance/cleanupUsersWithNoId.php.
 * $wgResourceLoaderMinifierStatementsOnOwnLine and $wgResourceLoaderMinifierMaxLineLength
   were removed (deprecated since 1.27).
+* (T180921) $wgReferrerPolicy now supports having fallbacks for browsers that are not
+  using the latest version of the Referrer Policy specification.
 
 === New features in 1.31 ===
 * Wikimedia\Rdbms\IDatabase->select() and similar methods now support
@@ -39,6 +41,11 @@ production.
 === External library changes in 1.31 ===
 
 ==== Upgraded external libraries ====
+* Updated jquery.chosen from v0.9.14 to v1.8.2.
+* Updated composer/spdx-licenses from 1.1.4 to
+  1.2.0 (development dependency).
+* Updated nikic/php-parser from 2.1.0 to 3.1.3
+  (development dependency).
 * …
 
 ==== New external libraries ====
@@ -153,6 +160,11 @@ changes to languages because of Phabricator reports.
   * WatchedItem::IGNORE_USER_RIGHTS
   * WatchedItem::CHECK_USER_RIGHTS
   * WatchedItem::DEPRECATED_USAGE_TIMESTAMP
+* The $statementsOnOwnLine parameter of JavaScriptMinifier::minify was removed.
+  The corresponding configuration variable ($wgResourceLoaderMinifierStatementsOnOwnLine)
+  has been deprecated since 1.27 and was removed as well.
+* The HtmlFormatter class was removed (deprecated in 1.27). The namespaced
+  HtmlFormatter\HtmlFormatter class should be used instead.
 
 == Compatibility ==
 MediaWiki 1.31 requires PHP 5.5.9 or later. There is experimental support for
index 6b8387b..351136d 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 // This file is generated by maintenance/generateLocalAutoload.php, do not adjust manually
-// @codingStandardsIgnoreFile
+// phpcs:ignoreFile Generic.Files.LineLength
 global $wgAutoloadLocalClasses;
 
 $wgAutoloadLocalClasses = [
@@ -606,7 +606,6 @@ $wgAutoloadLocalClasses = [
        'Hooks' => __DIR__ . '/includes/Hooks.php',
        'Html' => __DIR__ . '/includes/Html.php',
        'HtmlArmor' => __DIR__ . '/includes/libs/HtmlArmor.php',
-       'HtmlFormatter' => __DIR__ . '/includes/HtmlFormatter.php',
        'Http' => __DIR__ . '/includes/http/Http.php',
        'HttpError' => __DIR__ . '/includes/exception/HttpError.php',
        'HttpStatus' => __DIR__ . '/includes/libs/HttpStatus.php',
@@ -705,7 +704,6 @@ $wgAutoloadLocalClasses = [
        'LanguageAr' => __DIR__ . '/languages/classes/LanguageAr.php',
        'LanguageAz' => __DIR__ . '/languages/classes/LanguageAz.php',
        'LanguageBe_tarask' => __DIR__ . '/languages/classes/LanguageBe_tarask.php',
-       'LanguageBg' => __DIR__ . '/languages/classes/LanguageBg.php',
        'LanguageBs' => __DIR__ . '/languages/classes/LanguageBs.php',
        'LanguageCode' => __DIR__ . '/languages/LanguageCode.php',
        'LanguageConverter' => __DIR__ . '/languages/LanguageConverter.php',
@@ -713,8 +711,6 @@ $wgAutoloadLocalClasses = [
        'LanguageCu' => __DIR__ . '/languages/classes/LanguageCu.php',
        'LanguageDsb' => __DIR__ . '/languages/classes/LanguageDsb.php',
        'LanguageEn' => __DIR__ . '/languages/classes/LanguageEn.php',
-       'LanguageEs' => __DIR__ . '/languages/classes/LanguageEs.php',
-       'LanguageEt' => __DIR__ . '/languages/classes/LanguageEt.php',
        'LanguageFi' => __DIR__ . '/languages/classes/LanguageFi.php',
        'LanguageGa' => __DIR__ . '/languages/classes/LanguageGa.php',
        'LanguageGan' => __DIR__ . '/languages/classes/LanguageGan.php',
@@ -729,21 +725,17 @@ $wgAutoloadLocalClasses = [
        'LanguageKm' => __DIR__ . '/languages/classes/LanguageKm.php',
        'LanguageKsh' => __DIR__ . '/languages/classes/LanguageKsh.php',
        'LanguageKu' => __DIR__ . '/languages/classes/LanguageKu.php',
-       'LanguageKu_ku' => __DIR__ . '/languages/classes/LanguageKu_ku.php',
        'LanguageLa' => __DIR__ . '/languages/classes/LanguageLa.php',
        'LanguageMl' => __DIR__ . '/languages/classes/LanguageMl.php',
        'LanguageMy' => __DIR__ . '/languages/classes/LanguageMy.php',
        'LanguageOs' => __DIR__ . '/languages/classes/LanguageOs.php',
-       'LanguagePl' => __DIR__ . '/languages/classes/LanguagePl.php',
        'LanguageQqx' => __DIR__ . '/languages/classes/LanguageQqx.php',
-       'LanguageRu' => __DIR__ . '/languages/classes/LanguageRu.php',
        'LanguageShi' => __DIR__ . '/languages/classes/LanguageShi.php',
        'LanguageSl' => __DIR__ . '/languages/classes/LanguageSl.php',
        'LanguageSr' => __DIR__ . '/languages/classes/LanguageSr.php',
        'LanguageTg' => __DIR__ . '/languages/classes/LanguageTg.php',
        'LanguageTr' => __DIR__ . '/languages/classes/LanguageTr.php',
        'LanguageTyv' => __DIR__ . '/languages/classes/LanguageTyv.php',
-       'LanguageUk' => __DIR__ . '/languages/classes/LanguageUk.php',
        'LanguageUz' => __DIR__ . '/languages/classes/LanguageUz.php',
        'LanguageWa' => __DIR__ . '/languages/classes/LanguageWa.php',
        'LanguageYue' => __DIR__ . '/languages/classes/LanguageYue.php',
@@ -910,6 +902,8 @@ $wgAutoloadLocalClasses = [
        'MediaWiki\\Logger\\NullSpi' => __DIR__ . '/includes/debug/logger/NullSpi.php',
        'MediaWiki\\Logger\\Spi' => __DIR__ . '/includes/debug/logger/Spi.php',
        'MediaWiki\\MediaWikiServices' => __DIR__ . '/includes/MediaWikiServices.php',
+       'MediaWiki\\Preferences\\DefaultPreferencesFactory' => __DIR__ . '/includes/preferences/DefaultPreferencesFactory.php',
+       'MediaWiki\\Preferences\\PreferencesFactory' => __DIR__ . '/includes/preferences/PreferencesFactory.php',
        'MediaWiki\\ProcOpenError' => __DIR__ . '/includes/exception/ProcOpenError.php',
        'MediaWiki\\Search\\ParserOutputSearchDataExtractor' => __DIR__ . '/includes/search/ParserOutputSearchDataExtractor.php',
        'MediaWiki\\Services\\CannotReplaceActiveServiceException' => __DIR__ . '/includes/services/CannotReplaceActiveServiceException.php',
@@ -944,6 +938,7 @@ $wgAutoloadLocalClasses = [
        'MediaWiki\\Site\\MediaWikiPageNameNormalizer' => __DIR__ . '/includes/site/MediaWikiPageNameNormalizer.php',
        'MediaWiki\\Storage\\BlobAccessException' => __DIR__ . '/includes/Storage/BlobAccessException.php',
        'MediaWiki\\Storage\\BlobStore' => __DIR__ . '/includes/Storage/BlobStore.php',
+       'MediaWiki\\Storage\\BlobStoreFactory' => __DIR__ . '/includes/Storage/BlobStoreFactory.php',
        'MediaWiki\\Storage\\IncompleteRevisionException' => __DIR__ . '/includes/Storage/IncompleteRevisionException.php',
        'MediaWiki\\Storage\\MutableRevisionRecord' => __DIR__ . '/includes/Storage/MutableRevisionRecord.php',
        'MediaWiki\\Storage\\MutableRevisionSlots' => __DIR__ . '/includes/Storage/MutableRevisionSlots.php',
index 35783f2..d92ffc9 100644 (file)
@@ -25,7 +25,7 @@
                "ext-xml": "*",
                "liuggio/statsd-php-client": "1.0.18",
                "mediawiki/at-ease": "1.1.0",
-               "oojs/oojs-ui": "0.24.3",
+               "oojs/oojs-ui": "0.24.4",
                "oyejorge/less.php": "1.7.0.14",
                "php": ">=5.5.9",
                "psr/log": "1.0.2",
@@ -39,7 +39,7 @@
                "wikimedia/php-session-serializer": "1.0.4",
                "wikimedia/purtle": "1.0.6",
                "wikimedia/relpath": "2.0.0",
-               "wikimedia/remex-html": "1.0.1",
+               "wikimedia/remex-html": "1.0.2",
                "wikimedia/running-stat": "1.1.0",
                "wikimedia/scoped-callback": "1.0.0",
                "wikimedia/utfnormal": "1.1.0",
                "zordius/lightncandy": "0.23"
        },
        "require-dev": {
-               "composer/spdx-licenses": "1.1.4",
+               "composer/spdx-licenses": "1.2.0",
                "hamcrest/hamcrest-php": "^2.0",
                "jakub-onderka/php-parallel-lint": "0.9.2",
                "jetbrains/phpstorm-stubs": "dev-master#1b9906084d6635456fcf3f3a01f0d7d5b99a578a",
                "justinrainbow/json-schema": "~5.2",
-               "mediawiki/mediawiki-codesniffer": "14.1.0",
+               "mediawiki/mediawiki-codesniffer": "15.0.0",
                "monolog/monolog": "~1.22.1",
-               "nikic/php-parser": "2.1.0",
+               "nikic/php-parser": "3.1.3",
                "nmred/kafka-php": "0.1.5",
                "phpunit/phpunit": "4.8.36",
                "psy/psysh": "0.8.11",
index 1f4a5f4..45387a3 100644 (file)
@@ -951,7 +951,7 @@ $id: the page ID (original ID in case of page deletions)
 in a Category page. Gives extensions the opportunity to batch load any
 related data about the pages.
 $type: The category type. Either 'page', 'file' or 'subcat'
-$res: Query result from DatabaseBase::select()
+$res: Query result from Wikimedia\Rdbms\IDatabase::select()
 
 'CategoryViewer::generateLink': Before generating an output link allow
 extensions opportunity to generate a more specific or relevant link.
index b707174..8091428 100644 (file)
@@ -316,10 +316,20 @@ $wgAppleTouchIcon = false;
 
 /**
  * Value for the referrer policy meta tag.
- * One of 'never', 'default', 'origin', 'always'. Setting it to false just
- * prevents the meta tag from being output.
- * See https://www.w3.org/TR/referrer-policy/ for details.
- *
+ * One or more of the values defined in the Referrer Policy specification:
+ * https://w3c.github.io/webappsec-referrer-policy/
+ * ('no-referrer', 'no-referrer-when-downgrade', 'same-origin',
+ * 'origin', 'strict-origin', 'origin-when-cross-origin',
+ * 'strict-origin-when-cross-origin', or 'unsafe-url')
+ * Setting it to false prevents the meta tag from being output
+ * (which results in falling back to the Referrer-Policy header,
+ * or 'no-referrer-when-downgrade' if that's not set either.)
+ * Setting it to an array (supported since 1.31) will create a meta tag for
+ * each value, in the reverse of the order (meaning that the first array element
+ * will be the default and the others used as fallbacks for browsers which do not
+ * understand it).
+ *
+ * @var array|string|bool
  * @since 1.25
  */
 $wgReferrerPolicy = false;
index 60dde40..242cecf 100644 (file)
@@ -37,9 +37,7 @@ class DeprecatedGlobal extends StubObject {
                $this->version = $version;
        }
 
-       // @codingStandardsIgnoreStart
-       // PSR2.Methods.MethodDeclaration.Underscore
-       // PSR2.Classes.PropertyDeclaration.ScopeMissing
+       // phpcs:ignore PSR2.Methods.MethodDeclaration.Underscore,PSR2.Classes.PropertyDeclaration.ScopeMissing
        function _newObject() {
                /* Put the caller offset for wfDeprecated as 6, as
                 * that gives the function that uses this object, since:
@@ -56,5 +54,4 @@ class DeprecatedGlobal extends StubObject {
                wfDeprecated( '$' . $this->global, $this->version, false, 6 );
                return parent::_newObject();
        }
-       // @codingStandardsIgnoreEnd
 }
index bcaab3a..3c109f6 100644 (file)
@@ -2861,7 +2861,14 @@ class EditPage {
                        // and fallback to the raw wpTextbox1 since editconflicts can't be
                        // resolved between page source edits and custom ui edits using the
                        // custom edit ui.
-                       $this->showTextbox1();
+                       $conflictTextBoxAttribs = [];
+                       if ( $this->wasDeletedSinceLastEdit() ) {
+                               $conflictTextBoxAttribs['style'] = 'display:none;';
+                       } elseif ( $this->isOldRev ) {
+                               $conflictTextBoxAttribs['class'] = 'mw-textarea-oldrev';
+                       }
+
+                       $out->addHTML( $editConflictHelper->getEditConflictMainTextBox( $conflictTextBoxAttribs ) );
                        $out->addHTML( $editConflictHelper->getEditFormHtmlAfterContent() );
                } else {
                        $this->showContentForm();
@@ -3339,22 +3346,9 @@ class EditPage {
                if ( $this->wasDeletedSinceLastEdit() && $this->formtype == 'save' ) {
                        $attribs = [ 'style' => 'display:none;' ];
                } else {
-                       $classes = []; // Textarea CSS
-                       if ( $this->mTitle->isProtected( 'edit' ) &&
-                               MWNamespace::getRestrictionLevels( $this->mTitle->getNamespace() ) !== [ '' ]
-                       ) {
-                               # Is the title semi-protected?
-                               if ( $this->mTitle->isSemiProtected() ) {
-                                       $classes[] = 'mw-textarea-sprotected';
-                               } else {
-                                       # Then it must be protected based on static groups (regular)
-                                       $classes[] = 'mw-textarea-protected';
-                               }
-                               # Is the title cascade-protected?
-                               if ( $this->mTitle->isCascadeProtected() ) {
-                                       $classes[] = 'mw-textarea-cprotected';
-                               }
-                       }
+                       $builder = new TextboxBuilder();
+                       $classes = $builder->getTextboxProtectionCSSClasses( $this->getTitle() );
+
                        # Is an old revision being edited?
                        if ( $this->isOldRev ) {
                                $classes[] = 'mw-textarea-oldrev';
@@ -3366,12 +3360,7 @@ class EditPage {
                                $attribs += $customAttribs;
                        }
 
-                       if ( count( $classes ) ) {
-                               if ( isset( $attribs['class'] ) ) {
-                                       $classes[] = $attribs['class'];
-                               }
-                               $attribs['class'] = implode( ' ', $classes );
-                       }
+                       $attribs = $builder->mergeClassesIntoAttributes( $classes, $attribs );
                }
 
                $this->showTextbox(
index 1a33b76..310adeb 100644 (file)
@@ -24,7 +24,6 @@ if ( !defined( 'MEDIAWIKI' ) ) {
        die( "This file is part of MediaWiki, it is not a valid entry point" );
 }
 
-use Liuggio\StatsdClient\Sender\SocketSender;
 use MediaWiki\Logger\LoggerFactory;
 use MediaWiki\ProcOpenError;
 use MediaWiki\Session\SessionManager;
@@ -1231,6 +1230,7 @@ function wfErrorLog( $text, $file, array $context = [] ) {
 
 /**
  * @todo document
+ * @todo Move logic to MediaWiki.php
  */
 function wfLogProfilingData() {
        global $wgDebugLogGroups, $wgDebugRawPage;
@@ -1242,23 +1242,13 @@ function wfLogProfilingData() {
        $profiler->setContext( $context );
        $profiler->logData();
 
-       $config = $context->getConfig();
-       $stats = MediaWikiServices::getInstance()->getStatsdDataFactory();
-       if ( $config->get( 'StatsdServer' ) && $stats->hasData() ) {
-               try {
-                       $statsdServer = explode( ':', $config->get( 'StatsdServer' ) );
-                       $statsdHost = $statsdServer[0];
-                       $statsdPort = isset( $statsdServer[1] ) ? $statsdServer[1] : 8125;
-                       $statsdSender = new SocketSender( $statsdHost, $statsdPort );
-                       $statsdClient = new SamplingStatsdClient( $statsdSender, true, false );
-                       $statsdClient->setSamplingRates( $config->get( 'StatsdSamplingRates' ) );
-                       $statsdClient->send( $stats->getData() );
-               } catch ( Exception $ex ) {
-                       MWExceptionHandler::logException( $ex );
-               }
-       }
+       // Send out any buffered statsd metrics as needed
+       MediaWiki::emitBufferedStatsdData(
+               MediaWikiServices::getInstance()->getStatsdDataFactory(),
+               $context->getConfig()
+       );
 
-       # Profiling must actually be enabled...
+       // Profiling must actually be enabled...
        if ( $profiler instanceof ProfilerStub ) {
                return;
        }
@@ -2920,7 +2910,7 @@ function wfGetLBFactory() {
  * Find a file.
  * Shortcut for RepoGroup::singleton()->findFile()
  *
- * @param string $title String or Title object
+ * @param string|Title $title String or Title object
  * @param array $options Associative array of options (see RepoGroup::findFile)
  * @return File|bool File, or false if the file does not exist
  */
index 5193168..075b48d 100644 (file)
@@ -700,7 +700,7 @@ class DiffHistoryBlob implements HistoryBlob {
 
 }
 
-// @codingStandardsIgnoreStart
+// phpcs:ignore Generic.CodeAnalysis.UnconditionalIfStatement.Found
 if ( false ) {
        // Blobs generated by MediaWiki < 1.5 on PHP 4 were serialized with the
        // class name coerced to lowercase. We can improve efficiency by adding
@@ -711,4 +711,3 @@ if ( false ) {
        class_alias( 'HistoryBlobCurStub', 'historyblobcurstub' );
        class_alias( 'HistoryBlobStub', 'historyblobstub' );
 }
-// @codingStandardsIgnoreEnd
diff --git a/includes/HtmlFormatter.php b/includes/HtmlFormatter.php
deleted file mode 100644 (file)
index 9bae8b5..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-<?php
-/**
- * Stub for extensions that haven't switched to Composer-based version of this class
- * @todo: remove in 1.28
- *
- * 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
- * @deprecated since 1.27, use HtmlFormatter\HtmlFormatter
- */
-class HtmlFormatter extends HtmlFormatter\HtmlFormatter {
-}
index 48be3bf..c0255ac 100644 (file)
@@ -1595,7 +1595,12 @@ class Linker {
                $title = wfMessage( 'toc' )->inLanguage( $lang )->escaped();
 
                return '<div id="toc" class="toc">'
-                       . '<div class="toctitle"><h2>' . $title . "</h2></div>\n"
+                       . Html::openElement( 'div', [
+                               'class' => 'toctitle',
+                               'lang' => $lang->getHtmlCode(),
+                               'dir' => $lang->getDir(),
+                       ] )
+                       . '<h2>' . $title . "</h2></div>\n"
                        . $toc
                        . "</ul>\n</div>\n";
        }
@@ -2119,8 +2124,6 @@ class Linker {
                return Xml::tags( 'span', [ 'class' => 'mw-revdelundel-link' ], $htmlParentheses );
        }
 
-       /* Deprecated methods */
-
        /**
         * Returns the attributes for the tooltip and access key.
         *
index 9e3bc10..a217cd1 100644 (file)
@@ -26,6 +26,7 @@ use MediaWiki\MediaWikiServices;
 use Wikimedia\Rdbms\ChronologyProtector;
 use Wikimedia\Rdbms\LBFactory;
 use Wikimedia\Rdbms\DBConnectionError;
+use Liuggio\StatsdClient\Sender\SocketSender;
 
 /**
  * The MediaWiki class is the helper class for the index.php entry point.
@@ -726,10 +727,12 @@ class MediaWiki {
                if ( function_exists( 'register_postsend_function' ) ) {
                        // https://github.com/facebook/hhvm/issues/1230
                        register_postsend_function( $callback );
+                       /** @noinspection PhpUnusedLocalVariableInspection */
                        $blocksHttpClient = false;
                } else {
                        if ( function_exists( 'fastcgi_finish_request' ) ) {
                                fastcgi_finish_request();
+                               /** @noinspection PhpUnusedLocalVariableInspection */
                                $blocksHttpClient = false;
                        } else {
                                // Either all DB and deferred updates should happen or none.
@@ -912,6 +915,34 @@ class MediaWiki {
                wfDebug( "Request ended normally\n" );
        }
 
+       /**
+        * Send out any buffered statsd data according to sampling rules
+        *
+        * @param IBufferingStatsdDataFactory $stats
+        * @param Config $config
+        * @throws ConfigException
+        * @since 1.31
+        */
+       public static function emitBufferedStatsdData(
+               IBufferingStatsdDataFactory $stats, Config $config
+       ) {
+               if ( $config->get( 'StatsdServer' ) && $stats->hasData() ) {
+                       try {
+                               $statsdServer = explode( ':', $config->get( 'StatsdServer' ) );
+                               $statsdHost = $statsdServer[0];
+                               $statsdPort = isset( $statsdServer[1] ) ? $statsdServer[1] : 8125;
+                               $statsdSender = new SocketSender( $statsdHost, $statsdPort );
+                               $statsdClient = new SamplingStatsdClient( $statsdSender, true, false );
+                               $statsdClient->setSamplingRates( $config->get( 'StatsdSamplingRates' ) );
+                               $statsdClient->send( $stats->getData() );
+
+                               $stats->clearData(); // empty buffer for the next round
+                       } catch ( Exception $ex ) {
+                               MWExceptionHandler::logException( $ex );
+                       }
+               }
+       }
+
        /**
         * Potentially open a socket and sent an HTTP request back to the server
         * to run a specified number of jobs. This registers a callback to cleanup
index 33d0fd4..5b173cd 100644 (file)
@@ -10,8 +10,10 @@ use GenderCache;
 use GlobalVarConfig;
 use Hooks;
 use IBufferingStatsdDataFactory;
+use MediaWiki\Preferences\PreferencesFactory;
 use MediaWiki\Shell\CommandFactory;
 use MediaWiki\Storage\BlobStore;
+use MediaWiki\Storage\BlobStoreFactory;
 use MediaWiki\Storage\RevisionStore;
 use Wikimedia\Rdbms\LBFactory;
 use LinkCache;
@@ -700,12 +702,20 @@ class MediaWikiServices extends ServiceContainer {
                return $this->getService( 'ExternalStoreFactory' );
        }
 
+       /**
+        * @since 1.31
+        * @return BlobStoreFactory
+        */
+       public function getBlobStoreFactory() {
+               return $this->getService( 'BlobStoreFactory' );
+       }
+
        /**
         * @since 1.31
         * @return BlobStore
         */
        public function getBlobStore() {
-               return $this->getService( 'BlobStore' );
+               return $this->getService( '_SqlBlobStore' );
        }
 
        /**
@@ -716,6 +726,14 @@ class MediaWikiServices extends ServiceContainer {
                return $this->getService( 'RevisionStore' );
        }
 
+       /**
+        * @since 1.31
+        * @return PreferencesFactory
+        */
+       public function getPreferencesFactory() {
+               return $this->getService( 'PreferencesFactory' );
+       }
+
        ///////////////////////////////////////////////////////////////////////////
        // NOTE: When adding a service getter here, don't forget to add a test
        // case for it in MediaWikiServicesTest::provideGetters() and in
index 92963fd..a2d445f 100644 (file)
@@ -366,8 +366,8 @@ class OutputPage extends ContextSource {
         * Add a new "<meta>" tag
         * To add an http-equiv meta tag, precede the name with "http:"
         *
-        * @param string $name Tag name
-        * @param string $val Tag value
+        * @param string $name Name of the meta tag
+        * @param string $val Value of the meta tag
         */
        function addMeta( $name, $val ) {
                array_push( $this->mMetatags, [ $name, $val ] );
@@ -3243,6 +3243,8 @@ class OutputPage extends ContextSource {
                        && ( $relevantTitle->exists() || $relevantTitle->quickUserCan( 'create', $user ) );
 
                foreach ( $title->getRestrictionTypes() as $type ) {
+                       // Following keys are set in $vars:
+                       // wgRestrictionCreate, wgRestrictionEdit, wgRestrictionMove, wgRestrictionUpload
                        $vars['wgRestriction' . ucfirst( $type )] = $title->getRestrictions( $type );
                }
 
@@ -3331,10 +3333,14 @@ class OutputPage extends ContextSource {
                ] );
 
                if ( $config->get( 'ReferrerPolicy' ) !== false ) {
-                       $tags['meta-referrer'] = Html::element( 'meta', [
-                               'name' => 'referrer',
-                               'content' => $config->get( 'ReferrerPolicy' )
-                       ] );
+                       // Per https://w3c.github.io/webappsec-referrer-policy/#unknown-policy-values
+                       // fallbacks should come before the primary value so we need to reverse the array.
+                       foreach ( array_reverse( (array)$config->get( 'ReferrerPolicy' ) ) as $i => $policy ) {
+                               $tags["meta-referrer-$i"] = Html::element( 'meta', [
+                                       'name' => 'referrer',
+                                       'content' => $policy,
+                               ] );
+                       }
                }
 
                $p = "{$this->mIndexPolicy},{$this->mFollowPolicy}";
index a862903..0a9bba8 100644 (file)
@@ -1,7 +1,5 @@
 <?php
-// @codingStandardsIgnoreFile Generic.Arrays.DisallowLongArraySyntax
-// @codingStandardsIgnoreFile Generic.Files.LineLength
-// @codingStandardsIgnoreFile MediaWiki.Usage.DirUsage.FunctionFound
+// phpcs:ignoreFile Generic.Arrays.DisallowLongArraySyntax,MediaWiki.Usage.DirUsage.FunctionFound
 /**
  * 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
@@ -126,6 +124,7 @@ class PHPVersionCheck {
                                . "{$otherInfo['minSupported']}.\n\nCheck if you have a"
                                . " newer php executable with a different name, such as php5.\n\n";
 
+                       // phpcs:ignore Generic.Files.LineLength
                        $longHtml = <<<HTML
                        Please consider <a href="{$phpInfo['upgradeURL']}">upgrading your copy of
                        {$phpInfo['implementation']}</a>.
@@ -140,6 +139,7 @@ class PHPVersionCheck {
                        See our<a href="https://www.mediawiki.org/wiki/Compatibility#PHP">compatibility page</a>
                        for details of which versions are compatible with prior versions of {$phpInfo['implementation']}.
 HTML;
+                       // phpcs:enable
                        $this->triggerError(
                                "Supported {$phpInfo['implementation']} versions",
                                $shortText,
@@ -164,12 +164,14 @@ HTML;
                                . "https://www.mediawiki.org/wiki/Download_from_Git#Fetch_external_libraries\n"
                                . "for help on installing the required components.";
 
+                       // phpcs:ignore Generic.Files.LineLength
                        $longHtml = <<<HTML
                MediaWiki now also has some external dependencies that need to be installed via
                composer or from a separate git repo. Please see
                <a href="https://www.mediawiki.org/wiki/Download_from_Git#Fetch_external_libraries">mediawiki.org</a>
                for help on installing the required components.
 HTML;
+                       // phpcs:enable
 
                        $this->triggerError( 'External dependencies', $shortText, $longText, $longHtml );
                }
index 33a975d..0a41573 100644 (file)
  *
  * @file
  */
+
 use MediaWiki\Auth\AuthManager;
-use MediaWiki\Auth\PasswordAuthenticationRequest;
 use MediaWiki\MediaWikiServices;
+use MediaWiki\Preferences\DefaultPreferencesFactory;
 
 /**
- * We're now using the HTMLForm object with some customisation to generate the
- * Preferences form. This object handles generic submission, CSRF protection,
- * layout and other logic in a reusable manner. We subclass it as a PreferencesForm
- * to make some minor customisations.
- *
- * In order to generate the form, the HTMLForm object needs an array structure
- * detailing the form fields available, and that's what this class is for. Each
- * element of the array is a basic property-list, including the type of field,
- * the label it is to be given in the form, callbacks for validation and
- * 'filtering', and other pertinent information. Note that the 'default' field
- * is named for generic forms, and does not represent the preference's default
- * (which is stored in $wgDefaultUserOptions), but the default for the form
- * field, which should be whatever the user has set for that preference. There
- * is no need to override it unless you have some special storage logic (for
- * instance, those not presently stored as options, but which are best set from
- * the user preferences view).
- *
- * Field types are implemented as subclasses of the generic HTMLFormField
- * object, and typically implement at least getInputHTML, which generates the
- * HTML for the input field to be placed in the table.
+ * This class has been replaced by the PreferencesFactory service.
  *
- * Once fields have been retrieved and validated, submission logic is handed
- * over to the tryUISubmit static method of this class.
+ * @deprecated since 1.31 use the PreferencesFactory service instead.
  */
 class Preferences {
-       /** @var array */
-       protected static $saveFilters = [
-               'timecorrection' => [ 'Preferences', 'filterTimezoneInput' ],
-               'rclimit' => [ 'Preferences', 'filterIntval' ],
-               'wllimit' => [ 'Preferences', 'filterIntval' ],
-               'searchlimit' => [ 'Preferences', 'filterIntval' ],
-       ];
 
-       // Stuff that shouldn't be saved as a preference.
-       private static $saveBlacklist = [
-               'realname',
-               'emailaddress',
-       ];
+       /**
+        * A shim to maintain backwards-compatibility of this class, basically replicating the
+        * default behaviour of the PreferencesFactory service but not permitting overriding.
+        * @return DefaultPreferencesFactory
+        */
+       protected static function getDefaultPreferencesFactory() {
+               global $wgContLang;
+               $authManager = AuthManager::singleton();
+               $linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer();
+               $config = MediaWikiServices::getInstance()->getMainConfig();
+               $preferencesFactory = new DefaultPreferencesFactory(
+                       $config, $wgContLang, $authManager, $linkRenderer
+               );
+               return $preferencesFactory;
+       }
 
        /**
         * @return array
         */
-       static function getSaveBlacklist() {
-               return self::$saveBlacklist;
+       public static function getSaveBlacklist() {
+               throw new Exception( __METHOD__ . '() is deprecated and does nothing' );
        }
 
        /**
@@ -74,24 +58,9 @@ class Preferences {
         * @param IContextSource $context
         * @return array|null
         */
-       static function getPreferences( $user, IContextSource $context ) {
-               $defaultPreferences = [];
-
-               self::profilePreferences( $user, $context, $defaultPreferences );
-               self::skinPreferences( $user, $context, $defaultPreferences );
-               self::datetimePreferences( $user, $context, $defaultPreferences );
-               self::filesPreferences( $user, $context, $defaultPreferences );
-               self::renderingPreferences( $user, $context, $defaultPreferences );
-               self::editingPreferences( $user, $context, $defaultPreferences );
-               self::rcPreferences( $user, $context, $defaultPreferences );
-               self::watchlistPreferences( $user, $context, $defaultPreferences );
-               self::searchPreferences( $user, $context, $defaultPreferences );
-               self::miscPreferences( $user, $context, $defaultPreferences );
-
-               Hooks::run( 'GetPreferences', [ $user, &$defaultPreferences ] );
-
-               self::loadPreferenceValues( $user, $context, $defaultPreferences );
-               return $defaultPreferences;
+       public static function getPreferences( $user, IContextSource $context ) {
+               $preferencesFactory = self::getDefaultPreferencesFactory();
+               return $preferencesFactory->getFormDescriptor( $user, $context );
        }
 
        /**
@@ -102,46 +71,8 @@ class Preferences {
         * @param array &$defaultPreferences Array to load values for
         * @return array|null
         */
-       static function loadPreferenceValues( $user, $context, &$defaultPreferences ) {
-               # # Remove preferences that wikis don't want to use
-               foreach ( $context->getConfig()->get( 'HiddenPrefs' ) as $pref ) {
-                       if ( isset( $defaultPreferences[$pref] ) ) {
-                               unset( $defaultPreferences[$pref] );
-                       }
-               }
-
-               # # Make sure that form fields have their parent set. See T43337.
-               $dummyForm = new HTMLForm( [], $context );
-
-               $disable = !$user->isAllowed( 'editmyoptions' );
-
-               $defaultOptions = User::getDefaultOptions();
-               # # Prod in defaults from the user
-               foreach ( $defaultPreferences as $name => &$info ) {
-                       $prefFromUser = self::getOptionFromUser( $name, $info, $user );
-                       if ( $disable && !in_array( $name, self::$saveBlacklist ) ) {
-                               $info['disabled'] = 'disabled';
-                       }
-                       $field = HTMLForm::loadInputFromParameters( $name, $info, $dummyForm ); // For validation
-                       $globalDefault = isset( $defaultOptions[$name] )
-                               ? $defaultOptions[$name]
-                               : null;
-
-                       // If it validates, set it as the default
-                       if ( isset( $info['default'] ) ) {
-                               // Already set, no problem
-                               continue;
-                       } elseif ( !is_null( $prefFromUser ) && // Make sure we're not just pulling nothing
-                                       $field->validate( $prefFromUser, $user->getOptions() ) === true ) {
-                               $info['default'] = $prefFromUser;
-                       } elseif ( $field->validate( $globalDefault, $user->getOptions() ) === true ) {
-                               $info['default'] = $globalDefault;
-                       } else {
-                               throw new MWException( "Global default '$globalDefault' is invalid for field $name" );
-                       }
-               }
-
-               return $defaultPreferences;
+       public static function loadPreferenceValues( $user, $context, &$defaultPreferences ) {
+               throw new Exception( __METHOD__ . '() is deprecated and does nothing' );
        }
 
        /**
@@ -152,41 +83,8 @@ class Preferences {
         * @param User $user
         * @return array|string
         */
-       static function getOptionFromUser( $name, $info, $user ) {
-               $val = $user->getOption( $name );
-
-               // Handling for multiselect preferences
-               if ( ( isset( $info['type'] ) && $info['type'] == 'multiselect' ) ||
-                               ( isset( $info['class'] ) && $info['class'] == 'HTMLMultiSelectField' ) ) {
-                       $options = HTMLFormField::flattenOptions( $info['options'] );
-                       $prefix = isset( $info['prefix'] ) ? $info['prefix'] : $name;
-                       $val = [];
-
-                       foreach ( $options as $value ) {
-                               if ( $user->getOption( "$prefix$value" ) ) {
-                                       $val[] = $value;
-                               }
-                       }
-               }
-
-               // Handling for checkmatrix preferences
-               if ( ( isset( $info['type'] ) && $info['type'] == 'checkmatrix' ) ||
-                               ( isset( $info['class'] ) && $info['class'] == 'HTMLCheckMatrix' ) ) {
-                       $columns = HTMLFormField::flattenOptions( $info['columns'] );
-                       $rows = HTMLFormField::flattenOptions( $info['rows'] );
-                       $prefix = isset( $info['prefix'] ) ? $info['prefix'] : $name;
-                       $val = [];
-
-                       foreach ( $columns as $column ) {
-                               foreach ( $rows as $row ) {
-                                       if ( $user->getOption( "$prefix$column-$row" ) ) {
-                                               $val[] = "$column-$row";
-                                       }
-                               }
-                       }
-               }
-
-               return $val;
+       public static function getOptionFromUser( $name, $info, $user ) {
+               throw new Exception( __METHOD__ . '() is deprecated and does nothing' );
        }
 
        /**
@@ -195,419 +93,11 @@ class Preferences {
         * @param array &$defaultPreferences
         * @return void
         */
-       static function profilePreferences( $user, IContextSource $context, &$defaultPreferences ) {
-               global $wgContLang, $wgParser;
-
-               $authManager = AuthManager::singleton();
-               $config = $context->getConfig();
-               // retrieving user name for GENDER and misc.
-               $userName = $user->getName();
-
-               # # User info #####################################
-               // Information panel
-               $defaultPreferences['username'] = [
-                       'type' => 'info',
-                       'label-message' => [ 'username', $userName ],
-                       'default' => $userName,
-                       'section' => 'personal/info',
-               ];
-
-               $lang = $context->getLanguage();
-
-               # Get groups to which the user belongs
-               $userEffectiveGroups = $user->getEffectiveGroups();
-               $userGroupMemberships = $user->getGroupMemberships();
-               $userGroups = $userMembers = $userTempGroups = $userTempMembers = [];
-               foreach ( $userEffectiveGroups as $ueg ) {
-                       if ( $ueg == '*' ) {
-                               // Skip the default * group, seems useless here
-                               continue;
-                       }
-
-                       if ( isset( $userGroupMemberships[$ueg] ) ) {
-                               $groupStringOrObject = $userGroupMemberships[$ueg];
-                       } else {
-                               $groupStringOrObject = $ueg;
-                       }
-
-                       $userG = UserGroupMembership::getLink( $groupStringOrObject, $context, 'html' );
-                       $userM = UserGroupMembership::getLink( $groupStringOrObject, $context, 'html',
-                               $userName );
-
-                       // Store expiring groups separately, so we can place them before non-expiring
-                       // groups in the list. This is to avoid the ambiguity of something like
-                       // "administrator, bureaucrat (until X date)" -- users might wonder whether the
-                       // expiry date applies to both groups, or just the last one
-                       if ( $groupStringOrObject instanceof UserGroupMembership &&
-                               $groupStringOrObject->getExpiry()
-                       ) {
-                               $userTempGroups[] = $userG;
-                               $userTempMembers[] = $userM;
-                       } else {
-                               $userGroups[] = $userG;
-                               $userMembers[] = $userM;
-                       }
-               }
-               sort( $userGroups );
-               sort( $userMembers );
-               sort( $userTempGroups );
-               sort( $userTempMembers );
-               $userGroups = array_merge( $userTempGroups, $userGroups );
-               $userMembers = array_merge( $userTempMembers, $userMembers );
-
-               $defaultPreferences['usergroups'] = [
-                       'type' => 'info',
-                       'label' => $context->msg( 'prefs-memberingroups' )->numParams(
-                               count( $userGroups ) )->params( $userName )->parse(),
-                       'default' => $context->msg( 'prefs-memberingroups-type' )
-                               ->rawParams( $lang->commaList( $userGroups ), $lang->commaList( $userMembers ) )
-                               ->escaped(),
-                       'raw' => true,
-                       'section' => 'personal/info',
-               ];
-
-               $linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer();
-
-               $editCount = $linkRenderer->makeLink( SpecialPage::getTitleFor( "Contributions", $userName ),
-                       $lang->formatNum( $user->getEditCount() ) );
-
-               $defaultPreferences['editcount'] = [
-                       'type' => 'info',
-                       'raw' => true,
-                       'label-message' => 'prefs-edits',
-                       'default' => $editCount,
-                       'section' => 'personal/info',
-               ];
-
-               if ( $user->getRegistration() ) {
-                       $displayUser = $context->getUser();
-                       $userRegistration = $user->getRegistration();
-                       $defaultPreferences['registrationdate'] = [
-                               'type' => 'info',
-                               'label-message' => 'prefs-registration',
-                               'default' => $context->msg(
-                                       'prefs-registration-date-time',
-                                       $lang->userTimeAndDate( $userRegistration, $displayUser ),
-                                       $lang->userDate( $userRegistration, $displayUser ),
-                                       $lang->userTime( $userRegistration, $displayUser )
-                               )->parse(),
-                               'section' => 'personal/info',
-                       ];
-               }
-
-               $canViewPrivateInfo = $user->isAllowed( 'viewmyprivateinfo' );
-               $canEditPrivateInfo = $user->isAllowed( 'editmyprivateinfo' );
-
-               // Actually changeable stuff
-               $defaultPreferences['realname'] = [
-                       // (not really "private", but still shouldn't be edited without permission)
-                       'type' => $canEditPrivateInfo && $authManager->allowsPropertyChange( 'realname' )
-                               ? 'text' : 'info',
-                       'default' => $user->getRealName(),
-                       'section' => 'personal/info',
-                       'label-message' => 'yourrealname',
-                       'help-message' => 'prefs-help-realname',
-               ];
-
-               if ( $canEditPrivateInfo && $authManager->allowsAuthenticationDataChange(
-                       new PasswordAuthenticationRequest(), false )->isGood()
-               ) {
-                       $link = $linkRenderer->makeLink( SpecialPage::getTitleFor( 'ChangePassword' ),
-                               $context->msg( 'prefs-resetpass' )->text(), [],
-                               [ 'returnto' => SpecialPage::getTitleFor( 'Preferences' )->getPrefixedText() ] );
-
-                       $defaultPreferences['password'] = [
-                               'type' => 'info',
-                               'raw' => true,
-                               'default' => $link,
-                               'label-message' => 'yourpassword',
-                               'section' => 'personal/info',
-                       ];
-               }
-               // Only show prefershttps if secure login is turned on
-               if ( $config->get( 'SecureLogin' ) && wfCanIPUseHTTPS( $context->getRequest()->getIP() ) ) {
-                       $defaultPreferences['prefershttps'] = [
-                               'type' => 'toggle',
-                               'label-message' => 'tog-prefershttps',
-                               'help-message' => 'prefs-help-prefershttps',
-                               'section' => 'personal/info'
-                       ];
-               }
-
-               // Language
-               $languages = Language::fetchLanguageNames( null, 'mw' );
-               $languageCode = $config->get( 'LanguageCode' );
-               if ( !array_key_exists( $languageCode, $languages ) ) {
-                       $languages[$languageCode] = $languageCode;
-               }
-               ksort( $languages );
-
-               $options = [];
-               foreach ( $languages as $code => $name ) {
-                       $display = LanguageCode::bcp47( $code ) . ' - ' . $name;
-                       $options[$display] = $code;
-               }
-               $defaultPreferences['language'] = [
-                       'type' => 'select',
-                       'section' => 'personal/i18n',
-                       'options' => $options,
-                       'label-message' => 'yourlanguage',
-               ];
-
-               $defaultPreferences['gender'] = [
-                       'type' => 'radio',
-                       'section' => 'personal/i18n',
-                       'options' => [
-                               $context->msg( 'parentheses' )
-                                       ->params( $context->msg( 'gender-unknown' )->plain() )
-                                       ->escaped() => 'unknown',
-                               $context->msg( 'gender-female' )->escaped() => 'female',
-                               $context->msg( 'gender-male' )->escaped() => 'male',
-                       ],
-                       'label-message' => 'yourgender',
-                       'help-message' => 'prefs-help-gender',
-               ];
-
-               // see if there are multiple language variants to choose from
-               if ( !$config->get( 'DisableLangConversion' ) ) {
-                       foreach ( LanguageConverter::$languagesWithVariants as $langCode ) {
-                               if ( $langCode == $wgContLang->getCode() ) {
-                                       $variants = $wgContLang->getVariants();
-
-                                       if ( count( $variants ) <= 1 ) {
-                                               continue;
-                                       }
-
-                                       $variantArray = [];
-                                       foreach ( $variants as $v ) {
-                                               $v = str_replace( '_', '-', strtolower( $v ) );
-                                               $variantArray[$v] = $lang->getVariantname( $v, false );
-                                       }
-
-                                       $options = [];
-                                       foreach ( $variantArray as $code => $name ) {
-                                               $display = LanguageCode::bcp47( $code ) . ' - ' . $name;
-                                               $options[$display] = $code;
-                                       }
-
-                                       $defaultPreferences['variant'] = [
-                                               'label-message' => 'yourvariant',
-                                               'type' => 'select',
-                                               'options' => $options,
-                                               'section' => 'personal/i18n',
-                                               'help-message' => 'prefs-help-variant',
-                                       ];
-                               } else {
-                                       $defaultPreferences["variant-$langCode"] = [
-                                               'type' => 'api',
-                                       ];
-                               }
-                       }
-               }
-
-               // Stuff from Language::getExtraUserToggles()
-               // FIXME is this dead code? $extraUserToggles doesn't seem to be defined for any language
-               $toggles = $wgContLang->getExtraUserToggles();
-
-               foreach ( $toggles as $toggle ) {
-                       $defaultPreferences[$toggle] = [
-                               'type' => 'toggle',
-                               'section' => 'personal/i18n',
-                               'label-message' => "tog-$toggle",
-                       ];
-               }
-
-               // show a preview of the old signature first
-               $oldsigWikiText = $wgParser->preSaveTransform(
-                       '~~~',
-                       $context->getTitle(),
-                       $user,
-                       ParserOptions::newFromContext( $context )
-               );
-               $oldsigHTML = $context->getOutput()->parseInline( $oldsigWikiText, true, true );
-               $defaultPreferences['oldsig'] = [
-                       'type' => 'info',
-                       'raw' => true,
-                       'label-message' => 'tog-oldsig',
-                       'default' => $oldsigHTML,
-                       'section' => 'personal/signature',
-               ];
-               $defaultPreferences['nickname'] = [
-                       'type' => $authManager->allowsPropertyChange( 'nickname' ) ? 'text' : 'info',
-                       'maxlength' => $config->get( 'MaxSigChars' ),
-                       'label-message' => 'yournick',
-                       'validation-callback' => [ 'Preferences', 'validateSignature' ],
-                       'section' => 'personal/signature',
-                       'filter-callback' => [ 'Preferences', 'cleanSignature' ],
-               ];
-               $defaultPreferences['fancysig'] = [
-                       'type' => 'toggle',
-                       'label-message' => 'tog-fancysig',
-                       // show general help about signature at the bottom of the section
-                       'help-message' => 'prefs-help-signature',
-                       'section' => 'personal/signature'
-               ];
-
-               # # Email stuff
-
-               if ( $config->get( 'EnableEmail' ) ) {
-                       if ( $canViewPrivateInfo ) {
-                               $helpMessages[] = $config->get( 'EmailConfirmToEdit' )
-                                               ? 'prefs-help-email-required'
-                                               : 'prefs-help-email';
-
-                               if ( $config->get( 'EnableUserEmail' ) ) {
-                                       // additional messages when users can send email to each other
-                                       $helpMessages[] = 'prefs-help-email-others';
-                               }
-
-                               $emailAddress = $user->getEmail() ? htmlspecialchars( $user->getEmail() ) : '';
-                               if ( $canEditPrivateInfo && $authManager->allowsPropertyChange( 'emailaddress' ) ) {
-                                       $link = $linkRenderer->makeLink(
-                                               SpecialPage::getTitleFor( 'ChangeEmail' ),
-                                               $context->msg( $user->getEmail() ? 'prefs-changeemail' : 'prefs-setemail' )->text(),
-                                               [],
-                                               [ 'returnto' => SpecialPage::getTitleFor( 'Preferences' )->getPrefixedText() ] );
-
-                                       $emailAddress .= $emailAddress == '' ? $link : (
-                                               $context->msg( 'word-separator' )->escaped()
-                                               . $context->msg( 'parentheses' )->rawParams( $link )->escaped()
-                                       );
-                               }
-
-                               $defaultPreferences['emailaddress'] = [
-                                       'type' => 'info',
-                                       'raw' => true,
-                                       'default' => $emailAddress,
-                                       'label-message' => 'youremail',
-                                       'section' => 'personal/email',
-                                       'help-messages' => $helpMessages,
-                                       # 'cssclass' chosen below
-                               ];
-                       }
-
-                       $disableEmailPrefs = false;
-
-                       if ( $config->get( 'EmailAuthentication' ) ) {
-                               $emailauthenticationclass = 'mw-email-not-authenticated';
-                               if ( $user->getEmail() ) {
-                                       if ( $user->getEmailAuthenticationTimestamp() ) {
-                                               // date and time are separate parameters to facilitate localisation.
-                                               // $time is kept for backward compat reasons.
-                                               // 'emailauthenticated' is also used in SpecialConfirmemail.php
-                                               $displayUser = $context->getUser();
-                                               $emailTimestamp = $user->getEmailAuthenticationTimestamp();
-                                               $time = $lang->userTimeAndDate( $emailTimestamp, $displayUser );
-                                               $d = $lang->userDate( $emailTimestamp, $displayUser );
-                                               $t = $lang->userTime( $emailTimestamp, $displayUser );
-                                               $emailauthenticated = $context->msg( 'emailauthenticated',
-                                                       $time, $d, $t )->parse() . '<br />';
-                                               $disableEmailPrefs = false;
-                                               $emailauthenticationclass = 'mw-email-authenticated';
-                                       } else {
-                                               $disableEmailPrefs = true;
-                                               $emailauthenticated = $context->msg( 'emailnotauthenticated' )->parse() . '<br />' .
-                                                       $linkRenderer->makeKnownLink(
-                                                               SpecialPage::getTitleFor( 'Confirmemail' ),
-                                                               $context->msg( 'emailconfirmlink' )->text()
-                                                       ) . '<br />';
-                                               $emailauthenticationclass = "mw-email-not-authenticated";
-                                       }
-                               } else {
-                                       $disableEmailPrefs = true;
-                                       $emailauthenticated = $context->msg( 'noemailprefs' )->escaped();
-                                       $emailauthenticationclass = 'mw-email-none';
-                               }
-
-                               if ( $canViewPrivateInfo ) {
-                                       $defaultPreferences['emailauthentication'] = [
-                                               'type' => 'info',
-                                               'raw' => true,
-                                               'section' => 'personal/email',
-                                               'label-message' => 'prefs-emailconfirm-label',
-                                               'default' => $emailauthenticated,
-                                               # Apply the same CSS class used on the input to the message:
-                                               'cssclass' => $emailauthenticationclass,
-                                       ];
-                               }
-                       }
-
-                       if ( $config->get( 'EnableUserEmail' ) && $user->isAllowed( 'sendemail' ) ) {
-                               $defaultPreferences['disablemail'] = [
-                                       'id' => 'wpAllowEmail',
-                                       'type' => 'toggle',
-                                       'invert' => true,
-                                       'section' => 'personal/email',
-                                       'label-message' => 'allowemail',
-                                       'disabled' => $disableEmailPrefs,
-                               ];
-
-                               $defaultPreferences['email-allow-new-users'] = [
-                                       'id' => 'wpAllowEmailFromNewUsers',
-                                       'type' => 'toggle',
-                                       'section' => 'personal/email',
-                                       'label-message' => 'email-allow-new-users-label',
-                                       'disabled' => $disableEmailPrefs,
-                               ];
-
-                               $defaultPreferences['ccmeonemails'] = [
-                                       'type' => 'toggle',
-                                       'section' => 'personal/email',
-                                       'label-message' => 'tog-ccmeonemails',
-                                       'disabled' => $disableEmailPrefs,
-                               ];
-
-                               if ( $config->get( 'EnableUserEmailBlacklist' ) ) {
-                                       $lookup = CentralIdLookup::factory();
-                                       $ids = $user->getOption( 'email-blacklist', [] );
-                                       $names = $ids ? $lookup->namesFromCentralIds( $ids, $user ) : [];
-
-                                       $defaultPreferences['email-blacklist'] = [
-                                               'type' => 'usersmultiselect',
-                                               'label-message' => 'email-blacklist-label',
-                                               'section' => 'personal/email',
-                                               'default' => implode( "\n", $names ),
-                                               'disabled' => $disableEmailPrefs,
-                                       ];
-                               }
-                       }
-
-                       if ( $config->get( 'EnotifWatchlist' ) ) {
-                               $defaultPreferences['enotifwatchlistpages'] = [
-                                       'type' => 'toggle',
-                                       'section' => 'personal/email',
-                                       'label-message' => 'tog-enotifwatchlistpages',
-                                       'disabled' => $disableEmailPrefs,
-                               ];
-                       }
-                       if ( $config->get( 'EnotifUserTalk' ) ) {
-                               $defaultPreferences['enotifusertalkpages'] = [
-                                       'type' => 'toggle',
-                                       'section' => 'personal/email',
-                                       'label-message' => 'tog-enotifusertalkpages',
-                                       'disabled' => $disableEmailPrefs,
-                               ];
-                       }
-                       if ( $config->get( 'EnotifUserTalk' ) || $config->get( 'EnotifWatchlist' ) ) {
-                               if ( $config->get( 'EnotifMinorEdits' ) ) {
-                                       $defaultPreferences['enotifminoredits'] = [
-                                               'type' => 'toggle',
-                                               'section' => 'personal/email',
-                                               'label-message' => 'tog-enotifminoredits',
-                                               'disabled' => $disableEmailPrefs,
-                                       ];
-                               }
-
-                               if ( $config->get( 'EnotifRevealEditorAddress' ) ) {
-                                       $defaultPreferences['enotifrevealaddr'] = [
-                                               'type' => 'toggle',
-                                               'section' => 'personal/email',
-                                               'label-message' => 'tog-enotifrevealaddr',
-                                               'disabled' => $disableEmailPrefs,
-                                       ];
-                               }
-                       }
-               }
+       public static function profilePreferences(
+               $user, IContextSource $context, &$defaultPreferences
+       ) {
+               wfDeprecated( __METHOD__, '1.31' );
+               $defaultPreferences = self::getPreferences( $user, $context );
        }
 
        /**
@@ -616,48 +106,9 @@ class Preferences {
         * @param array &$defaultPreferences
         * @return void
         */
-       static function skinPreferences( $user, IContextSource $context, &$defaultPreferences ) {
-               # # Skin #####################################
-
-               // Skin selector, if there is at least one valid skin
-               $skinOptions = self::generateSkinOptions( $user, $context );
-               if ( $skinOptions ) {
-                       $defaultPreferences['skin'] = [
-                               'type' => 'radio',
-                               'options' => $skinOptions,
-                               'section' => 'rendering/skin',
-                       ];
-               }
-
-               $config = $context->getConfig();
-               $allowUserCss = $config->get( 'AllowUserCss' );
-               $allowUserJs = $config->get( 'AllowUserJs' );
-               # Create links to user CSS/JS pages for all skins
-               # This code is basically copied from generateSkinOptions().  It'd
-               # be nice to somehow merge this back in there to avoid redundancy.
-               if ( $allowUserCss || $allowUserJs ) {
-                       $linkTools = [];
-                       $userName = $user->getName();
-
-                       $linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer();
-                       if ( $allowUserCss ) {
-                               $cssPage = Title::makeTitleSafe( NS_USER, $userName . '/common.css' );
-                               $linkTools[] = $linkRenderer->makeLink( $cssPage, $context->msg( 'prefs-custom-css' )->text() );
-                       }
-
-                       if ( $allowUserJs ) {
-                               $jsPage = Title::makeTitleSafe( NS_USER, $userName . '/common.js' );
-                               $linkTools[] = $linkRenderer->makeLink( $jsPage, $context->msg( 'prefs-custom-js' )->text() );
-                       }
-
-                       $defaultPreferences['commoncssjs'] = [
-                               'type' => 'info',
-                               'raw' => true,
-                               'default' => $context->getLanguage()->pipeList( $linkTools ),
-                               'label-message' => 'prefs-common-css-js',
-                               'section' => 'rendering/skin',
-                       ];
-               }
+       public static function skinPreferences( $user, IContextSource $context, &$defaultPreferences ) {
+               wfDeprecated( __METHOD__, '1.31' );
+               $defaultPreferences = self::getPreferences( $user, $context );
        }
 
        /**
@@ -665,20 +116,11 @@ class Preferences {
         * @param IContextSource $context
         * @param array &$defaultPreferences
         */
-       static function filesPreferences( $user, IContextSource $context, &$defaultPreferences ) {
-               # # Files #####################################
-               $defaultPreferences['imagesize'] = [
-                       'type' => 'select',
-                       'options' => self::getImageSizes( $context ),
-                       'label-message' => 'imagemaxsize',
-                       'section' => 'rendering/files',
-               ];
-               $defaultPreferences['thumbsize'] = [
-                       'type' => 'select',
-                       'options' => self::getThumbSizes( $context ),
-                       'label-message' => 'thumbsize',
-                       'section' => 'rendering/files',
-               ];
+       public static function filesPreferences(
+               $user, IContextSource $context, &$defaultPreferences
+       ) {
+               wfDeprecated( __METHOD__, '1.31' );
+               $defaultPreferences = self::getPreferences( $user, $context );
        }
 
        /**
@@ -687,75 +129,11 @@ class Preferences {
         * @param array &$defaultPreferences
         * @return void
         */
-       static function datetimePreferences( $user, IContextSource $context, &$defaultPreferences ) {
-               # # Date and time #####################################
-               $dateOptions = self::getDateOptions( $context );
-               if ( $dateOptions ) {
-                       $defaultPreferences['date'] = [
-                               'type' => 'radio',
-                               'options' => $dateOptions,
-                               'section' => 'rendering/dateformat',
-                       ];
-               }
-
-               // Info
-               $now = wfTimestampNow();
-               $lang = $context->getLanguage();
-               $nowlocal = Xml::element( 'span', [ 'id' => 'wpLocalTime' ],
-                       $lang->userTime( $now, $user ) );
-               $nowserver = $lang->userTime( $now, $user,
-                               [ 'format' => false, 'timecorrection' => false ] ) .
-                       Html::hidden( 'wpServerTime', (int)substr( $now, 8, 2 ) * 60 + (int)substr( $now, 10, 2 ) );
-
-               $defaultPreferences['nowserver'] = [
-                       'type' => 'info',
-                       'raw' => 1,
-                       'label-message' => 'servertime',
-                       'default' => $nowserver,
-                       'section' => 'rendering/timeoffset',
-               ];
-
-               $defaultPreferences['nowlocal'] = [
-                       'type' => 'info',
-                       'raw' => 1,
-                       'label-message' => 'localtime',
-                       'default' => $nowlocal,
-                       'section' => 'rendering/timeoffset',
-               ];
-
-               // Grab existing pref.
-               $tzOffset = $user->getOption( 'timecorrection' );
-               $tz = explode( '|', $tzOffset, 3 );
-
-               $tzOptions = self::getTimezoneOptions( $context );
-
-               $tzSetting = $tzOffset;
-               if ( count( $tz ) > 1 && $tz[0] == 'ZoneInfo' &&
-                       !in_array( $tzOffset, HTMLFormField::flattenOptions( $tzOptions ) )
-               ) {
-                       // Timezone offset can vary with DST
-                       try {
-                               $userTZ = new DateTimeZone( $tz[2] );
-                               $minDiff = floor( $userTZ->getOffset( new DateTime( 'now' ) ) / 60 );
-                               $tzSetting = "ZoneInfo|$minDiff|{$tz[2]}";
-                       } catch ( Exception $e ) {
-                               // User has an invalid time zone set. Fall back to just using the offset
-                               $tz[0] = 'Offset';
-                       }
-               }
-               if ( count( $tz ) > 1 && $tz[0] == 'Offset' ) {
-                       $minDiff = $tz[1];
-                       $tzSetting = sprintf( '%+03d:%02d', floor( $minDiff / 60 ), abs( $minDiff ) % 60 );
-               }
-
-               $defaultPreferences['timecorrection'] = [
-                       'class' => 'HTMLSelectOrOtherField',
-                       'label-message' => 'timezonelegend',
-                       'options' => $tzOptions,
-                       'default' => $tzSetting,
-                       'size' => 20,
-                       'section' => 'rendering/timeoffset',
-               ];
+       public static function datetimePreferences(
+               $user, IContextSource $context, &$defaultPreferences
+       ) {
+               wfDeprecated( __METHOD__, '1.31' );
+               $defaultPreferences = self::getPreferences( $user, $context );
        }
 
        /**
@@ -763,61 +141,11 @@ class Preferences {
         * @param IContextSource $context
         * @param array &$defaultPreferences
         */
-       static function renderingPreferences( $user, IContextSource $context, &$defaultPreferences ) {
-               # # Diffs ####################################
-               $defaultPreferences['diffonly'] = [
-                       'type' => 'toggle',
-                       'section' => 'rendering/diffs',
-                       'label-message' => 'tog-diffonly',
-               ];
-               $defaultPreferences['norollbackdiff'] = [
-                       'type' => 'toggle',
-                       'section' => 'rendering/diffs',
-                       'label-message' => 'tog-norollbackdiff',
-               ];
-
-               # # Page Rendering ##############################
-               if ( $context->getConfig()->get( 'AllowUserCssPrefs' ) ) {
-                       $defaultPreferences['underline'] = [
-                               'type' => 'select',
-                               'options' => [
-                                       $context->msg( 'underline-never' )->text() => 0,
-                                       $context->msg( 'underline-always' )->text() => 1,
-                                       $context->msg( 'underline-default' )->text() => 2,
-                               ],
-                               'label-message' => 'tog-underline',
-                               'section' => 'rendering/advancedrendering',
-                       ];
-               }
-
-               $stubThresholdValues = [ 50, 100, 500, 1000, 2000, 5000, 10000 ];
-               $stubThresholdOptions = [ $context->msg( 'stub-threshold-disabled' )->text() => 0 ];
-               foreach ( $stubThresholdValues as $value ) {
-                       $stubThresholdOptions[$context->msg( 'size-bytes', $value )->text()] = $value;
-               }
-
-               $defaultPreferences['stubthreshold'] = [
-                       'type' => 'select',
-                       'section' => 'rendering/advancedrendering',
-                       'options' => $stubThresholdOptions,
-                       // This is not a raw HTML message; label-raw is needed for the manual <a></a>
-                       'label-raw' => $context->msg( 'stub-threshold' )->rawParams(
-                               '<a href="#" class="stub">' .
-                               $context->msg( 'stub-threshold-sample-link' )->parse() .
-                               '</a>' )->parse(),
-               ];
-
-               $defaultPreferences['showhiddencats'] = [
-                       'type' => 'toggle',
-                       'section' => 'rendering/advancedrendering',
-                       'label-message' => 'tog-showhiddencats'
-               ];
-
-               $defaultPreferences['numberheadings'] = [
-                       'type' => 'toggle',
-                       'section' => 'rendering/advancedrendering',
-                       'label-message' => 'tog-numberheadings',
-               ];
+       public static function renderingPreferences(
+               $user, IContextSource $context, &$defaultPreferences
+       ) {
+               wfDeprecated( __METHOD__, '1.31' );
+               $defaultPreferences = self::getPreferences( $user, $context );
        }
 
        /**
@@ -825,71 +153,11 @@ class Preferences {
         * @param IContextSource $context
         * @param array &$defaultPreferences
         */
-       static function editingPreferences( $user, IContextSource $context, &$defaultPreferences ) {
-               # # Editing #####################################
-               $defaultPreferences['editsectiononrightclick'] = [
-                       'type' => 'toggle',
-                       'section' => 'editing/advancedediting',
-                       'label-message' => 'tog-editsectiononrightclick',
-               ];
-               $defaultPreferences['editondblclick'] = [
-                       'type' => 'toggle',
-                       'section' => 'editing/advancedediting',
-                       'label-message' => 'tog-editondblclick',
-               ];
-
-               if ( $context->getConfig()->get( 'AllowUserCssPrefs' ) ) {
-                       $defaultPreferences['editfont'] = [
-                               'type' => 'select',
-                               'section' => 'editing/editor',
-                               'label-message' => 'editfont-style',
-                               'options' => [
-                                       $context->msg( 'editfont-monospace' )->text() => 'monospace',
-                                       $context->msg( 'editfont-sansserif' )->text() => 'sans-serif',
-                                       $context->msg( 'editfont-serif' )->text() => 'serif',
-                               ]
-                       ];
-               }
-
-               if ( $user->isAllowed( 'minoredit' ) ) {
-                       $defaultPreferences['minordefault'] = [
-                               'type' => 'toggle',
-                               'section' => 'editing/editor',
-                               'label-message' => 'tog-minordefault',
-                       ];
-               }
-
-               $defaultPreferences['forceeditsummary'] = [
-                       'type' => 'toggle',
-                       'section' => 'editing/editor',
-                       'label-message' => 'tog-forceeditsummary',
-               ];
-               $defaultPreferences['useeditwarning'] = [
-                       'type' => 'toggle',
-                       'section' => 'editing/editor',
-                       'label-message' => 'tog-useeditwarning',
-               ];
-               $defaultPreferences['showtoolbar'] = [
-                       'type' => 'toggle',
-                       'section' => 'editing/editor',
-                       'label-message' => 'tog-showtoolbar',
-               ];
-
-               $defaultPreferences['previewonfirst'] = [
-                       'type' => 'toggle',
-                       'section' => 'editing/preview',
-                       'label-message' => 'tog-previewonfirst',
-               ];
-               $defaultPreferences['previewontop'] = [
-                       'type' => 'toggle',
-                       'section' => 'editing/preview',
-                       'label-message' => 'tog-previewontop',
-               ];
-               $defaultPreferences['uselivepreview'] = [
-                       'type' => 'toggle',
-                       'section' => 'editing/preview',
-                       'label-message' => 'tog-uselivepreview',
-               ];
+       public static function editingPreferences(
+               $user, IContextSource $context, &$defaultPreferences
+       ) {
+               wfDeprecated( __METHOD__, '1.31' );
+               $defaultPreferences = self::getPreferences( $user, $context );
        }
 
        /**
@@ -897,93 +165,9 @@ class Preferences {
         * @param IContextSource $context
         * @param array &$defaultPreferences
         */
-       static function rcPreferences( $user, IContextSource $context, &$defaultPreferences ) {
-               $config = $context->getConfig();
-               $rcMaxAge = $config->get( 'RCMaxAge' );
-               # # RecentChanges #####################################
-               $defaultPreferences['rcdays'] = [
-                       'type' => 'float',
-                       'label-message' => 'recentchangesdays',
-                       'section' => 'rc/displayrc',
-                       'min' => 1,
-                       'max' => ceil( $rcMaxAge / ( 3600 * 24 ) ),
-                       'help' => $context->msg( 'recentchangesdays-max' )->numParams(
-                               ceil( $rcMaxAge / ( 3600 * 24 ) ) )->escaped()
-               ];
-               $defaultPreferences['rclimit'] = [
-                       'type' => 'int',
-                       'min' => 0,
-                       'max' => 1000,
-                       'label-message' => 'recentchangescount',
-                       'help-message' => 'prefs-help-recentchangescount',
-                       'section' => 'rc/displayrc',
-               ];
-               $defaultPreferences['usenewrc'] = [
-                       'type' => 'toggle',
-                       'label-message' => 'tog-usenewrc',
-                       'section' => 'rc/advancedrc',
-               ];
-               $defaultPreferences['hideminor'] = [
-                       'type' => 'toggle',
-                       'label-message' => 'tog-hideminor',
-                       'section' => 'rc/advancedrc',
-               ];
-               $defaultPreferences['rcfilters-saved-queries'] = [
-                       'type' => 'api',
-               ];
-               $defaultPreferences['rcfilters-wl-saved-queries'] = [
-                       'type' => 'api',
-               ];
-               // Override RCFilters preferences for RecentChanges 'limit'
-               $defaultPreferences['rcfilters-limit'] = [
-                       'type' => 'api',
-               ];
-               $defaultPreferences['rcfilters-saved-queries-versionbackup'] = [
-                       'type' => 'api',
-               ];
-               $defaultPreferences['rcfilters-wl-saved-queries-versionbackup'] = [
-                       'type' => 'api',
-               ];
-               if ( $config->get( 'RCWatchCategoryMembership' ) ) {
-                       $defaultPreferences['hidecategorization'] = [
-                               'type' => 'toggle',
-                               'label-message' => 'tog-hidecategorization',
-                               'section' => 'rc/advancedrc',
-                       ];
-               }
-
-               if ( $user->useRCPatrol() ) {
-                       $defaultPreferences['hidepatrolled'] = [
-                               'type' => 'toggle',
-                               'section' => 'rc/advancedrc',
-                               'label-message' => 'tog-hidepatrolled',
-                       ];
-               }
-
-               if ( $user->useNPPatrol() ) {
-                       $defaultPreferences['newpageshidepatrolled'] = [
-                               'type' => 'toggle',
-                               'section' => 'rc/advancedrc',
-                               'label-message' => 'tog-newpageshidepatrolled',
-                       ];
-               }
-
-               if ( $config->get( 'RCShowWatchingUsers' ) ) {
-                       $defaultPreferences['shownumberswatching'] = [
-                               'type' => 'toggle',
-                               'section' => 'rc/advancedrc',
-                               'label-message' => 'tog-shownumberswatching',
-                       ];
-               }
-
-               if ( $config->get( 'StructuredChangeFiltersShowPreference' ) ) {
-                       $defaultPreferences['rcenhancedfilters-disable'] = [
-                               'type' => 'toggle',
-                               'section' => 'rc/opt-out',
-                               'label-message' => 'rcfilters-preference-label',
-                               'help-message' => 'rcfilters-preference-help',
-                       ];
-               }
+       public static function rcPreferences( $user, IContextSource $context, &$defaultPreferences ) {
+               wfDeprecated( __METHOD__, '1.31' );
+               $defaultPreferences = self::getPreferences( $user, $context );
        }
 
        /**
@@ -991,154 +175,11 @@ class Preferences {
         * @param IContextSource $context
         * @param array &$defaultPreferences
         */
-       static function watchlistPreferences( $user, IContextSource $context, &$defaultPreferences ) {
-               $config = $context->getConfig();
-               $watchlistdaysMax = ceil( $config->get( 'RCMaxAge' ) / ( 3600 * 24 ) );
-
-               # # Watchlist #####################################
-               if ( $user->isAllowed( 'editmywatchlist' ) ) {
-                       $editWatchlistLinks = [];
-                       $editWatchlistModes = [
-                               'edit' => [ 'EditWatchlist', false ],
-                               'raw' => [ 'EditWatchlist', 'raw' ],
-                               'clear' => [ 'EditWatchlist', 'clear' ],
-                       ];
-                       $linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer();
-                       foreach ( $editWatchlistModes as $editWatchlistMode => $mode ) {
-                               // Messages: prefs-editwatchlist-edit, prefs-editwatchlist-raw, prefs-editwatchlist-clear
-                               $editWatchlistLinks[] = $linkRenderer->makeKnownLink(
-                                       SpecialPage::getTitleFor( $mode[0], $mode[1] ),
-                                       new HtmlArmor( $context->msg( "prefs-editwatchlist-{$editWatchlistMode}" )->parse() )
-                               );
-                       }
-
-                       $defaultPreferences['editwatchlist'] = [
-                               'type' => 'info',
-                               'raw' => true,
-                               'default' => $context->getLanguage()->pipeList( $editWatchlistLinks ),
-                               'label-message' => 'prefs-editwatchlist-label',
-                               'section' => 'watchlist/editwatchlist',
-                       ];
-               }
-
-               $defaultPreferences['watchlistdays'] = [
-                       'type' => 'float',
-                       'min' => 0,
-                       'max' => $watchlistdaysMax,
-                       'section' => 'watchlist/displaywatchlist',
-                       'help' => $context->msg( 'prefs-watchlist-days-max' )->numParams(
-                               $watchlistdaysMax )->escaped(),
-                       'label-message' => 'prefs-watchlist-days',
-               ];
-               $defaultPreferences['wllimit'] = [
-                       'type' => 'int',
-                       'min' => 0,
-                       'max' => 1000,
-                       'label-message' => 'prefs-watchlist-edits',
-                       'help' => $context->msg( 'prefs-watchlist-edits-max' )->escaped(),
-                       'section' => 'watchlist/displaywatchlist',
-               ];
-               $defaultPreferences['extendwatchlist'] = [
-                       'type' => 'toggle',
-                       'section' => 'watchlist/advancedwatchlist',
-                       'label-message' => 'tog-extendwatchlist',
-               ];
-               $defaultPreferences['watchlisthideminor'] = [
-                       'type' => 'toggle',
-                       'section' => 'watchlist/advancedwatchlist',
-                       'label-message' => 'tog-watchlisthideminor',
-               ];
-               $defaultPreferences['watchlisthidebots'] = [
-                       'type' => 'toggle',
-                       'section' => 'watchlist/advancedwatchlist',
-                       'label-message' => 'tog-watchlisthidebots',
-               ];
-               $defaultPreferences['watchlisthideown'] = [
-                       'type' => 'toggle',
-                       'section' => 'watchlist/advancedwatchlist',
-                       'label-message' => 'tog-watchlisthideown',
-               ];
-               $defaultPreferences['watchlisthideanons'] = [
-                       'type' => 'toggle',
-                       'section' => 'watchlist/advancedwatchlist',
-                       'label-message' => 'tog-watchlisthideanons',
-               ];
-               $defaultPreferences['watchlisthideliu'] = [
-                       'type' => 'toggle',
-                       'section' => 'watchlist/advancedwatchlist',
-                       'label-message' => 'tog-watchlisthideliu',
-               ];
-               $defaultPreferences['watchlistreloadautomatically'] = [
-                       'type' => 'toggle',
-                       'section' => 'watchlist/advancedwatchlist',
-                       'label-message' => 'tog-watchlistreloadautomatically',
-               ];
-               $defaultPreferences['watchlistunwatchlinks'] = [
-                       'type' => 'toggle',
-                       'section' => 'watchlist/advancedwatchlist',
-                       'label-message' => 'tog-watchlistunwatchlinks',
-               ];
-
-               if ( $config->get( 'RCWatchCategoryMembership' ) ) {
-                       $defaultPreferences['watchlisthidecategorization'] = [
-                               'type' => 'toggle',
-                               'section' => 'watchlist/advancedwatchlist',
-                               'label-message' => 'tog-watchlisthidecategorization',
-                       ];
-               }
-
-               if ( $user->useRCPatrol() ) {
-                       $defaultPreferences['watchlisthidepatrolled'] = [
-                               'type' => 'toggle',
-                               'section' => 'watchlist/advancedwatchlist',
-                               'label-message' => 'tog-watchlisthidepatrolled',
-                       ];
-               }
-
-               $watchTypes = [
-                       'edit' => 'watchdefault',
-                       'move' => 'watchmoves',
-                       'delete' => 'watchdeletion'
-               ];
-
-               // Kinda hacky
-               if ( $user->isAllowed( 'createpage' ) || $user->isAllowed( 'createtalk' ) ) {
-                       $watchTypes['read'] = 'watchcreations';
-               }
-
-               if ( $user->isAllowed( 'rollback' ) ) {
-                       $watchTypes['rollback'] = 'watchrollback';
-               }
-
-               if ( $user->isAllowed( 'upload' ) ) {
-                       $watchTypes['upload'] = 'watchuploads';
-               }
-
-               foreach ( $watchTypes as $action => $pref ) {
-                       if ( $user->isAllowed( $action ) ) {
-                               // Messages:
-                               // tog-watchdefault, tog-watchmoves, tog-watchdeletion, tog-watchcreations, tog-watchuploads
-                               // tog-watchrollback
-                               $defaultPreferences[$pref] = [
-                                       'type' => 'toggle',
-                                       'section' => 'watchlist/advancedwatchlist',
-                                       'label-message' => "tog-$pref",
-                               ];
-                       }
-               }
-
-               if ( $config->get( 'EnableAPI' ) ) {
-                       $defaultPreferences['watchlisttoken'] = [
-                               'type' => 'api',
-                       ];
-                       $defaultPreferences['watchlisttoken-info'] = [
-                               'type' => 'info',
-                               'section' => 'watchlist/tokenwatchlist',
-                               'label-message' => 'prefs-watchlist-token',
-                               'default' => $user->getTokenFromOption( 'watchlisttoken' ),
-                               'help-message' => 'prefs-help-watchlist-token2',
-                       ];
-               }
+       public static function watchlistPreferences(
+               $user, IContextSource $context, &$defaultPreferences
+       ) {
+               wfDeprecated( __METHOD__, '1.31' );
+               $defaultPreferences = self::getPreferences( $user, $context );
        }
 
        /**
@@ -1146,12 +187,11 @@ class Preferences {
         * @param IContextSource $context
         * @param array &$defaultPreferences
         */
-       static function searchPreferences( $user, IContextSource $context, &$defaultPreferences ) {
-               foreach ( MWNamespace::getValidNamespaces() as $n ) {
-                       $defaultPreferences['searchNs' . $n] = [
-                               'type' => 'api',
-                       ];
-               }
+       public static function searchPreferences(
+               $user, IContextSource $context, &$defaultPreferences
+       ) {
+               wfDeprecated( __METHOD__, '1.31' );
+               $defaultPreferences = self::getPreferences( $user, $context );
        }
 
        /**
@@ -1160,7 +200,7 @@ class Preferences {
         * @param IContextSource $context
         * @param array &$defaultPreferences
         */
-       static function miscPreferences( $user, IContextSource $context, &$defaultPreferences ) {
+       public static function miscPreferences( $user, IContextSource $context, &$defaultPreferences ) {
        }
 
        /**
@@ -1168,80 +208,9 @@ class Preferences {
         * @param IContextSource $context
         * @return array Text/links to display as key; $skinkey as value
         */
-       static function generateSkinOptions( $user, IContextSource $context ) {
-               $ret = [];
-
-               $mptitle = Title::newMainPage();
-               $previewtext = $context->msg( 'skin-preview' )->escaped();
-
-               $linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer();
-
-               # Only show skins that aren't disabled in $wgSkipSkins
-               $validSkinNames = Skin::getAllowedSkins();
-
-               foreach ( $validSkinNames as $skinkey => &$skinname ) {
-                       $msg = $context->msg( "skinname-{$skinkey}" );
-                       if ( $msg->exists() ) {
-                               $skinname = htmlspecialchars( $msg->text() );
-                       }
-               }
-
-               $config = $context->getConfig();
-               $defaultSkin = $config->get( 'DefaultSkin' );
-               $allowUserCss = $config->get( 'AllowUserCss' );
-               $allowUserJs = $config->get( 'AllowUserJs' );
-
-               # Sort by the internal name, so that the ordering is the same for each display language,
-               # especially if some skin names are translated to use a different alphabet and some are not.
-               uksort( $validSkinNames, function ( $a, $b ) use ( $defaultSkin ) {
-                       # Display the default first in the list by comparing it as lesser than any other.
-                       if ( strcasecmp( $a, $defaultSkin ) === 0 ) {
-                               return -1;
-                       }
-                       if ( strcasecmp( $b, $defaultSkin ) === 0 ) {
-                               return 1;
-                       }
-                       return strcasecmp( $a, $b );
-               } );
-
-               $foundDefault = false;
-               foreach ( $validSkinNames as $skinkey => $sn ) {
-                       $linkTools = [];
-
-                       # Mark the default skin
-                       if ( strcasecmp( $skinkey, $defaultSkin ) === 0 ) {
-                               $linkTools[] = $context->msg( 'default' )->escaped();
-                               $foundDefault = true;
-                       }
-
-                       # Create preview link
-                       $mplink = htmlspecialchars( $mptitle->getLocalURL( [ 'useskin' => $skinkey ] ) );
-                       $linkTools[] = "<a target='_blank' href=\"$mplink\">$previewtext</a>";
-
-                       # Create links to user CSS/JS pages
-                       if ( $allowUserCss ) {
-                               $cssPage = Title::makeTitleSafe( NS_USER, $user->getName() . '/' . $skinkey . '.css' );
-                               $linkTools[] = $linkRenderer->makeLink( $cssPage, $context->msg( 'prefs-custom-css' )->text() );
-                       }
-
-                       if ( $allowUserJs ) {
-                               $jsPage = Title::makeTitleSafe( NS_USER, $user->getName() . '/' . $skinkey . '.js' );
-                               $linkTools[] = $linkRenderer->makeLink( $jsPage, $context->msg( 'prefs-custom-js' )->text() );
-                       }
-
-                       $display = $sn . ' ' . $context->msg( 'parentheses' )
-                               ->rawParams( $context->getLanguage()->pipeList( $linkTools ) )
-                               ->escaped();
-                       $ret[$display] = $skinkey;
-               }
-
-               if ( !$foundDefault ) {
-                       // If the default skin is not available, things are going to break horribly because the
-                       // default value for skin selector will not be a valid value. Let's just not show it then.
-                       return [];
-               }
-
-               return $ret;
+       public static function generateSkinOptions( $user, IContextSource $context ) {
+               wfDeprecated( __METHOD__, '1.31' );
+               return self::getPreferences( $user, $context );
        }
 
        /**
@@ -1249,66 +218,23 @@ class Preferences {
         * @return array
         */
        static function getDateOptions( IContextSource $context ) {
-               $lang = $context->getLanguage();
-               $dateopts = $lang->getDatePreferences();
-
-               $ret = [];
-
-               if ( $dateopts ) {
-                       if ( !in_array( 'default', $dateopts ) ) {
-                               $dateopts[] = 'default'; // Make sure default is always valid T21237
-                       }
-
-                       // FIXME KLUGE: site default might not be valid for user language
-                       global $wgDefaultUserOptions;
-                       if ( !in_array( $wgDefaultUserOptions['date'], $dateopts ) ) {
-                               $wgDefaultUserOptions['date'] = 'default';
-                       }
-
-                       $epoch = wfTimestampNow();
-                       foreach ( $dateopts as $key ) {
-                               if ( $key == 'default' ) {
-                                       $formatted = $context->msg( 'datedefault' )->escaped();
-                               } else {
-                                       $formatted = htmlspecialchars( $lang->timeanddate( $epoch, false, $key ) );
-                               }
-                               $ret[$formatted] = $key;
-                       }
-               }
-               return $ret;
+               throw new Exception( __METHOD__ . '() is deprecated and does nothing' );
        }
 
        /**
         * @param IContextSource $context
         * @return array
         */
-       static function getImageSizes( IContextSource $context ) {
-               $ret = [];
-               $pixels = $context->msg( 'unit-pixel' )->text();
-
-               foreach ( $context->getConfig()->get( 'ImageLimits' ) as $index => $limits ) {
-                       // Note: A left-to-right marker (\u200e) is inserted, see T144386
-                       $display = "{$limits[0]}" . json_decode( '"\u200e"' ) . "×{$limits[1]}" . $pixels;
-                       $ret[$display] = $index;
-               }
-
-               return $ret;
+       public static function getImageSizes( IContextSource $context ) {
+               throw new Exception( __METHOD__ . '() is deprecated and does nothing' );
        }
 
        /**
         * @param IContextSource $context
         * @return array
         */
-       static function getThumbSizes( IContextSource $context ) {
-               $ret = [];
-               $pixels = $context->msg( 'unit-pixel' )->text();
-
-               foreach ( $context->getConfig()->get( 'ThumbLimits' ) as $index => $size ) {
-                       $display = $size . $pixels;
-                       $ret[$display] = $index;
-               }
-
-               return $ret;
+       public static function getThumbSizes( IContextSource $context ) {
+               throw new Exception( __METHOD__ . '() is deprecated and does nothing' );
        }
 
        /**
@@ -1317,24 +243,8 @@ class Preferences {
         * @param HTMLForm $form
         * @return bool|string
         */
-       static function validateSignature( $signature, $alldata, $form ) {
-               global $wgParser;
-               $maxSigChars = $form->getConfig()->get( 'MaxSigChars' );
-               if ( mb_strlen( $signature ) > $maxSigChars ) {
-                       return Xml::element( 'span', [ 'class' => 'error' ],
-                               $form->msg( 'badsiglength' )->numParams( $maxSigChars )->text() );
-               } elseif ( isset( $alldata['fancysig'] ) &&
-                               $alldata['fancysig'] &&
-                               $wgParser->validateSig( $signature ) === false
-               ) {
-                       return Xml::element(
-                               'span',
-                               [ 'class' => 'error' ],
-                               $form->msg( 'badsig' )->text()
-                       );
-               } else {
-                       return true;
-               }
+       public static function validateSignature( $signature, $alldata, $form ) {
+               throw new Exception( __METHOD__ . '() is deprecated and does nothing' );
        }
 
        /**
@@ -1343,16 +253,8 @@ class Preferences {
         * @param HTMLForm $form
         * @return string
         */
-       static function cleanSignature( $signature, $alldata, $form ) {
-               if ( isset( $alldata['fancysig'] ) && $alldata['fancysig'] ) {
-                       global $wgParser;
-                       $signature = $wgParser->cleanSig( $signature );
-               } else {
-                       // When no fancy sig used, make sure ~{3,5} get removed.
-                       $signature = Parser::cleanSigInSig( $signature );
-               }
-
-               return $signature;
+       public static function cleanSignature( $signature, $alldata, $form ) {
+               throw new Exception( __METHOD__ . '() is deprecated and does nothing now' );
        }
 
        /**
@@ -1362,84 +264,22 @@ class Preferences {
         * @param array $remove Array of items to remove
         * @return PreferencesForm|HTMLForm
         */
-       static function getFormObject(
+       public static function getFormObject(
                $user,
                IContextSource $context,
                $formClass = 'PreferencesForm',
                array $remove = []
        ) {
-               $formDescriptor = self::getPreferences( $user, $context );
-               if ( count( $remove ) ) {
-                       $removeKeys = array_flip( $remove );
-                       $formDescriptor = array_diff_key( $formDescriptor, $removeKeys );
-               }
-
-               // Remove type=api preferences. They are not intended for rendering in the form.
-               foreach ( $formDescriptor as $name => $info ) {
-                       if ( isset( $info['type'] ) && $info['type'] === 'api' ) {
-                               unset( $formDescriptor[$name] );
-                       }
-               }
-
-               /**
-                * @var $htmlForm PreferencesForm
-                */
-               $htmlForm = new $formClass( $formDescriptor, $context, 'prefs' );
-
-               $htmlForm->setModifiedUser( $user );
-               $htmlForm->setId( 'mw-prefs-form' );
-               $htmlForm->setAutocomplete( 'off' );
-               $htmlForm->setSubmitText( $context->msg( 'saveprefs' )->text() );
-               # Used message keys: 'accesskey-preferences-save', 'tooltip-preferences-save'
-               $htmlForm->setSubmitTooltip( 'preferences-save' );
-               $htmlForm->setSubmitID( 'prefcontrol' );
-               $htmlForm->setSubmitCallback( [ 'Preferences', 'tryFormSubmit' ] );
-
-               return $htmlForm;
+               $preferencesFactory = self::getDefaultPreferencesFactory();
+               return $preferencesFactory->getForm( $user, $context, $formClass, $remove );
        }
 
        /**
         * @param IContextSource $context
         * @return array
         */
-       static function getTimezoneOptions( IContextSource $context ) {
-               $opt = [];
-
-               $localTZoffset = $context->getConfig()->get( 'LocalTZoffset' );
-               $timeZoneList = self::getTimeZoneList( $context->getLanguage() );
-
-               $timestamp = MWTimestamp::getLocalInstance();
-               // Check that the LocalTZoffset is the same as the local time zone offset
-               if ( $localTZoffset == $timestamp->format( 'Z' ) / 60 ) {
-                       $timezoneName = $timestamp->getTimezone()->getName();
-                       // Localize timezone
-                       if ( isset( $timeZoneList[$timezoneName] ) ) {
-                               $timezoneName = $timeZoneList[$timezoneName]['name'];
-                       }
-                       $server_tz_msg = $context->msg(
-                               'timezoneuseserverdefault',
-                               $timezoneName
-                       )->text();
-               } else {
-                       $tzstring = sprintf(
-                               '%+03d:%02d',
-                               floor( $localTZoffset / 60 ),
-                               abs( $localTZoffset ) % 60
-                       );
-                       $server_tz_msg = $context->msg( 'timezoneuseserverdefault', $tzstring )->text();
-               }
-               $opt[$server_tz_msg] = "System|$localTZoffset";
-               $opt[$context->msg( 'timezoneuseoffset' )->text()] = 'other';
-               $opt[$context->msg( 'guesstimezone' )->text()] = 'guess';
-
-               foreach ( $timeZoneList as $timeZoneInfo ) {
-                       $region = $timeZoneInfo['region'];
-                       if ( !isset( $opt[$region] ) ) {
-                               $opt[$region] = [];
-                       }
-                       $opt[$region][$timeZoneInfo['name']] = $timeZoneInfo['timecorrection'];
-               }
-               return $opt;
+       public static function getTimezoneOptions( IContextSource $context ) {
+               throw new Exception( __METHOD__ . '() is deprecated and does nothing' );
        }
 
        /**
@@ -1447,8 +287,8 @@ class Preferences {
         * @param array $alldata
         * @return int
         */
-       static function filterIntval( $value, $alldata ) {
-               return intval( $value );
+       public static function filterIntval( $value, $alldata ) {
+               throw new Exception( __METHOD__ . '() is deprecated and does nothing' );
        }
 
        /**
@@ -1456,49 +296,8 @@ class Preferences {
         * @param array $alldata
         * @return string
         */
-       static function filterTimezoneInput( $tz, $alldata ) {
-               $data = explode( '|', $tz, 3 );
-               switch ( $data[0] ) {
-                       case 'ZoneInfo':
-                               $valid = false;
-
-                               if ( count( $data ) === 3 ) {
-                                       // Make sure this timezone exists
-                                       try {
-                                               new DateTimeZone( $data[2] );
-                                               // If the constructor didn't throw, we know it's valid
-                                               $valid = true;
-                                       } catch ( Exception $e ) {
-                                               // Not a valid timezone
-                                       }
-                               }
-
-                               if ( !$valid ) {
-                                       // If the supplied timezone doesn't exist, fall back to the encoded offset
-                                       return 'Offset|' . intval( $tz[1] );
-                               }
-                               return $tz;
-                       case 'System':
-                               return $tz;
-                       default:
-                               $data = explode( ':', $tz, 2 );
-                               if ( count( $data ) == 2 ) {
-                                       $data[0] = intval( $data[0] );
-                                       $data[1] = intval( $data[1] );
-                                       $minDiff = abs( $data[0] ) * 60 + $data[1];
-                                       if ( $data[0] < 0 ) {
-                                               $minDiff = - $minDiff;
-                                       }
-                               } else {
-                                       $minDiff = intval( $data[0] ) * 60;
-                               }
-
-                               # Max is +14:00 and min is -12:00, see:
-                               # https://en.wikipedia.org/wiki/Timezone
-                               $minDiff = min( $minDiff, 840 );  # 14:00
-                               $minDiff = max( $minDiff, -720 ); # -12:00
-                               return 'Offset|' . $minDiff;
-               }
+       public static function filterTimezoneInput( $tz, $alldata ) {
+               throw new Exception( __METHOD__ . '() is deprecated and does nothing' );
        }
 
        /**
@@ -1508,104 +307,18 @@ class Preferences {
         * @param PreferencesForm $form
         * @return bool|Status|string
         */
-       static function tryFormSubmit( $formData, $form ) {
-               $user = $form->getModifiedUser();
-               $hiddenPrefs = $form->getConfig()->get( 'HiddenPrefs' );
-               $result = true;
-
-               if ( !$user->isAllowedAny( 'editmyprivateinfo', 'editmyoptions' ) ) {
-                       return Status::newFatal( 'mypreferencesprotected' );
-               }
-
-               // Filter input
-               foreach ( array_keys( $formData ) as $name ) {
-                       if ( isset( self::$saveFilters[$name] ) ) {
-                               $formData[$name] =
-                                       call_user_func( self::$saveFilters[$name], $formData[$name], $formData );
-                       }
-               }
-
-               // Fortunately, the realname field is MUCH simpler
-               // (not really "private", but still shouldn't be edited without permission)
-
-               if ( !in_array( 'realname', $hiddenPrefs )
-                       && $user->isAllowed( 'editmyprivateinfo' )
-                       && array_key_exists( 'realname', $formData )
-               ) {
-                       $realName = $formData['realname'];
-                       $user->setRealName( $realName );
-               }
-
-               if ( $user->isAllowed( 'editmyoptions' ) ) {
-                       $oldUserOptions = $user->getOptions();
-
-                       foreach ( self::$saveBlacklist as $b ) {
-                               unset( $formData[$b] );
-                       }
-
-                       # If users have saved a value for a preference which has subsequently been disabled
-                       # via $wgHiddenPrefs, we don't want to destroy that setting in case the preference
-                       # is subsequently re-enabled
-                       foreach ( $hiddenPrefs as $pref ) {
-                               # If the user has not set a non-default value here, the default will be returned
-                               # and subsequently discarded
-                               $formData[$pref] = $user->getOption( $pref, null, true );
-                       }
-
-                       // If the user changed the rclimit preference, also change the rcfilters-rclimit preference
-                       if (
-                               isset( $formData['rclimit'] ) &&
-                               intval( $formData[ 'rclimit' ] ) !== $user->getIntOption( 'rclimit' )
-                       ) {
-                               $formData['rcfilters-limit'] = $formData['rclimit'];
-                       }
-
-                       // Keep old preferences from interfering due to back-compat code, etc.
-                       $user->resetOptions( 'unused', $form->getContext() );
-
-                       foreach ( $formData as $key => $value ) {
-                               $user->setOption( $key, $value );
-                       }
-
-                       Hooks::run(
-                               'PreferencesFormPreSave',
-                               [ $formData, $form, $user, &$result, $oldUserOptions ]
-                       );
-               }
-
-               MediaWiki\Auth\AuthManager::callLegacyAuthPlugin( 'updateExternalDB', [ $user ] );
-               $user->saveSettings();
-
-               return $result;
+       public static function tryFormSubmit( $formData, $form ) {
+               $preferencesFactory = self::getDefaultPreferencesFactory();
+               return $preferencesFactory->legacySaveFormData( $formData, $form );
        }
 
        /**
         * @param array $formData
         * @param PreferencesForm $form
-        * @return Status
         */
        public static function tryUISubmit( $formData, $form ) {
-               $res = self::tryFormSubmit( $formData, $form );
-
-               if ( $res ) {
-                       $urlOptions = [];
-
-                       if ( $res === 'eauth' ) {
-                               $urlOptions['eauth'] = 1;
-                       }
-
-                       $urlOptions += $form->getExtraSuccessRedirectParameters();
-
-                       $url = $form->getTitle()->getFullURL( $urlOptions );
-
-                       $context = $form->getContext();
-                       // Set session data for the success message
-                       $context->getRequest()->getSession()->set( 'specialPreferencesSaveSuccess', 1 );
-
-                       $context->getOutput()->redirect( $url );
-               }
-
-               return Status::newGood();
+               $preferencesFactory = self::getDefaultPreferencesFactory();
+               return $preferencesFactory->legacySubmitForm( $formData, $form );
        }
 
        /**
@@ -1617,56 +330,6 @@ class Preferences {
         * @since 1.26
         */
        public static function getTimeZoneList( Language $language ) {
-               $identifiers = DateTimeZone::listIdentifiers();
-               if ( $identifiers === false ) {
-                       return [];
-               }
-               sort( $identifiers );
-
-               $tzRegions = [
-                       'Africa' => wfMessage( 'timezoneregion-africa' )->inLanguage( $language )->text(),
-                       'America' => wfMessage( 'timezoneregion-america' )->inLanguage( $language )->text(),
-                       'Antarctica' => wfMessage( 'timezoneregion-antarctica' )->inLanguage( $language )->text(),
-                       'Arctic' => wfMessage( 'timezoneregion-arctic' )->inLanguage( $language )->text(),
-                       'Asia' => wfMessage( 'timezoneregion-asia' )->inLanguage( $language )->text(),
-                       'Atlantic' => wfMessage( 'timezoneregion-atlantic' )->inLanguage( $language )->text(),
-                       'Australia' => wfMessage( 'timezoneregion-australia' )->inLanguage( $language )->text(),
-                       'Europe' => wfMessage( 'timezoneregion-europe' )->inLanguage( $language )->text(),
-                       'Indian' => wfMessage( 'timezoneregion-indian' )->inLanguage( $language )->text(),
-                       'Pacific' => wfMessage( 'timezoneregion-pacific' )->inLanguage( $language )->text(),
-               ];
-               asort( $tzRegions );
-
-               $timeZoneList = [];
-
-               $now = new DateTime();
-
-               foreach ( $identifiers as $identifier ) {
-                       $parts = explode( '/', $identifier, 2 );
-
-                       // DateTimeZone::listIdentifiers() returns a number of
-                       // backwards-compatibility entries. This filters them out of the
-                       // list presented to the user.
-                       if ( count( $parts ) !== 2 || !array_key_exists( $parts[0], $tzRegions ) ) {
-                               continue;
-                       }
-
-                       // Localize region
-                       $parts[0] = $tzRegions[$parts[0]];
-
-                       $dateTimeZone = new DateTimeZone( $identifier );
-                       $minDiff = floor( $dateTimeZone->getOffset( $now ) / 60 );
-
-                       $display = str_replace( '_', ' ', $parts[0] . '/' . $parts[1] );
-                       $value = "ZoneInfo|$minDiff|$identifier";
-
-                       $timeZoneList[$identifier] = [
-                               'name' => $display,
-                               'timecorrection' => $value,
-                               'region' => $parts[0],
-                       ];
-               }
-
-               return $timeZoneList;
+               throw new Exception( __METHOD__ . '() is deprecated and does nothing' );
        }
 }
index f3307c6..54c6de0 100644 (file)
@@ -65,10 +65,14 @@ class Revision implements IDBAccessObject {
        }
 
        /**
+        * @param bool|string $wikiId The ID of the target wiki database. Use false for the local wiki.
+        *
         * @return SqlBlobStore
         */
-       protected static function getBlobStore() {
-               $store = MediaWikiServices::getInstance()->getBlobStore();
+       protected static function getBlobStore( $wiki = false ) {
+               $store = MediaWikiServices::getInstance()
+                       ->getBlobStoreFactory()
+                       ->newSqlBlobStore( $wiki );
 
                if ( !$store instanceof SqlBlobStore ) {
                        throw new RuntimeException(
@@ -90,12 +94,11 @@ class Revision implements IDBAccessObject {
         *
         * @param int $id
         * @param int $flags (optional)
-        * @param Title $title (optional)
         * @return Revision|null
         */
-       public static function newFromId( $id, $flags = 0, Title $title = null ) {
-               $rec = self::getRevisionStore()->getRevisionById( $id, $flags, $title );
-               return $rec === null ? null : new Revision( $rec, $flags, $title );
+       public static function newFromId( $id, $flags = 0 ) {
+               $rec = self::getRevisionStore()->getRevisionById( $id, $flags );
+               return $rec === null ? null : new Revision( $rec, $flags );
        }
 
        /**
@@ -142,12 +145,45 @@ class Revision implements IDBAccessObject {
         *
         * @param object $row
         * @param array $overrides
-        * @param Title $title (optional)
         *
         * @throws MWException
         * @return Revision
         */
-       public static function newFromArchiveRow( $row, $overrides = [], Title $title = null ) {
+       public static function newFromArchiveRow( $row, $overrides = [] ) {
+               /**
+                * MCR Migration: https://phabricator.wikimedia.org/T183564
+                * This method used to overwrite attributes, then passed to Revision::__construct
+                * RevisionStore::newRevisionFromArchiveRow instead overrides row field names
+                * So do a conversion here.
+                */
+               if ( array_key_exists( 'page', $overrides ) ) {
+                       $overrides['page_id'] = $overrides['page'];
+                       unset( $overrides['page'] );
+               }
+
+               /**
+                * We require a Title for both the Revision object and the RevisionRecord.
+                * Below is duplicated logic from RevisionStore::newRevisionFromArchiveRow
+                * to fetch a title in order pass it into the Revision object.
+                */
+               $title = null;
+               if ( isset( $overrides['title'] ) ) {
+                       if ( !( $overrides['title'] instanceof Title ) ) {
+                               throw new MWException( 'title field override must contain a Title object.' );
+                       }
+
+                       $title = $overrides['title'];
+               }
+               if ( $title !== null ) {
+                       if ( isset( $row->ar_namespace ) && isset( $row->ar_title ) ) {
+                               $title = Title::makeTitle( $row->ar_namespace, $row->ar_title );
+                       } else {
+                               throw new InvalidArgumentException(
+                                       'A Title or ar_namespace and ar_title must be given'
+                               );
+                       }
+               }
+
                $rec = self::getRevisionStore()->newRevisionFromArchiveRow( $row, 0, $title, $overrides );
                return new Revision( $rec, self::READ_NORMAL, $title );
        }
@@ -881,10 +917,8 @@ class Revision implements IDBAccessObject {
         * @return Revision|null
         */
        public function getPrevious() {
-               $rec = self::getRevisionStore()->getPreviousRevision( $this->mRecord, $this->getTitle() );
-               return $rec === null
-                       ? null
-                       : new Revision( $rec, self::READ_NORMAL, $this->getTitle() );
+               $rec = self::getRevisionStore()->getPreviousRevision( $this->mRecord );
+               return $rec === null ? null : new Revision( $rec );
        }
 
        /**
@@ -893,10 +927,8 @@ class Revision implements IDBAccessObject {
         * @return Revision|null
         */
        public function getNext() {
-               $rec = self::getRevisionStore()->getNextRevision( $this->mRecord, $this->getTitle() );
-               return $rec === null
-                       ? null
-                       : new Revision( $rec, self::READ_NORMAL, $this->getTitle() );
+               $rec = self::getRevisionStore()->getNextRevision( $this->mRecord );
+               return $rec === null ? null : new Revision( $rec );
        }
 
        /**
@@ -931,7 +963,7 @@ class Revision implements IDBAccessObject {
 
                $cacheKey = isset( $row->old_id ) ? ( 'tt:' . $row->old_id ) : null;
 
-               return self::getBlobStore()->expandBlob( $text, $flags, $cacheKey );
+               return self::getBlobStore( $wiki )->expandBlob( $text, $flags, $cacheKey );
        }
 
        /**
@@ -1147,6 +1179,10 @@ class Revision implements IDBAccessObject {
                        ? $pageIdOrTitle
                        : Title::newFromID( $pageIdOrTitle );
 
+               if ( !$title ) {
+                       return false;
+               }
+
                $record = self::getRevisionStore()->getKnownCurrentRevision( $title, $revId );
                return $record ? new Revision( $record ) : false;
        }
index 575970d..246b838 100644 (file)
  *      MediaWiki code base.
  */
 
+use MediaWiki\Auth\AuthManager;
 use MediaWiki\Interwiki\ClassicInterwikiLookup;
 use MediaWiki\Linker\LinkRendererFactory;
 use MediaWiki\Logger\LoggerFactory;
 use MediaWiki\MediaWikiServices;
+use MediaWiki\Preferences\DefaultPreferencesFactory;
 use MediaWiki\Shell\CommandFactory;
+use MediaWiki\Storage\BlobStoreFactory;
 use MediaWiki\Storage\RevisionStore;
 use MediaWiki\Storage\SqlBlobStore;
 
@@ -450,46 +453,6 @@ return [
                return $factory;
        },
 
-       'RevisionStore' => function ( MediaWikiServices $services ) {
-               /** @var SqlBlobStore $blobStore */
-               $blobStore = $services->getService( '_SqlBlobStore' );
-
-               $store = new RevisionStore(
-                       $services->getDBLoadBalancer(),
-                       $blobStore,
-                       $services->getMainWANObjectCache()
-               );
-
-               $config = $services->getMainConfig();
-               $store->setContentHandlerUseDB( $config->get( 'ContentHandlerUseDB' ) );
-
-               return $store;
-       },
-
-       'BlobStore' => function ( MediaWikiServices $services ) {
-               return $services->getService( '_SqlBlobStore' );
-       },
-
-       '_SqlBlobStore' => function ( MediaWikiServices $services ) {
-               global $wgContLang; // TODO: manage $wgContLang as a service
-
-               $store = new SqlBlobStore(
-                       $services->getDBLoadBalancer(),
-                       $services->getMainWANObjectCache()
-               );
-
-               $config = $services->getMainConfig();
-               $store->setCompressRevisions( $config->get( 'CompressRevisions' ) );
-               $store->setCacheExpiry( $config->get( 'RevisionCacheExpiry' ) );
-               $store->setUseExternalStore( $config->get( 'DefaultExternalStore' ) !== false );
-
-               if ( $config->get( 'LegacyEncoding' ) ) {
-                       $store->setLegacyEncoding( $config->get( 'LegacyEncoding' ), $wgContLang );
-               }
-
-               return $store;
-       },
-
        'ExternalStoreFactory' => function ( MediaWikiServices $services ) {
                $config = $services->getMainConfig();
 
@@ -514,28 +477,30 @@ return [
                return $store;
        },
 
+       'BlobStoreFactory' => function ( MediaWikiServices $services ) {
+               global $wgContLang;
+               return new BlobStoreFactory(
+                       $services->getDBLoadBalancer(),
+                       $services->getMainWANObjectCache(),
+                       $services->getMainConfig(),
+                       $wgContLang
+               );
+       },
+
        'BlobStore' => function ( MediaWikiServices $services ) {
                return $services->getService( '_SqlBlobStore' );
        },
 
        '_SqlBlobStore' => function ( MediaWikiServices $services ) {
-               global $wgContLang; // TODO: manage $wgContLang as a service
-
-               $store = new SqlBlobStore(
-                       $services->getDBLoadBalancer(),
-                       $services->getMainWANObjectCache()
-               );
+               return $services->getBlobStoreFactory()->newSqlBlobStore();
+       },
 
+       'PreferencesFactory' => function ( MediaWikiServices $services ) {
+               global $wgContLang;
+               $authManager = AuthManager::singleton();
+               $linkRenderer = $services->getLinkRendererFactory()->create();
                $config = $services->getMainConfig();
-               $store->setCompressBlobs( $config->get( 'CompressRevisions' ) );
-               $store->setCacheExpiry( $config->get( 'RevisionCacheExpiry' ) );
-               $store->setUseExternalStore( $config->get( 'DefaultExternalStore' ) !== false );
-
-               if ( $config->get( 'LegacyEncoding' ) ) {
-                       $store->setLegacyEncoding( $config->get( 'LegacyEncoding' ), $wgContLang );
-               }
-
-               return $store;
+               return new DefaultPreferencesFactory( $config, $wgContLang, $authManager, $linkRenderer );
        },
 
        ///////////////////////////////////////////////////////////////////////////
index d6f4b2f..4936b0b 100644 (file)
@@ -370,9 +370,8 @@ if ( $wgRCFilterByAge ) {
        // Note that we allow 1 link higher than the max for things like 56 days but a 60 day link.
        sort( $wgRCLinkDays );
 
-       // @codingStandardsIgnoreStart Generic.CodeAnalysis.ForLoopWithTestFunctionCall.NotAllowed
+       // phpcs:ignore Generic.CodeAnalysis.ForLoopWithTestFunctionCall
        for ( $i = 0; $i < count( $wgRCLinkDays ); $i++ ) {
-               // @codingStandardsIgnoreEnd
                if ( $wgRCLinkDays[$i] >= $rcMaxAgeDays ) {
                        $wgRCLinkDays = array_slice( $wgRCLinkDays, 0, $i + 1, false );
                        break;
diff --git a/includes/Storage/BlobStoreFactory.php b/includes/Storage/BlobStoreFactory.php
new file mode 100644 (file)
index 0000000..63ca74d
--- /dev/null
@@ -0,0 +1,105 @@
+<?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
+ */
+
+namespace MediaWiki\Storage;
+
+use Config;
+use Language;
+use WANObjectCache;
+use Wikimedia\Rdbms\LoadBalancer;
+
+/**
+ * Service for instantiating BlobStores
+ *
+ * This can be used to create BlobStore objects for other wikis.
+ *
+ * @since 1.31
+ */
+class BlobStoreFactory {
+
+       /**
+        * @var LoadBalancer
+        */
+       private $loadBalancer;
+
+       /**
+        * @var WANObjectCache
+        */
+       private $cache;
+
+       /**
+        * @var Config
+        */
+       private $config;
+
+       /**
+        * @var Language
+        */
+       private $contLang;
+
+       public function __construct(
+               LoadBalancer $loadBalancer,
+               WANObjectCache $cache,
+               Config $mainConfig,
+               Language $contLang
+       ) {
+               $this->loadBalancer = $loadBalancer;
+               $this->cache = $cache;
+               $this->config = $mainConfig;
+               $this->contLang = $contLang;
+       }
+
+       /**
+        * @since 1.31
+        *
+        * @param bool|string $wikiId The ID of the target wiki database. Use false for the local wiki.
+        *
+        * @return BlobStore
+        */
+       public function newBlobStore( $wikiId = false ) {
+               return $this->newSqlBlobStore( $wikiId );
+       }
+
+       /**
+        * @internal Please call newBlobStore and use the BlobStore interface.
+        *
+        * @param bool|string $wikiId The ID of the target wiki database. Use false for the local wiki.
+        *
+        * @return SqlBlobStore
+        */
+       public function newSqlBlobStore( $wikiId = false ) {
+               $store = new SqlBlobStore(
+                       $this->loadBalancer,
+                       $this->cache,
+                       $wikiId
+               );
+
+               $store->setCompressBlobs( $this->config->get( 'CompressRevisions' ) );
+               $store->setCacheExpiry( $this->config->get( 'RevisionCacheExpiry' ) );
+               $store->setUseExternalStore( $this->config->get( 'DefaultExternalStore' ) !== false );
+
+               if ( $this->config->get( 'LegacyEncoding' ) ) {
+                       $store->setLegacyEncoding( $this->config->get( 'LegacyEncoding' ), $this->contLang );
+               }
+
+               return $store;
+       }
+
+}
index 5cd157b..afe0f81 100644 (file)
@@ -22,7 +22,7 @@
 
 namespace MediaWiki\Storage;
 
-use \IDBAccessObject;
+use IDBAccessObject;
 use MediaWiki\Linker\LinkTarget;
 use Title;
 
index 44dab13..2e953fc 100644 (file)
@@ -32,7 +32,7 @@ use Content;
 use ContentHandler;
 use DBAccessObjectUtils;
 use Hooks;
-use \IDBAccessObject;
+use IDBAccessObject;
 use InvalidArgumentException;
 use IP;
 use LogicException;
@@ -848,11 +848,10 @@ class RevisionStore implements IDBAccessObject, RevisionFactory, RevisionLookup
         *
         * @param int $id
         * @param int $flags (optional)
-        * @param Title $title (optional)
         * @return RevisionRecord|null
         */
-       public function getRevisionById( $id, $flags = 0, Title $title = null ) {
-               return $this->newRevisionFromConds( [ 'rev_id' => intval( $id ) ], $flags, $title );
+       public function getRevisionById( $id, $flags = 0 ) {
+               return $this->newRevisionFromConds( [ 'rev_id' => intval( $id ) ], $flags );
        }
 
        /**
@@ -1076,7 +1075,7 @@ class RevisionStore implements IDBAccessObject, RevisionFactory, RevisionLookup
                        $pageId = isset( $row->rev_page ) ? $row->rev_page : 0; // XXX: also check page_id?
                        $revId = isset( $row->rev_id ) ? $row->rev_id : 0;
 
-                       $title = $this->getTitle( $pageId, $revId );
+                       $title = $this->getTitle( $pageId, $revId, $queryFlags );
                }
 
                if ( !isset( $row->page_latest ) ) {
@@ -1144,7 +1143,7 @@ class RevisionStore implements IDBAccessObject, RevisionFactory, RevisionLookup
                        $pageId = isset( $fields['page'] ) ? $fields['page'] : 0;
                        $revId = isset( $fields['id'] ) ? $fields['id'] : 0;
 
-                       $title = $this->getTitle( $pageId, $revId );
+                       $title = $this->getTitle( $pageId, $revId, $queryFlags );
                }
 
                if ( !isset( $fields['page'] ) ) {
@@ -1477,10 +1476,20 @@ class RevisionStore implements IDBAccessObject, RevisionFactory, RevisionLookup
                $storeWiki = $storeWiki ?: wfWikiID();
                $dbWiki = $dbWiki ?: wfWikiID();
 
-               if ( $dbWiki !== $storeWiki ) {
-                       throw new MWException( "RevisionStore for $storeWiki "
-                               . "cannot be used with a DB connection for $dbWiki" );
+               if ( $dbWiki === $storeWiki ) {
+                       return;
                }
+
+               // HACK: counteract encoding imposed by DatabaseDomain
+               $storeWiki = str_replace( '?h', '-', $storeWiki );
+               $dbWiki = str_replace( '?h', '-', $dbWiki );
+
+               if ( $dbWiki === $storeWiki ) {
+                       return;
+               }
+
+               throw new MWException( "RevisionStore for $storeWiki "
+                       . "cannot be used with a DB connection for $dbWiki" );
        }
 
        /**
@@ -1679,14 +1688,11 @@ class RevisionStore implements IDBAccessObject, RevisionFactory, RevisionLookup
         * MCR migration note: this replaces Revision::getPrevious
         *
         * @param RevisionRecord $rev
-        * @param Title $title if known (optional)
         *
         * @return RevisionRecord|null
         */
-       public function getPreviousRevision( RevisionRecord $rev, Title $title = null ) {
-               if ( $title === null ) {
-                       $title = $this->getTitle( $rev->getPageId(), $rev->getId() );
-               }
+       public function getPreviousRevision( RevisionRecord $rev ) {
+               $title = $this->getTitle( $rev->getPageId(), $rev->getId() );
                $prev = $title->getPreviousRevisionID( $rev->getId() );
                if ( $prev ) {
                        return $this->getRevisionByTitle( $title, $prev );
@@ -1700,14 +1706,10 @@ class RevisionStore implements IDBAccessObject, RevisionFactory, RevisionLookup
         * MCR migration note: this replaces Revision::getNext
         *
         * @param RevisionRecord $rev
-        * @param Title $title if known (optional)
         *
         * @return RevisionRecord|null
         */
-       public function getNextRevision( RevisionRecord $rev, Title $title = null ) {
-               if ( $title === null ) {
-                       $title = $this->getTitle( $rev->getPageId(), $rev->getId() );
-               }
+       public function getNextRevision( RevisionRecord $rev ) {
                $title = $this->getTitle( $rev->getPageId(), $rev->getId() );
                $next = $title->getNextRevisionID( $rev->getId() );
                if ( $next ) {
index 50ae8d5..341855d 100644 (file)
@@ -97,7 +97,8 @@ class RevisionStoreRecord extends RevisionRecord {
                        && $this->mPageId !== $this->mTitle->getArticleID()
                ) {
                        throw new InvalidArgumentException(
-                               'The given Title does not belong to page ID ' . $this->mPageId
+                               'The given Title does not belong to page ID ' . $this->mPageId .
+                               ' but actually belongs to ' . $this->mTitle->getArticleID()
                        );
                }
        }
index fcdc1b9..69e1539 100644 (file)
@@ -382,7 +382,7 @@ class SqlBlobStore implements IDBAccessObject, BlobStore {
                                return false;
                        }
 
-                       if ( $cacheKey ) {
+                       if ( $cacheKey && $this->wikiId === false ) {
                                // Make use of the wiki-local revision text cache.
                                // The cached value should be decompressed, so handle that and return here.
                                // NOTE: we rely on $this->cache being the right cache for $this->wikiId!
index b23bd5a..3de85e1 100644 (file)
@@ -4644,7 +4644,7 @@ class Title implements LinkTarget {
        /**
         * Get the last touched timestamp
         *
-        * @param IDatabase $db Optional db
+        * @param IDatabase|null $db
         * @return string|false Last-touched timestamp
         */
        public function getTouched( $db = null ) {
index 62f7ddf..a8a8317 100644 (file)
@@ -437,6 +437,18 @@ class InfoAction extends FormlessAction {
                        ];
                }
 
+               // Display image SHA-1 value
+               if ( $title->inNamespace( NS_FILE ) ) {
+                       $fileObj = wfFindFile( $title );
+                       if ( $fileObj !== false ) {
+                               $output = $fileObj->getSha1();
+                               $pageInfo['header-basic'][] = [
+                                       $this->msg( 'pageinfo-file-hash' ),
+                                       $output
+                               ];
+                       }
+               }
+
                // Page protection
                $pageInfo['header-restrictions'] = [];
 
index e12a727..528e0e2 100644 (file)
@@ -80,8 +80,6 @@ class WatchAction extends FormAction {
                $this->getOutput()->addWikiMsg( $msgKey, $this->getTitle()->getPrefixedText() );
        }
 
-       /* Static utility methods */
-
        /**
         * Watch or unwatch a page
         * @since 1.22