From: jenkins-bot Date: Thu, 28 Jun 2018 16:45:22 +0000 (+0000) Subject: Merge "Fix 'Tags' padding to keep it farther from the edge and document the source... X-Git-Tag: 1.34.0-rc.0~4931 X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=commitdiff_plain;h=138298b397b308ad6e4bfc7088884d90e8ac1e37;hp=2ab15ab41f9efa0a043751915737f0007a2ec63d Merge "Fix 'Tags' padding to keep it farther from the edge and document the source of the new right padding value" --- diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000000..92318180cd --- /dev/null +++ b/.editorconfig @@ -0,0 +1,11 @@ +root = true + +[*] +indent_style = tab +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +[*.md] +trim_trailing_whitespace = false diff --git a/.phpcs.xml b/.phpcs.xml index 62fa85377b..e15eca089e 100644 --- a/.phpcs.xml +++ b/.phpcs.xml @@ -7,7 +7,9 @@ + + @@ -61,7 +63,7 @@ - + @@ -72,8 +74,6 @@ Whitelist existing violations, but enable the sniff to prevent any new occurrences. --> - */includes/api/ApiMessage\.php - */includes/api/ApiUsageException\.php */includes/media/XCF\.php */includes/Feed\.php */includes/libs/xmp/XMP\.php @@ -84,6 +84,7 @@ */includes/specials/SpecialMostinterwikis\.php */includes/cache/CacheDependency\.php */includes/cache/CacheHelper\.php + */includes/compat/XMPReader\.php */includes/diff/DairikiDiff\.php */includes/specials/SpecialAncientpages\.php */includes/specials/SpecialBrokenRedirects\.php @@ -155,6 +156,7 @@ */maintenance/language/date-formats\.php */maintenance/language/languages.inc */maintenance/minify\.php + */maintenance/mysql\.php */maintenance/parse\.php */maintenance/preprocessorFuzzTest\.php */maintenance/rebuildImages\.php @@ -223,6 +225,7 @@ */includes/AuthPlugin\.php */includes/cache/CacheDependency\.php */includes/cache/CacheHelper\.php + */includes/compat/XMPReader\.php */includes/deferred/CdnCacheUpdate\.php */includes/diff/DairikiDiff\.php */includes/diff/DiffEngine\.php @@ -283,6 +286,62 @@ */tests/phpunit/*\.php + + + */includes/libs/filebackend/FSFileBackend\.php + */includes/shell/Command\.php + */includes/shell/Shell\.php + */tests/phpunit/structure/StructureTest\.php + + + + */tests/phpunit/structure/StructureTest\.php + + + + */includes/GlobalFunctions\.php + */includes/libs/filebackend/FSFileBackend\.php + */maintenance/7zip\.inc + */maintenance/populateImageSha1\.php + + + + includes/export/DumpPipeOutput\.php + includes/resourceloader/ResourceLoaderImage\.php + includes/shell/Command\.php + includes/tidy/RaggettExternal\.php + maintenance/dumpTextPass\.php + maintenance/mysql\.php + maintenance/storage/recompressTracked\.php + tests/parser/editTests\.php + + + + */maintenance/mwdocgen\.php + */maintenance/updateCredits\.php + + + + */maintenance/mwdocgen\.php + . diff --git a/.travis.yml b/.travis.yml index 73e4af5438..e15fc55426 100644 --- a/.travis.yml +++ b/.travis.yml @@ -37,6 +37,9 @@ matrix: php: hhvm-3.21 - env: dbtype=mysql dbuser=root php: hhvm-3.18 + allow_failures: + - php: hhvm-3.24 + - php: hhvm-3.21 services: - mysql diff --git a/Gruntfile.js b/Gruntfile.js index 8018212e85..6be908e087 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -33,9 +33,7 @@ module.exports = function ( grunt ) { '!vendor/**', // Explicitly say "**/*.js" here in case of symlinks '!extensions/**/*.js', - '!skins/**/*.js', - // Skip functions aren't even parseable - '!resources/src/mediawiki.hidpi/skip.js' + '!skins/**/*.js' ] }, jsonlint: { diff --git a/HISTORY b/HISTORY index 0693b21c5d..7540af3bca 100644 --- a/HISTORY +++ b/HISTORY @@ -1,4 +1,490 @@ -Change notes from older releases. For current info see RELEASE-NOTES-1.31. +Change notes from older releases. For current info see RELEASE-NOTES-1.32. + += MediaWiki 1.31 = + +== MediaWiki 1.31.0 == + +=== Changes since MediaWiki 1.31.0-rc.2 === +* (T195783) Initialize PSR-4 namespaces at same stage as normal autoloader. +* (T196092) Hide MySQL binary/utf-8 charset option in the installer. +* (T196185) Don't allow setting $wgDBmysql5 in the installer. +* (T196125) php-memcached 3.0 (provided with PHP 7.0) is now supported. +* (T182366) UploadBase::checkXMLEncodingMissmatch() now works on PHP 7.1+ +* (T118683) Fix exception from &$user deref on HHVM in the TitleMoveComplete hook. +* (T196672) The mtime of extension.json files is now able to be zero +* (T180403) Validate $length in padleft/padright parser functions. +* (T143790) Make $wgEmailConfirmToEdit only affect edit actions. + +=== Changes since MediaWiki 1.31.0-rc.0 === +* (T33223) Drop archive.ar_text and ar_flags. +* Add default edit rate limit of 90 edits/minute for all users. +* (T187645) Use codepoint as tiebreaker when getting first-letters in + IcuCollation. +* (T191947) Don't shell during the installer if shelling out is disabled. +* (T194319) Improve duplicate config setting exception as part of extension + registration. +* (T195211) Don't require trailing slash in PSR-4 autoloader directory. +* (T186565) Fix PHP Notice from `ob_end_flush()` in `FileRepo::streamFile()`. +* Do not incorrectly hide namespace input field in the installer. +* (T186456) Refactor checks looking for PEAR maik libraries to be clearer. + +=== Important pre-upgrade notes for 1.31 === +* If you're using MySQL, SQLite, or MSSQL, are not using update.php to apply + schema changes, and cannot have downtime to run migrateArchiveText.php and + apply patch-drop-ar_text.sql manually, you'll have to apply a default value + to the ar_text and ar_flags columns of the archive table or make those + columns nullable before upgrading to MediaWiki 1.31. + maintenance/archives/patch-nullable-ar_text.sql shows how to do this for MySQL. + +=== Configuration changes in 1.31 === +* $wgEnableAPI and $wgEnableWriteAPI are now deprecated and will be removed in + a future version. The API is now considered to be stable, secure and + essential. +* $wgUsejQueryThree was removed, as it is now the default. This was documented + as a temporary variable during the migration period, deprecated since 1.29. +* $wgLogoHD has been updated to support svg images and uses $wgLogo where + possible for fallback images such as png. +* (T44246) $wgFilterLogTypes will no longer ignore 'patrol' when user does not + have the right to mark things patrolled. +* Wikis that contain imported revisions or CentralAuth global blocks should run + maintenance/cleanupUsersWithNoId.php. +* The configuration settings $wgResourceLoaderMinifierStatementsOnOwnLine and + $wgResourceLoaderMinifierMaxLineLength, deprecated since 1.27, were removed. +* (T180921) $wgReferrerPolicy now supports having fallbacks for browsers that + are not using the latest version of the Referrer Policy specification. +* $wgFragmentMode is now set to [ 'legacy', 'html5' ] by default. This is a + first step of migration to human-readable section IDs that will later result + in 'html5' being the default mode. +* CACHE_ACCEL now only supports APC(u) or WinCache. XCache support was removed + as upstream is inactive and has no plans to move to PHP 7. +* The old CategorizedRecentChanges feature, including its related configuration + option $wgAllowCategorizedRecentChanges, has been removed. +* (T188472) The 'comma' value for $wgArticleCountMethod is no longer supported + for performance reasons, and installations with this setting will now work as + if it was configured with 'any'. +* (T185753) MediaWiki now defaults to using RemexHtml to tidy up user input, + rather than being off by default. If you wish to disable HTML tidying + entirely, set $wgTidyConfig to null; if you wish to use the old, deprecated + Tidy external binary, both set $wgTidyConfig to null and $wgUseTidy to true. +* $wgLogAutopatrol now defaults to false instead of true. +* $wgValidateAllHtml was removed and will be ignored. +* $wgScriptExtension, deprecated and ignored since 1.25, was removed. See the + 1.25 release notes for more information. +* $wgUseAjax is now marked as deprecated, just like the deprecated AJAX + framework that it enables. Some extensions mistakenly used this to check + whether any AJAX functionality at all should be enabled, further making this + problematic to retain. +* $wgDBmysql5 is now deprecated, and will be removed in a future version. It + has been marked as experimental ever since it was introduced. + +=== New features in 1.31 === +* (T76554) User sub-pages named ….json are now protected in the same way that + ….js and ….css pages are, so that configuration options can safely be placed + there. +* Wikimedia\Rdbms\IDatabase->select() and similar methods now support joins + with parentheses for grouping. +* As a first pass in standardizing dialog boxes across the MediaWiki product, + Html class now provides helper methods for messageBox, successBox, errorBox + and warningBox generation. +* (T9240) Imports will now record unknown (and, optionally, known) usernames in + a format like "iw>Example". +* (T20209) Linker (used on history pages, log pages, and so on) will display + usernames formed like "iw>Example" as interwiki links, as if by wikitext like + [[iw:User:Example|iw>Example]]. +* (T111605) The 'ImportHandleUnknownUser' hook allows extensions to auto-create + users during an import. +* Added a hook, ParserOutputPostCacheTransform, to allow extensions to affect + the ParserOutput::getText() post-cache transformations. +* Added a hook, UploadForm:getInitialPageText, to allow extensions to alter the + initial page text for file uploads. +* (T181651) The info page for File pages now displays the file's base-16 SHA1 + hash value in the table of basic information. +* Style tags with a 'data-mw-deduplicate' attribute will be deduplicated as a + ParserOutput::getText() post-cache transformation. This may be disabled by + passing 'deduplicateStyles' => false to that method. +* The identity of the logged-in or IP "actor" for logged actions is being moved + into a new actor table, with the rows in tables such as revision and logging + referring to the actor ID instead of storing the user ID and name/IP in + every row. + * This is currently gated by $wgActorTableSchemaMigrationStage. Most wikis + can set this to MIGRATION_NEW and run maintenance/migrateActors.php as + soon as any necessary extensions are updated. + * Most code accessing rows for logged actions from the database should use + the relevant getQueryInfo() methods to get the information needed to build + the SQL query. The ActorMigration class may also be used to get feature + -flagged information needed to access actor-related fields during the + migration period. +* Added Wikimedia\Rdbms\IDatabase::cancelAtomic(), to roll back an atomic + section without having to roll back the whole transaction. +* Wikimedia\Rdbms\IDatabase::doAtomicSection(), non-native ::insertSelect(), + and non-MySQL ::replace() and ::upsert() no longer roll back the whole + transaction on failure. +* (T189785) Added a monthly heartbeat ping to the pingback feature. +* The CLI installer (maintenance/install.php) learned to detect and include + extensions. Pass --with-extensions to enable that feature. +* (T184791) rc_patrolled now has three states: "0" for unpatrolled, + "1" for manually patrolled and "2" for autopatrolled actions. +* Extensions can now set their type to "editor" if they provide an editor or + enhance the editing experience. +* Extensions can use a PSR-4 autoloader by setting an "AutoloadNamespaces" + property in extension.json. See the documentation at + + for more details and an example. +* (T19099) Tabs which link to pages that don't exist (like those to uncreated + discussion pages) now have a tooltip to indicate state, not just colour. + +=== External library changes in 1.31 === +* pear/mail, pear/mail_mime and pear/mail_mime-decode have been moved from + suggested to required. These packages now must be installed via composer + and not via PEAR itself. + +==== Upgraded external libraries ==== +* Updated jquery.chosen from v0.9.14 to v1.8.2. +* Updated composer/spdx-licenses from 1.1.4 to 1.3.0 (development dependency). +* Updated nikic/php-parser from 2.1.0 to 3.1.3 (development dependency). +* Updated wikimedia/ip-set from 1.1.0 to 1.2.0. +* Updated wikimedia/relpath from 2.0.0 to 2.1.1. +* Updated wikimedia/running-stat from 1.1.0 to 1.2.0. +* Updated wikimedia/wrappedstring from 2.2.0 to 2.3.0. +* Updated mediawiki/at-ease from 1.1.0 to 1.2.0. +* Updated wikimedia/php-session-serializer from 1.0.4 to 1.0.6. +* Updated wikimedia/remex-html from 1.0.2 to 1.0.3. +* Updated wikimedia/html-formatter from 1.0.1 to 1.0.2. + +==== New external libraries ==== +* Added wikimedia/object-factory 1.0.0 + +==== Removed and replaced external libraries ==== +* (T17845) The deprecated 'jquery.badge' module was removed. +* The deprecated 'jquery.autoEllipsis' module was removed. Use the CSS + text-overflow property instead. +* The deprecated 'jquery.placeholder' module was removed. +* The deprecated 'jquery.appear' module was removed. Use the + 'mediawiki.viewport' module instead. +* mediawiki/at-ease was replaced with wikimedia/at-ease. + +=== Bug fixes in 1.31 === +* (T90902) Non-breaking space in header ID breaks anchor. +* (T189375) CSSMin now allows quoted urls in `url()` syntax to start with a + space. +* (T2087, T10897, T87753, T174639) Whitespace created by category and language + links is now stripped rather than leaving blank lines in odd places. +* (T3780) Uploads with UTF-8 names now work on PHP7.1+ on Windows servers. +* (T182366) UploadBase::checkXMLEncodingMissmatch() now works on PHP 7.1+ + +=== Action API changes in 1.31 === +* (T185058) The 'name' value to tgprop for action=query&list=tags has been + removed. It has never made a difference in the output, the name was always + returned regardless. +* The 'watch' and 'unwatch' parameters for action=move have been removed. They + were deprecated and also accidentally nonfunctional since 1.17 in 2010. Use + 'watchlist' instead. + +=== Action API internal changes in 1.31 === +* ApiBase::getProfileDBTime, deprecated since 1.25, was removed. +* ApiBase::getModuleProfileName, deprecated since 1.25, was removed. +* ApiBase::getProfileTime, deprecated since 1.25, was removed. + +=== Languages updated in 1.31 === +MediaWiki supports over 350 languages. Many localisations are updated +regularly. Below only new and removed languages are listed, as well as +changes to languages because of Phabricator reports. + +* (T180052) Mirandese (mwl) now supports gendered NS_USER/NS_USER_TALK. +* (T182305) New language support: Nyungar (nys). +* (T186359) New language support: Siberian Tatar [cебертатар] (sty). +* (T186635) New language support: Guianan Creole (gcr). +* (T186647) New language support: Kumyk [къумукъ] (kum). +* (T187750) New language support: Spanish formal address (es-formal). +* (T187824) New language support: Hungarian formal address (hu-formal). +* (T189127) New language support: Gorontalo (gor). + +=== Breaking changes in 1.31 === +* MessageBlobStore::insertMessageBlob(), deprecated in 1.27, was removed. +* The OutputPage class constructor now requires a context parameter. + Instantiating without context was deprecated in 1.18. +* The mw.page JavaScript singleton, deprecated in 1.30, was removed. +* Article::getLastPurgeTimestamp(), WikiPage::getLastPurgeTimestamp(), and the + related WikiPage::PURGE_* constants, deprecated in 1.29, were removed. +* The Article::selectFields(), ::onArticleCreate(), ::onArticleDelete(), and + ::onArticleEdit() methods, deprecated in 1.24, were removed. +* Installer::locateExecutable() and ::locateExecutableInDefaultPaths() were + removed. Use ExecutableFinder::findInDefaultPaths() instead. +* The deprecated MW_DIFF_VERSION constant was removed. + DifferenceEngine::MW_DIFF_VERSION should be used instead. +* Due to significant refactoring, method ContribsPager::getUserCond() that had + no access restriction has been removed. +* The Block class will no longer accept usable-but-missing usernames for + 'byText' or ->setBlocker(). Callers should either ensure the blocker exists + locally or use a new interwiki-format username like "iw>Example". +* The following methods and constants from the WatchedItem class, which were + deprecated in 1.27, have been removed: + * WatchedItem::getTitle() + * WatchedItem::fromUserTitle() + * WatchedItem::addWatch() + * WatchedItem::removeWatch() + * WatchedItem::isWatched() + * WatchedItem::duplicateEntries() + * WatchedItem::IGNORE_USER_RIGHTS + * WatchedItem::CHECK_USER_RIGHTS + * WatchedItem::DEPRECATED_USAGE_TIMESTAMP +* The $statementsOnOwnLine parameter of JavaScriptMinifier::minify was removed. + $wgResourceLoaderMinifierStatementsOnOwnLine, the corresponding configuration + variable, has been deprecated since 1.27 and was removed as well. +* The $maxLineLength parameter of JavaScriptMinifier::minify was removed. + $wgResourceLoaderMinifierMaxLineLength, the corresponding configuration + variable, has been deprecated since 1.27 and was removed as well. +* The HtmlFormatter class, deprecated in 1.27, was removed. The namespaced + HtmlFormatter\HtmlFormatter class should be used instead. +* The driver 'mysql' for MySQL, deprecated in MediaWiki 1.30, has been removed. + The driver has been deprecated since PHP 5.5 and was removed in PHP 7.0. The + default driver for MySQL has been 'mysqli' since MediaWiki 1.22. +* The following properties of PreparedEdit were deprecated in 1.21 and have + been removed: + * PreparedEdit->newText + * PreparedEdit->oldText + * PreparedEdit->pst +* ParserOutput objects which are generated using a non-default value for + ParserOptions::setWrapOutputClass() can no longer be added to the parser + cache. +* The following deprecated methods from the OutputPage class have been removed: + * OutputPage::addExtensionStyle(); deprecated in 1.27 + * OutputPage::getExtStyle(); deprecated in 1.27 + * OutputPage::setETag(); deprecated in 1.28 (obsolete no-op) + * OutputPage::setSquidMaxage(); deprecated in 1.27 + * OutputPage::readOnlyPage(); deprecated in 1.25 + * OutputPage::rateLimited(); deprecated in 1.25 + * Additionally, the protected OutputPage::$mExtStyles array, only accessed + through the above and with no known uses, was removed. +* The no-op method Skin::showIPinHeader(), deprecated in 1.27, was removed. +* The following variables and methods in EditPage, deprecated in MediaWiki 1.30, + were removed: + * $isCssJsSubpage — use ::isUserConfigPage() + * $isCssSubpage — use ::isUserCssConfigPage() + * $isJsSubpage — use ::isUserJsConfigPage() + * $isWrongCaseCssJsPage – use ::isWrongCaseUserConfigPage() + * ::getSummaryInput() – use ::getSummaryInputWidget() + * ::getSummaryInputOOUI() – use ::getSummaryInputWidget() + * ::getCheckboxes() – use ::getCheckboxesWidget() or + ::getCheckboxesDefinition() + * ::getCheckboxesOOUI() – use ::getCheckboxesWidget() or + ::getCheckboxesDefinition() +* ResourceLoaderModule::getPosition(), deprecated in 1.29, has been removed. +* In User, the cookie-related methods which were wrappers for the functions on + the response object, and were deprecated in 1.27, have been removed: + * ::setCookie() + * ::clearCookie() + * ::setExtendedLoginCookie() + Note that User::setCookies() remains, and is not deprecated. +* Also in User, some auth-related methods which were deprecated in 1.27 have + been removed: + * ::getEditTokenTimestamp() – use MediaWiki\Session\Token::getTimestamp() + * ::getPasswordFactory() – create a PasswordFactory directly + * ::passwordChangeInputAttribs() +* The global functions wfProfileIn and wfProfileOut, deprecated in 1.25, have + been removed. +* SpecialPageFactory::getList(), deprecated in 1.24, has been removed. You can + use ::getNames() instead. +* OpenSearch::getOpenSearchTemplate(), deprecated in 1.25, has been removed. You + can use ApiOpenSearch::getOpenSearchTemplate() instead. +* The global function wfBaseConvert, deprecated in 1.27, has been removed. Use + Wikimedia\base_convert() directly. +* Calling Database::begin() explicitly during an implicit transaction or when + DBO_TRX is set results in an exception. Calling Database::commit() explicitly + for an implicit transaction also results in an exception. Previously these + were logged as errors. The startAtomic() and endAtomic() methods, or + AtomicSectionUpdate should be used instead. +* The global function wfOutputHandler() was removed, use the its replacement + MediaWiki\OutputHandler::handle() instead. The global function was only + sometimes defined. Its replacement is always available via the autoloader. +* ChangeTags::listExtensionActivatedTags and ::listExtensionDefinedTags, + deprecated in 1.28, have been removed. Use ::listSoftwareActivatedTags() and + ::listSoftwareDefinedTags() instead. +* Title::getTitleInvalidRegex(), deprecated in 1.25, has been removed. You can + use MediaWikiTitleCodec::getTitleInvalidRegex() instead. +* HTMLForm & VFormHTMLForm::isVForm(), deprecated in 1.25, have been removed. +* The ProfileSection class, deprecated in 1.25 and unused, has been removed. +* The ResourceLoaderGetLessVars hook, deprecated in 1.30, has been removed. Use + ResourceLoaderModule::getLessVars() to expose local variables instead of + global ones. +* As part of work to modernise user-generated content clean-up, a config option + and some methods related to HTML validity were removed without deprecation. + The public methods MWTidy::checkErrors() and the path through which it was + called, TidyDriverBase::validate(), are removed, as are the testing methods + MediaWikiTestCase::assertValidHtmlSnippet() and ::assertValidHtmlDocument(). + The $wgValidateAllHtml configuration option is removed and will be ignored. +* Execution of external programs using MediaWiki\Shell\Command now applies + the RESTRICT_DEFAULT Firejail restriction by default. +* The ResourceLoaderModule::getHashMtime() and ::getDefinitionMtime() methods, + deprecated in 1.26, were removed. +* The deprecated 'mediawiki.widgets.CategorySelector' module alias was removed. + Use the 'mediawiki.widgets.CategoryMultiselectWidget' module directly. + +=== Deprecations in 1.31 === +* The Revision class was deprecated in favor of RevisionStore, BlobStore, and + RevisionRecord and its subclasses. +* The global function wfBCP47 is deprecated in favour of LanguageCode::bcp47. +* The global function wfCountDown is now deprecated in favor of + Maintenance::countDown. +* Several methods for returning lists of fields to select from the database + have been deprecated in favor of similar methods that also return the tables + to select from and the join conditions for those tables. + * Block::selectFields() → Block::getQueryInfo() + * RecentChange::selectFields() → RecentChange::getQueryInfo() + * ArchivedFile::selectFields() → ArchivedFile::getQueryInfo() + * LocalFile::selectFields() → LocalFile::getQueryInfo() + * LocalFile::getCacheFields() with a prefix no longer works + * LocalFile::getLazyCacheFields() with a prefix no longer works + * OldLocalFile::selectFields() → OldLocalFile::getQueryInfo() + * RecentChange::selectFields() → RecentChange::getQueryInfo() + * Revision::userJoinCond() → Revision::getQueryInfo( [ 'user' ] ) + * Revision::selectUserFields() → Revision::getQueryInfo( [ 'user' ] ) + * Revision::pageJoinCond() → Revision::getQueryInfo( [ 'page' ] ) + * Revision::selectPageFields() → Revision::getQueryInfo( [ 'page' ] ) + * Revision::selectTextFields() → Revision::getQueryInfo( [ 'text' ] ) + * Revision::selectFields() → Revision::getQueryInfo() + * Revision::selectArchiveFields() → Revision::getArchiveQueryInfo() + * User::selectFields() → User::getQueryInfo() + * WikiPage::selectFields() → WikiPage::getQueryInfo() +* Revision::setUserIdAndName() was deprecated. +* Access to TitleValue class properties was deprecated, the relevant getters + should be used instead. +* DifferenceEngine::getDiffBodyCacheKey() is deprecated. Subclasses should + override DifferenceEngine::getDiffBodyCacheKeyParams() instead. +* Use of Maintenance::error( $err, $die ) to exit script was deprecated. Use + Maintenance::fatalError() instead. +* Passing a ParserOptions object to OutputPage::parserOptions() is deprecated. +* The RevisionInsertComplete hook is now deprecated; use instead the hook + RevisionRecordInserted. RevisionInsertComplete is still called, but the second + and third parameter will always be null. Hard deprecation is scheduled for 1.32. +* The following methods that get and set ParserOutput state are deprecated. + Callers should use the new stateless $options parameter to + ParserOutput::getText() instead. + * ParserOptions::getEditSection() + * ParserOptions::setEditSection() + * ParserOutput::getEditSectionTokens() + * ParserOutput::setEditSectionTokens() + * ParserOutput::getTOCEnabled() + * ParserOutput::setTOCEnabled() + * OutputPage::enableSectionEditLinks() + * OutputPage::sectionEditLinksEnabled() + * The public ParserOutput state fields $mTOCEnabled and $mEditSectionTokens + are also deprecated. +* License::getLicenses has been deprecated; use License::getLines instead. +* QuickTemplate::setRef() was deprecated in favour of QuickTemplate::set(). + Setting template variables by reference allowed violating the principle of + data being immutable once added to the skin template. In practice, this method + was not being used for that. Rather, setRef() existed as memory optimisation + for PHP 4. +* QuickTemplate::setTranslator() and MediaWikiI18N::set() were deprecated in + favour of Skin::msg() parameters. +* MediaWikiI18N::translate() was deprecated in favour of Skin::msg() or + wfMessage(). +* Passing false to ParserOptions::setWrapOutputClass() is deprecated. Use the + 'unwrap' transform to ParserOutput::getText() instead. +* \ObjectFactory (no namespace) is deprecated, the namespaced class + \Wikimedia\ObjectFactory from the wikimedia/object-factory library should be + used instead. +* CommentStore::newKey is deprecated. Instead, get an instance from + MediaWikiServices. +* The following CommentStore methods have had their signatures changed to + introduce a $key parameter, usage of the methods on instances retrieved from + CommentStore::newKey will remain unchanged but deprecated: + * CommentStore::getFields + * CommentStore::getJoin + * CommentStore::getComment + * CommentStore::getCommentLegacy + * CommentStore::insert + * CommentStore::insertWithTemplate +* The following methods in Title have been renamed, and the old ones are + deprecated: + * Title::getSkinFromCssJsSubpage – use ::getSkinFromConfigSubpage + * Title::isCssOrJsPage – use ::isSiteConfigPage + * Title::isCssJsSubpage – use ::isUserConfigPage + * Title::isCssSubpage – use ::isUserCssConfigPage + * Title::isJsSubpage – use ::isUserJsConfigPage +* The following methods related to caching of half-parsed HTML were deprecated: + * Parser::serializeHalfParsedText() + * Parser::unserializeHalfParsedText() + * Parser::isValidHalfParsedText() + * StripState::getSubState() + * StripState::merge() +* The DeferredStringifier class is deprecated, use Message::listParam() instead. +* The type string for the parameter $lang of DateFormatter::getInstance is + deprecated. +* Wikimedia\Rdbms\SavepointPostgres is deprecated. +* The DO_MAINTENANCE constant is deprecated. RUN_MAINTENANCE_IF_MAIN should be + used instead. +* The function wfShellWikiCmd() has been deprecated, use + MediaWiki\Shell::makeScriptCommand(). +* In the future, the hooks 'PreferencesFormPreSave' and 'PreferencesGetLegend' + will be allowed to provide any HTMLForm object rather than PreferencesForm. + +=== Other changes in 1.31 === +* Browser support for Internet Explorer 10 was lowered from Grade A to Grade C. +* Browser support for Opera 12 and older was dropped entirely. Opera 15+ + continues at Grade A. +* Multi-content-revision capability was introduced into the storage layer. See + . +* The "free" CSS class is now only applied to unbracketed URLs in wikitext. + Links written using square brackets will get the class "text" not "free". +* RFC 157418: Whitespace is trimmed from wikitext headings, wikitext list items, + wikitext table captions, wikitext table headings, wikitext table cells. HTML + headings, HTML list items, HTML table captions, HTML table headings, HTML + table cells will not have this trimming behavior. + +== Compatibility == +MediaWiki 1.31 requires PHP 7.0.0 or later. Although HHVM 3.18.5 or later is +supported, it is generally advised to use PHP 7.0.0 or later for long term +support. + +MySQL/MariaDB is the recommended DBMS. PostgreSQL or SQLite can also be used, +but support for them is somewhat less mature. There is experimental support for +Oracle and Microsoft SQL Server. + +The supported versions are: + +* MySQL 5.5.8 or later +* PostgreSQL 9.2 or later +* SQLite 3.3.7 or later +* Oracle 9.0.1 or later +* Microsoft SQL Server 2005 (9.00.1399) + +== Upgrading == +1.31 has several database changes since 1.30, and will not work without schema +updates. Note that due to changes to some very large tables like the revision +table, the schema update may take quite long (minutes on a medium sized site, +many hours on a large site). + +Don't forget to always back up your database before upgrading! + +See the file UPGRADE for more detailed upgrade instructions, including +important information when upgrading from versions prior to 1.11. + +For notes on 1.30.x and older releases, see HISTORY. + +== Online documentation == +Documentation for both end-users and site administrators is available on +MediaWiki.org, and is covered under the GNU Free Documentation License (except +for pages that explicitly state that their contents are in the public domain): + + https://www.mediawiki.org/wiki/Special:MyLanguage/Documentation + +== Mailing list == +A mailing list is available for MediaWiki user support and discussion: + + https://lists.wikimedia.org/mailman/listinfo/mediawiki-l + +A low-traffic announcements-only list is also available: + + https://lists.wikimedia.org/mailman/listinfo/mediawiki-announce + +It's highly recommended that you sign up for one of these lists if you're +going to run a public MediaWiki, so you can be notified of security fixes. + +== IRC help == +There's usually someone online in #mediawiki on irc.freenode.net. + = MediaWiki 1.30 = diff --git a/README b/README new file mode 100644 index 0000000000..ad9b9d9d83 --- /dev/null +++ b/README @@ -0,0 +1,33 @@ +== MediaWiki == + +MediaWiki is a free and open-source wiki software package written in PHP. It +serves as the platform for Wikipedia and the other Wikimedia projects, used +by hundreds of millions of people each month. MediaWiki is localised in over +350 languages and its reliability and robust feature set have earned it a large +and vibrant community of third-party users and developers. + +MediaWiki is: + +* feature-rich and extensible, both on-wiki and with hundreds of extensions; +* scalable and suitable for both small and large sites; +* simple to install, working on most hardware/software combinations; and +* available in your language. + +For system requirements, installation, and upgrade details, see the files +RELEASE-NOTES, INSTALL, and UPGRADE. + +* Ready to get started? +** https://www.mediawiki.org/wiki/Special:MyLanguage/Download +* Looking for the technical manual? +** https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:Contents +* Seeking help from a person? +** https://www.mediawiki.org/wiki/Special:MyLanguage/Communication +* Looking to file a bug report or a feature request? +** https://bugs.mediawiki.org/ +* Interested in helping out? +** https://www.mediawiki.org/wiki/Special:MyLanguage/How_to_contribute + +MediaWiki is the result of global collaboration and cooperation. The CREDITS +file lists technical contributors to the project. The COPYING file explains +MediaWiki's copyright and license (GNU General Public License, version 2 or +later). Many thanks to the Wikimedia community for testing and suggestions. diff --git a/README.md b/README.md deleted file mode 100644 index ca703dbc0f..0000000000 --- a/README.md +++ /dev/null @@ -1,34 +0,0 @@ -MediaWiki -=========== - -MediaWiki is a free and open-source wiki software package written in PHP. It -serves as the platform for Wikipedia and the other Wikimedia projects, used -by hundreds of millions of people each month. MediaWiki is localised in over -350 languages and its reliability and robust feature set have earned it a large -and vibrant community of third-party users and developers. - -MediaWiki is: - -* feature-rich and extensible, both on-wiki and with hundreds of extensions; -* scalable and suitable for both small and large sites; -* simple to install, working on most hardware/software combinations; and -* available in your language. - -For system requirements, installation, and upgrade details, see the files -RELEASE-NOTES, INSTALL, and UPGRADE. - -* Ready to get started? -** https://www.mediawiki.org/wiki/Special:MyLanguage/Download -* Looking for the technical manual? -** https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:Contents -* Seeking help from a person? -** https://www.mediawiki.org/wiki/Special:MyLanguage/Communication -* Looking to file a bug report or a feature request? -** https://bugs.mediawiki.org/ -* Interested in helping out? -** https://www.mediawiki.org/wiki/Special:MyLanguage/How_to_contribute - -MediaWiki is the result of global collaboration and cooperation. The CREDITS -file lists technical contributors to the project. The COPYING file explains -MediaWiki's copyright and license (GNU General Public License, version 2 or -later). Many thanks to the Wikimedia community for testing and suggestions. diff --git a/README.mediawiki b/README.mediawiki new file mode 120000 index 0000000000..100b93820a --- /dev/null +++ b/README.mediawiki @@ -0,0 +1 @@ +README \ No newline at end of file diff --git a/RELEASE-NOTES-1.31 b/RELEASE-NOTES-1.31 deleted file mode 100644 index bf038a7ee0..0000000000 --- a/RELEASE-NOTES-1.31 +++ /dev/null @@ -1,452 +0,0 @@ -== MediaWiki 1.31 == - -THIS IS NOT A RELEASE YET - -MediaWiki 1.31 is an alpha-quality branch and is not recommended for use in -production. - -=== Configuration changes in 1.31 === -* $wgEnableAPI and $wgEnableWriteAPI are now deprecated and will be removed in - a future version. The API is now considered to be stable, secure and - essential. -* $wgUsejQueryThree was removed, as it is now the default. This was documented - as a temporary variable during the migration period, deprecated since 1.29. -* $wgLogoHD has been updated to support svg images and uses $wgLogo where - possible for fallback images such as png. -* (T44246) $wgFilterLogTypes will no longer ignore 'patrol' when user does not - have the right to mark things patrolled. -* Wikis that contain imported revisions or CentralAuth global blocks should run - maintenance/cleanupUsersWithNoId.php. -* The configuration settings $wgResourceLoaderMinifierStatementsOnOwnLine and - $wgResourceLoaderMinifierMaxLineLength, deprecated since 1.27, were removed. -* (T180921) $wgReferrerPolicy now supports having fallbacks for browsers that - are not using the latest version of the Referrer Policy specification. -* $wgFragmentMode is now set to [ 'legacy', 'html5' ] by default. This is a - first step of migration to human-readable section IDs that will later result - in 'html5' being the default mode. -* CACHE_ACCEL now only supports APC(u) or WinCache. XCache support was removed - as upstream is inactive and has no plans to move to PHP 7. -* The old CategorizedRecentChanges feature, including its related configuration - option $wgAllowCategorizedRecentChanges, has been removed. -* (T188472) The 'comma' value for $wgArticleCountMethod is no longer supported - for performance reasons, and installations with this setting will now work as - if it was configured with 'any'. -* (T185753) MediaWiki now defaults to using RemexHtml to tidy up user input, - rather than being off by default. If you wish to disable HTML tidying - entirely, set $wgTidyConfig to null; if you wish to use the old, deprecated - Tidy external binary, both set $wgTidyConfig to null and $wgUseTidy to true. -* $wgLogAutopatrol now defaults to false instead of true. -* $wgValidateAllHtml was removed and will be ignored. -* $wgScriptExtension, deprecated and ignored since 1.25, was removed. See the - 1.25 release notes for more information. -* $wgUseAjax is now marked as deprecated, just like the deprecated AJAX - framework that it enables. Some extensions mistakenly used this to check - whether any AJAX functionality at all should be enabled, further making this - problematic to retain. - -=== New features in 1.31 === -* (T76554) User sub-pages named ….json are now protected in the same way that - ….js and ….css pages are, so that configuration options can safely be placed - there. -* Wikimedia\Rdbms\IDatabase->select() and similar methods now support joins - with parentheses for grouping. -* As a first pass in standardizing dialog boxes across the MediaWiki product, - Html class now provides helper methods for messageBox, successBox, errorBox - and warningBox generation. -* (T9240) Imports will now record unknown (and, optionally, known) usernames in - a format like "iw>Example". -* (T20209) Linker (used on history pages, log pages, and so on) will display - usernames formed like "iw>Example" as interwiki links, as if by wikitext like - [[iw:User:Example|iw>Example]]. -* (T111605) The 'ImportHandleUnknownUser' hook allows extensions to auto-create - users during an import. -* Added a hook, ParserOutputPostCacheTransform, to allow extensions to affect - the ParserOutput::getText() post-cache transformations. -* Added a hook, UploadForm:getInitialPageText, to allow extensions to alter the - initial page text for file uploads. -* (T181651) The info page for File pages now displays the file's base-16 SHA1 - hash value in the table of basic information. -* Style tags with a 'data-mw-deduplicate' attribute will be deduplicated as a - ParserOutput::getText() post-cache transformation. This may be disabled by - passing 'deduplicateStyles' => false to that method. -* The identity of the logged-in or IP "actor" for logged actions is being moved - into a new actor table, with the rows in tables such as revision and logging - referring to the actor ID instead of storing the user ID and name/IP in - every row. - * This is currently gated by $wgActorTableSchemaMigrationStage. Most wikis - can set this to MIGRATION_NEW and run maintenance/migrateActors.php as - soon as any necessary extensions are updated. - * Most code accessing rows for logged actions from the database should use - the relevant getQueryInfo() methods to get the information needed to build - the SQL query. The ActorMigration class may also be used to get feature - -flagged information needed to access actor-related fields during the - migration period. -* Added Wikimedia\Rdbms\IDatabase::cancelAtomic(), to roll back an atomic - section without having to roll back the whole transaction. -* Wikimedia\Rdbms\IDatabase::doAtomicSection(), non-native ::insertSelect(), - and non-MySQL ::replace() and ::upsert() no longer roll back the whole - transaction on failure. -* (T189785) Added a monthly heartbeat ping to the pingback feature. -* The CLI installer (maintenance/install.php) learned to detect and include - extensions. Pass --with-extensions to enable that feature. -* (T184791) rc_patrolled now has three states: "0" for unpatrolled, - "1" for manually patrolled and "2" for autopatrolled actions. -* Extensions can now set their type to "editor" if they provide an editor or - enhance the editing experience. -* Extensions can use a PSR-4 autoloader by setting an "AutoloadNamespaces" - property in extension.json. See the documentation at - - for more details and an example. -* (T19099) Tabs which link to pages that don't exist (like those to uncreated - discussion pages) now have a tooltip to indicate state, not just colour. - -=== External library changes in 1.31 === -* pear/mail, pear/mail_mime and pear/mail_mime-decode have been moved from - suggested to required. These packages now must be installed via composer - and not via PEAR itself. - -==== Upgraded external libraries ==== -* Updated jquery.chosen from v0.9.14 to v1.8.2. -* Updated composer/spdx-licenses from 1.1.4 to 1.3.0 (development dependency). -* Updated nikic/php-parser from 2.1.0 to 3.1.3 (development dependency). -* Updated wikimedia/ip-set from 1.1.0 to 1.2.0. -* Updated wikimedia/relpath from 2.0.0 to 2.1.1. -* Updated wikimedia/running-stat from 1.1.0 to 1.2.0. -* Updated wikimedia/wrappedstring from 2.2.0 to 2.3.0. -* Updated mediawiki/at-ease from 1.1.0 to 1.2.0. -* Updated wikimedia/php-session-serializer from 1.0.4 to 1.0.6. -* Updated wikimedia/remex-html from 1.0.2 to 1.0.3. -* Updated wikimedia/html-formatter from 1.0.1 to 1.0.2. - -==== New external libraries ==== -* Added wikimedia/object-factory 1.0.0 - -==== Removed and replaced external libraries ==== -* (T17845) The deprecated 'jquery.badge' module was removed. -* The deprecated 'jquery.autoEllipsis' module was removed. Use the CSS - text-overflow property instead. -* The deprecated 'jquery.placeholder' module was removed. -* The deprecated 'jquery.appear' module was removed. Use the - 'mediawiki.viewport' module instead. -* mediawiki/at-ease was replaced with wikimedia/at-ease. - -=== Bug fixes in 1.31 === -* (T90902) Non-breaking space in header ID breaks anchor. -* (T189375) CSSMin now allows quoted urls in `url()` syntax to start with a - space. -* (T2087, T10897, T87753, T174639) Whitespace created by category and language - links is now stripped rather than leaving blank lines in odd places. -* (T3780) Uploads with UTF-8 names now work on PHP7.1+ on Windows servers. - -=== Action API changes in 1.31 === -* (T185058) The 'name' value to tgprop for action=query&list=tags has been - removed. It has never made a difference in the output, the name was always - returned regardless. -* The 'watch' and 'unwatch' parameters for action=move have been removed. They - were deprecated and also accidentally nonfunctional since 1.17 in 2010. Use - 'watchlist' instead. - -=== Action API internal changes in 1.31 === -* ApiBase::getProfileDBTime, deprecated since 1.25, was removed. -* ApiBase::getModuleProfileName, deprecated since 1.25, was removed. -* ApiBase::getProfileTime, deprecated since 1.25, was removed. - -=== Languages updated in 1.31 === -MediaWiki supports over 350 languages. Many localisations are updated -regularly. Below only new and removed languages are listed, as well as -changes to languages because of Phabricator reports. - -* (T180052) Mirandese (mwl) now supports gendered NS_USER/NS_USER_TALK. -* (T182305) New language support: Nyungar (nys). -* (T186359) New language support: Siberian Tatar [cебертатар] (sty). -* (T186635) New language support: Guianan Creole (gcr). -* (T186647) New language support: Kumyk [къумукъ] (kum). -* (T187750) New language support: Spanish formal address (es-formal). -* (T187824) New language support: Hungarian formal address (hu-formal). -* (T189127) New language support: Gorontalo (gor). - -=== Breaking changes in 1.31 === -* MessageBlobStore::insertMessageBlob(), deprecated in 1.27, was removed. -* The OutputPage class constructor now requires a context parameter. - Instantiating without context was deprecated in 1.18. -* The mw.page JavaScript singleton, deprecated in 1.30, was removed. -* Article::getLastPurgeTimestamp(), WikiPage::getLastPurgeTimestamp(), and the - related WikiPage::PURGE_* constants, deprecated in 1.29, were removed. -* The Article::selectFields(), ::onArticleCreate(), ::onArticleDelete(), and - ::onArticleEdit() methods, deprecated in 1.24, were removed. -* Installer::locateExecutable() and ::locateExecutableInDefaultPaths() were - removed. Use ExecutableFinder::findInDefaultPaths() instead. -* The deprecated MW_DIFF_VERSION constant was removed. - DifferenceEngine::MW_DIFF_VERSION should be used instead. -* Due to significant refactoring, method ContribsPager::getUserCond() that had - no access restriction has been removed. -* The Block class will no longer accept usable-but-missing usernames for - 'byText' or ->setBlocker(). Callers should either ensure the blocker exists - locally or use a new interwiki-format username like "iw>Example". -* The following methods and constants from the WatchedItem class, which were - deprecated in 1.27, have been removed: - * WatchedItem::getTitle() - * WatchedItem::fromUserTitle() - * WatchedItem::addWatch() - * WatchedItem::removeWatch() - * WatchedItem::isWatched() - * WatchedItem::duplicateEntries() - * WatchedItem::IGNORE_USER_RIGHTS - * WatchedItem::CHECK_USER_RIGHTS - * WatchedItem::DEPRECATED_USAGE_TIMESTAMP -* The $statementsOnOwnLine parameter of JavaScriptMinifier::minify was removed. - $wgResourceLoaderMinifierStatementsOnOwnLine, the corresponding configuration - variable, has been deprecated since 1.27 and was removed as well. -* The $maxLineLength parameter of JavaScriptMinifier::minify was removed. - $wgResourceLoaderMinifierMaxLineLength, the corresponding configuration - variable, has been deprecated since 1.27 and was removed as well. -* The HtmlFormatter class, deprecated in 1.27, was removed. The namespaced - HtmlFormatter\HtmlFormatter class should be used instead. -* The driver 'mysql' for MySQL, deprecated in MediaWiki 1.30, has been removed. - The driver has been deprecated since PHP 5.5 and was removed in PHP 7.0. The - default driver for MySQL has been 'mysqli' since MediaWiki 1.22. -* The following properties of PreparedEdit were deprecated in 1.21 and have - been removed: - * PreparedEdit->newText - * PreparedEdit->oldText - * PreparedEdit->pst -* ParserOutput objects which are generated using a non-default value for - ParserOptions::setWrapOutputClass() can no longer be added to the parser - cache. -* The following deprecated methods from the OutputPage class have been removed: - * OutputPage::addExtensionStyle(); deprecated in 1.27 - * OutputPage::getExtStyle(); deprecated in 1.27 - * OutputPage::setETag(); deprecated in 1.28 (obsolete no-op) - * OutputPage::setSquidMaxage(); deprecated in 1.27 - * OutputPage::readOnlyPage(); deprecated in 1.25 - * OutputPage::rateLimited(); deprecated in 1.25 - * Additionally, the protected OutputPage::$mExtStyles array, only accessed - through the above and with no known uses, was removed. -* The no-op method Skin::showIPinHeader(), deprecated in 1.27, was removed. -* The following variables and methods in EditPage, deprecated in MediaWiki 1.30, - were removed: - * $isCssJsSubpage — use ::isUserConfigPage() - * $isCssSubpage — use ::isUserCssConfigPage() - * $isJsSubpage — use ::isUserJsConfigPage() - * $isWrongCaseCssJsPage – use ::isWrongCaseUserConfigPage() - * ::getSummaryInput() – use ::getSummaryInputWidget() - * ::getSummaryInputOOUI() – use ::getSummaryInputWidget() - * ::getCheckboxes() – use ::getCheckboxesWidget() or - ::getCheckboxesDefinition() - * ::getCheckboxesOOUI() – use ::getCheckboxesWidget() or - ::getCheckboxesDefinition() -* ResourceLoaderModule::getPosition(), deprecated in 1.29, has been removed. -* In User, the cookie-related methods which were wrappers for the functions on - the response object, and were deprecated in 1.27, have been removed: - * ::setCookie() - * ::clearCookie() - * ::setExtendedLoginCookie() - Note that User::setCookies() remains, and is not deprecated. -* Also in User, some auth-related methods which were deprecated in 1.27 have - been removed: - * ::getEditTokenTimestamp() – use MediaWiki\Session\Token::getTimestamp() - * ::getPasswordFactory() – create a PasswordFactory directly - * ::passwordChangeInputAttribs() -* The global functions wfProfileIn and wfProfileOut, deprecated in 1.25, have - been removed. -* SpecialPageFactory::getList(), deprecated in 1.24, has been removed. You can - use ::getNames() instead. -* OpenSearch::getOpenSearchTemplate(), deprecated in 1.25, has been removed. You - can use ApiOpenSearch::getOpenSearchTemplate() instead. -* The global function wfBaseConvert, deprecated in 1.27, has been removed. Use - Wikimedia\base_convert() directly. -* Calling Database::begin() explicitly during an implicit transaction or when - DBO_TRX is set results in an exception. Calling Database::commit() explicitly - for an implicit transaction also results in an exception. Previously these - were logged as errors. The startAtomic() and endAtomic() methods, or - AtomicSectionUpdate should be used instead. -* The global function wfOutputHandler() was removed, use the its replacement - MediaWiki\OutputHandler::handle() instead. The global function was only - sometimes defined. Its replacement is always available via the autoloader. -* ChangeTags::listExtensionActivatedTags and ::listExtensionDefinedTags, - deprecated in 1.28, have been removed. Use ::listSoftwareActivatedTags() and - ::listSoftwareDefinedTags() instead. -* Title::getTitleInvalidRegex(), deprecated in 1.25, has been removed. You can - use MediaWikiTitleCodec::getTitleInvalidRegex() instead. -* HTMLForm & VFormHTMLForm::isVForm(), deprecated in 1.25, have been removed. -* The ProfileSection class, deprecated in 1.25 and unused, has been removed. -* The ResourceLoaderGetLessVars hook, deprecated in 1.30, has been removed. Use - ResourceLoaderModule::getLessVars() to expose local variables instead of - global ones. -* As part of work to modernise user-generated content clean-up, a config option - and some methods related to HTML validity were removed without deprecation. - The public methods MWTidy::checkErrors() and the path through which it was - called, TidyDriverBase::validate(), are removed, as are the testing methods - MediaWikiTestCase::assertValidHtmlSnippet() and ::assertValidHtmlDocument(). - The $wgValidateAllHtml configuration option is removed and will be ignored. -* Execution of external programs using MediaWiki\Shell\Command now applies - the RESTRICT_DEFAULT Firejail restriction by default. -* The ResourceLoaderModule::getHashMtime() and ::getDefinitionMtime() methods, - deprecated in 1.26, were removed. -* The deprecated 'mediawiki.widgets.CategorySelector' module alias was removed. - Use the 'mediawiki.widgets.CategoryMultiselectWidget' module directly. - -=== Deprecations in 1.31 === -* The Revision class was deprecated in favor of RevisionStore, BlobStore, and - RevisionRecord and its subclasses. -* The global function wfBCP47 is deprecated in favour of LanguageCode::bcp47. -* The global function wfCountDown is now deprecated in favor of - Maintenance::countDown. -* Several methods for returning lists of fields to select from the database - have been deprecated in favor of similar methods that also return the tables - to select from and the join conditions for those tables. - * Block::selectFields() → Block::getQueryInfo() - * RecentChange::selectFields() → RecentChange::getQueryInfo() - * ArchivedFile::selectFields() → ArchivedFile::getQueryInfo() - * LocalFile::selectFields() → LocalFile::getQueryInfo() - * LocalFile::getCacheFields() with a prefix no longer works - * LocalFile::getLazyCacheFields() with a prefix no longer works - * OldLocalFile::selectFields() → OldLocalFile::getQueryInfo() - * RecentChange::selectFields() → RecentChange::getQueryInfo() - * Revision::userJoinCond() → Revision::getQueryInfo( [ 'user' ] ) - * Revision::selectUserFields() → Revision::getQueryInfo( [ 'user' ] ) - * Revision::pageJoinCond() → Revision::getQueryInfo( [ 'page' ] ) - * Revision::selectPageFields() → Revision::getQueryInfo( [ 'page' ] ) - * Revision::selectTextFields() → Revision::getQueryInfo( [ 'text' ] ) - * Revision::selectFields() → Revision::getQueryInfo() - * Revision::selectArchiveFields() → Revision::getArchiveQueryInfo() - * User::selectFields() → User::getQueryInfo() - * WikiPage::selectFields() → WikiPage::getQueryInfo() -* Revision::setUserIdAndName() was deprecated. -* Access to TitleValue class properties was deprecated, the relevant getters - should be used instead. -* DifferenceEngine::getDiffBodyCacheKey() is deprecated. Subclasses should - override DifferenceEngine::getDiffBodyCacheKeyParams() instead. -* Use of Maintenance::error( $err, $die ) to exit script was deprecated. Use - Maintenance::fatalError() instead. -* Passing a ParserOptions object to OutputPage::parserOptions() is deprecated. -* The RevisionInsertComplete hook is now deprecated; use instead the hook - RevisionRecordInserted. RevisionInsertComplete is still called, but the second - and third parameter will always be null. Hard deprecation is scheduled for 1.32. -* The following methods that get and set ParserOutput state are deprecated. - Callers should use the new stateless $options parameter to - ParserOutput::getText() instead. - * ParserOptions::getEditSection() - * ParserOptions::setEditSection() - * ParserOutput::getEditSectionTokens() - * ParserOutput::setEditSectionTokens() - * ParserOutput::getTOCEnabled() - * ParserOutput::setTOCEnabled() - * OutputPage::enableSectionEditLinks() - * OutputPage::sectionEditLinksEnabled() - * The public ParserOutput state fields $mTOCEnabled and $mEditSectionTokens - are also deprecated. -* License::getLicenses has been deprecated; use License::getLines instead. -* QuickTemplate::setRef() was deprecated in favour of QuickTemplate::set(). - Setting template variables by reference allowed violating the principle of - data being immutable once added to the skin template. In practice, this method - was not being used for that. Rather, setRef() existed as memory optimisation - for PHP 4. -* QuickTemplate::setTranslator() and MediaWikiI18N::set() were deprecated in - favour of Skin::msg() parameters. -* MediaWikiI18N::translate() was deprecated in favour of Skin::msg() or - wfMessage(). -* Passing false to ParserOptions::setWrapOutputClass() is deprecated. Use the - 'unwrap' transform to ParserOutput::getText() instead. -* \ObjectFactory (no namespace) is deprecated, the namespaced class - \Wikimedia\ObjectFactory from the wikimedia/object-factory library should be - used instead. -* CommentStore::newKey is deprecated. Instead, get an instance from - MediaWikiServices. -* The following CommentStore methods have had their signatures changed to - introduce a $key parameter, usage of the methods on instances retrieved from - CommentStore::newKey will remain unchanged but deprecated: - * CommentStore::getFields - * CommentStore::getJoin - * CommentStore::getComment - * CommentStore::getCommentLegacy - * CommentStore::insert - * CommentStore::insertWithTemplate -* The following methods in Title have been renamed, and the old ones are - deprecated: - * Title::getSkinFromCssJsSubpage – use ::getSkinFromConfigSubpage - * Title::isCssOrJsPage – use ::isSiteConfigPage - * Title::isCssJsSubpage – use ::isUserConfigPage - * Title::isCssSubpage – use ::isUserCssConfigPage - * Title::isJsSubpage – use ::isUserJsConfigPage -* The following methods related to caching of half-parsed HTML were deprecated: - * Parser::serializeHalfParsedText() - * Parser::unserializeHalfParsedText() - * Parser::isValidHalfParsedText() - * StripState::getSubState() - * StripState::merge() -* The DeferredStringifier class is deprecated, use Message::listParam() instead. -* The type string for the parameter $lang of DateFormatter::getInstance is - deprecated. -* Wikimedia\Rdbms\SavepointPostgres is deprecated. -* The DO_MAINTENANCE constant is deprecated. RUN_MAINTENANCE_IF_MAIN should be - used instead. -* The function wfShellWikiCmd() has been deprecated, use - MediaWiki\Shell::makeScriptCommand(). -* In the future, the hooks 'PreferencesFormPreSave' and 'PreferencesGetLegend' - will be allowed to provide any HTMLForm object rather than PreferencesForm. - -=== Other changes in 1.31 === -* Browser support for Internet Explorer 10 was lowered from Grade A to Grade C. -* Browser support for Opera 12 and older was dropped entirely. Opera 15+ - continues at Grade A. -* Multi-content-revision capability was introduced into the storage layer. See - . -* The "free" CSS class is now only applied to unbracketed URLs in wikitext. - Links written using square brackets will get the class "text" not "free". -* RFC 157418: Whitespace is trimmed from wikitext headings, wikitext list items, - wikitext table captions, wikitext table headings, wikitext table cells. HTML - headings, HTML list items, HTML table captions, HTML table headings, HTML - table cells will not have this trimming behavior. - -== Compatibility == -MediaWiki 1.31 requires PHP 7.0.0 or later. Although HHVM 3.18.5 or later is -supported, it is generally advised to use PHP 7.0.0 or later for long term -support. - -MySQL/MariaDB is the recommended DBMS. PostgreSQL or SQLite can also be used, -but support for them is somewhat less mature. There is experimental support for -Oracle and Microsoft SQL Server. - -The supported versions are: - -* MySQL 5.5.8 or later -* PostgreSQL 9.2 or later -* SQLite 3.3.7 or later -* Oracle 9.0.1 or later -* Microsoft SQL Server 2005 (9.00.1399) - -== Upgrading == -1.31 has several database changes since 1.30, and will not work without schema -updates. Note that due to changes to some very large tables like the revision -table, the schema update may take quite long (minutes on a medium sized site, -many hours on a large site). - -Don't forget to always back up your database before upgrading! - -See the file UPGRADE for more detailed upgrade instructions, including -important information when upgrading from versions prior to 1.11. - -For notes on 1.30.x and older releases, see HISTORY. - -== Online documentation == -Documentation for both end-users and site administrators is available on -MediaWiki.org, and is covered under the GNU Free Documentation License (except -for pages that explicitly state that their contents are in the public domain): - - https://www.mediawiki.org/wiki/Special:MyLanguage/Documentation - -== Mailing list == -A mailing list is available for MediaWiki user support and discussion: - - https://lists.wikimedia.org/mailman/listinfo/mediawiki-l - -A low-traffic announcements-only list is also available: - - https://lists.wikimedia.org/mailman/listinfo/mediawiki-announce - -It's highly recommended that you sign up for one of these lists if you're -going to run a public MediaWiki, so you can be notified of security fixes. - -== IRC help == -There's usually someone online in #mediawiki on irc.freenode.net. diff --git a/RELEASE-NOTES-1.32 b/RELEASE-NOTES-1.32 index 146bcc6e73..5282236fff 100644 --- a/RELEASE-NOTES-1.32 +++ b/RELEASE-NOTES-1.32 @@ -21,28 +21,50 @@ production. adds a defense-in-depth feature to stop an attacker who has found a bug in the parser allowing them to insert malicious attributes. Disabled by default, you can configure this via $wgCSPHeader and $wgCSPReportOnlyHeader. +* New configuration variable has been added: $wgCookieSetOnIpBlock. + This determines whether to set a cookie when an IP user is blocked. Doing so means + that a blocked user, even after moving to a new IP address, will still be blocked. +* The archive table's ar_rev_id field is now unique. +* Special:BotPasswords now requires reauthentication. === New features in 1.32 === * (T112474) Generalized the ResourceLoader mechanism for overriding modules using a particular page during edit previews. +* (T12331) You can now log page creation events by setting $wgPageCreationLog + to true. * Added 'ApiParseMakeOutputPage' hook. * (T174313) Added checkbox on Special:ListUsers to display only users in temporary user groups. +* (T152462) A cookie can now be set when an IP user is blocked to track that user if + they move to a new IP address. This is disabled by default. +* (T194950) Added 'ApiMaxLagInfo' hook. +* SpecialPage::checkLoginSecurityLevel() will now preserve POST data when + reauthenticating. +* FormSpecialPage::execute() will now call checkLoginSecurityLevel() if + getLoginSecurityLevel() returns non-false. +* The 'ImageBeforeProduceHTML' hook is now passed three new parameters, $parser, + &$query and &$widthOption, allowing extensions even finer control over the resulting + HTML code. === External library changes in 1.32 === * … ==== Upgraded external libraries ==== * Updated QUnit from 2.4.0 to 2.6.0. +* Updated wikimedia/scoped-callback from 1.0.0 to 2.0.0. +** ScopedCallback objects can no longer be serialized. +* Updated wikimedia/wrappedstring from 2.3.0 to 3.0.1. ==== New external libraries ==== +* Added wikimedia/xmp-reader 0.5.1 * … ==== Removed and replaced external libraries ==== * … === Bug fixes in 1.32 === -* … +* SpecialPage::execute() will now only call checkLoginSecurityLevel() if + getLoginSecurityLevel() returns non-false. === Action API changes in 1.32 === * Added templated parameters. @@ -56,11 +78,15 @@ production. templated parameters. * It is now an error to submit too many values for a multi-valued parameter. This has generated a warning since MediaWiki 1.14. +* Assertion failures from the 'assert' and 'assertuser' parameters will no + longer use the action module's custom response format, for the few modules + that use custom formatters that handle errors. === Action API internal changes in 1.32 === * Added 'ApiParseMakeOutputPage' hook. * Parameter names may no longer contain '{' or '}', as these are now used for templated parameters. +* (T194950) Added 'ApiMaxLagInfo' hook. === Languages updated in 1.32 === MediaWiki supports over 350 languages. Many localisations are updated regularly. @@ -69,6 +95,8 @@ because of Phabricator reports. * (T193566) Added language support for Ambonese Malay (abs). * (T194047) Added language support for Shawiya, Latin script (shy-latn). +* (T195940) Added language support for Batak Mandailing (btm). +* (T137491) Added language support for Standard Moroccan Amazigh (zgh). === Breaking changes in 1.32 === * $wgRequestTime, deprecated in 1.25, was removed. Use @@ -104,6 +132,7 @@ because of Phabricator reports. removed. Use JobQueueGroup::singleton()->push() instead. * The jquery.footHovzer module, for mediawiki.debug, was removed. * The es5-shim module, empty and deprecated since 1.29, was removed. +* the dom-level2-shim module, empty and deprecated since 1.29, was removed. * The mediawiki.widgets.visibleByteLimit module alias, deprecated in 1.32, was removed. Use mediawiki.widgets.visibleLengthLimit instead. * The jquery.farbtastic module, unused since 1.18, was removed. @@ -113,6 +142,37 @@ because of Phabricator reports. any HTMLForm object rather than PreferencesForm. * The non namespaced TimestampException class, deprecated in 1.29, was removed. Use Wikimedia\Timestamp\TimestampException instead. +* The global functions codepointToUtf8, hexSequenceToUtf8, utf8ToHexSequence, + utf8ToCodepoint, and escapeSingleString (deprecated in 1.25) were removed. + The UtfNormal\Utils class from the utfnormal library should be used instead. +* The deprecated UTF8_ and UNICODE_ constants were removed. The class constants + from the UtfNormal\Constants class from the utfnormal library should be used +* (T140807) The wgResourceLoaderLESSImportPaths configuration option was removed + from ResourceLoader. Instead, use `@import` statements in LESS to import + files directly from nearby directories within the same project. +* The protected methods PHPSessionHandler::returnSuccess() and returnFailure(), + only needed for PHP5 compatibility, have been removed. It now uses the boolean + values `true` and `false` respectively. +* The $parserMemc global and wfGetParserCacheStorage(), deprecated since 1.30, + were removed. Use the ParserCache class instead. +* ScopedCallback (deprecated in 1.28) was removed. Use Wikimedia\ScopedCallback + instead. +* Support for ResourceLoaderModule::getModifiedTime() and getModifiedHash(), + deprecated since 1.26, was removed. Use getDefinitionSummary() instead. +* (T195256) Skins are recommended not to rely on JavaScript for the "mw-jump" + and "jump-to-nav" accessibility links. To this end, the "jquery.mw-jump" + is no longer loaded by default. The Vector and MonoBook skins have made a + minor change to implement the toggle feature with CSS instead. To restore + prior functionality, either explicitly load "jquery.mw-jump" in your skin + or refer to T195256 for details on how to make the same change. +* Hook 'EditPageBeforeEditChecks' was removed; + use 'EditPageGetCheckboxesDefinition' instead. +* Linker::getLinkColour() and DummyLinker::getLinkColour(), deprecated since + 1.28, were removed. LinkRenderer::getLinkClasses() should be used instead. +* mw.widgets.CategoryMultiselectWidget now uses TagMultiselectWidget instead of + CapsuleMultiselectWidget. The following methods may no longer be used: + * setItemsFromData: Use setValue instead + * getItemsData: Use getItems instead and get the data property === Deprecations in 1.32 === * Use of a StartProfiler.php file is deprecated in favour of placing @@ -139,12 +199,34 @@ because of Phabricator reports. with the 'unwatch' action parameter instead. * IcuCollation::getICUVersion() is deprecated, as you can just use the PHP constant INTL_ICU_VERSION directly in all versions that MediaWiki supports. +* Parser::fetchFile() is deprecated. Use ::fetchFileAndTitle() instead. +* The ApiQueryContributions class has been renamed to ApiQueryUserContribs. +* The XMPInfo, XMPReader, and XMPValidate classes have been deprecated in favor + of the namespaced classes provided by the wikimedia/xmp-reader library. +* SearchResultSet::{next,rewind} are deprecated. Calling code should + use foreach on the SearchResultSet, or the extractResults method. Extending + code should override extractResults. +* Instantiating SearchResultSet directly is deprecated. SearchEngine + implementations must subclass SearchResultSet for their purposes. +* SearchResult::setExtensionData argument has been changed from accepting an + array to accepting a Closure that returns the array when called. +* Class CryptRand, everything in MWCryptRand except generateHex() and function + MediaWikiServices::getCryptRand() are deprecated, use random_bytes() to + generate cryptographically secure random byte sequences. +* Parser::getConverterLanguage() is deprecated. Use ::getTargetLanguage() + instead. +* Language::markNoConversion() is deprecated. It confused readers because + it had unexpected behavior (only marking text if it looked like a URL) + and was only used in a single place in the code. Use + LanguageConverter::markNoConversion() instead. +* (T176526) EditPage::getContextTitle() falling back to $wgTitle when the + context title is unset is now deprecated; anything creating an EditPage + instance should set the context title via ::setContextTitle(). +* The 'jquery.hidpi' module (polyfill for IMG srcset) is deprecated. +* ResourceLoaderStartUpModule::getStartupModules() and ::getLegacyModules() + are deprecated. These concepts are obsolete and have no replacement. === Other changes in 1.32 === -* Soft hyphens (U+00AD) are now automatically removed from titles; these - characters can accidentally end up in copy-and-pasted titles. -* Strip Unicode 6.3.0 directional formatting characters (U+061C, U+2066, - U+2067, U+2068, U+2069) from the title. * … == Compatibility == diff --git a/autoload.php b/autoload.php index 9981cabe01..c53556076a 100644 --- a/autoload.php +++ b/autoload.php @@ -64,7 +64,7 @@ $wgAutoloadLocalClasses = [ 'ApiManageTags' => __DIR__ . '/includes/api/ApiManageTags.php', 'ApiMergeHistory' => __DIR__ . '/includes/api/ApiMergeHistory.php', 'ApiMessage' => __DIR__ . '/includes/api/ApiMessage.php', - 'ApiMessageTrait' => __DIR__ . '/includes/api/ApiMessage.php', + 'ApiMessageTrait' => __DIR__ . '/includes/api/ApiMessageTrait.php', 'ApiModuleManager' => __DIR__ . '/includes/api/ApiModuleManager.php', 'ApiMove' => __DIR__ . '/includes/api/ApiMove.php', 'ApiOpenSearch' => __DIR__ . '/includes/api/ApiOpenSearch.php', @@ -134,7 +134,7 @@ $wgAutoloadLocalClasses = [ 'ApiQueryUsers' => __DIR__ . '/includes/api/ApiQueryUsers.php', 'ApiQueryWatchlist' => __DIR__ . '/includes/api/ApiQueryWatchlist.php', 'ApiQueryWatchlistRaw' => __DIR__ . '/includes/api/ApiQueryWatchlistRaw.php', - 'ApiRawMessage' => __DIR__ . '/includes/api/ApiMessage.php', + 'ApiRawMessage' => __DIR__ . '/includes/api/ApiRawMessage.php', 'ApiRemoveAuthenticationData' => __DIR__ . '/includes/api/ApiRemoveAuthenticationData.php', 'ApiResetPassword' => __DIR__ . '/includes/api/ApiResetPassword.php', 'ApiResult' => __DIR__ . '/includes/api/ApiResult.php', @@ -625,7 +625,7 @@ $wgAutoloadLocalClasses = [ 'Http' => __DIR__ . '/includes/http/Http.php', 'HttpError' => __DIR__ . '/includes/exception/HttpError.php', 'HttpStatus' => __DIR__ . '/includes/libs/HttpStatus.php', - 'IApiMessage' => __DIR__ . '/includes/api/ApiMessage.php', + 'IApiMessage' => __DIR__ . '/includes/api/IApiMessage.php', 'IBufferingStatsdDataFactory' => __DIR__ . '/includes/libs/stats/IBufferingStatsdDataFactory.php', 'ICacheHelper' => __DIR__ . '/includes/cache/CacheHelper.php', 'IContextSource' => __DIR__ . '/includes/context/IContextSource.php', @@ -889,6 +889,7 @@ $wgAutoloadLocalClasses = [ 'MediaWiki\\Auth\\Throttler' => __DIR__ . '/includes/auth/Throttler.php', 'MediaWiki\\Auth\\UserDataAuthenticationRequest' => __DIR__ . '/includes/auth/UserDataAuthenticationRequest.php', 'MediaWiki\\Auth\\UsernameAuthenticationRequest' => __DIR__ . '/includes/auth/UsernameAuthenticationRequest.php', + 'MediaWiki\\DB\\PatchFileLocation' => __DIR__ . '/includes/db/PatchFileLocation.php', 'MediaWiki\\Diff\\ComplexityException' => __DIR__ . '/includes/diff/ComplexityException.php', 'MediaWiki\\Diff\\WordAccumulator' => __DIR__ . '/includes/diff/WordAccumulator.php', 'MediaWiki\\HeaderCallback' => __DIR__ . '/includes/HeaderCallback.php', @@ -896,6 +897,7 @@ $wgAutoloadLocalClasses = [ 'MediaWiki\\Interwiki\\ClassicInterwikiLookup' => __DIR__ . '/includes/interwiki/ClassicInterwikiLookup.php', 'MediaWiki\\Interwiki\\InterwikiLookup' => __DIR__ . '/includes/interwiki/InterwikiLookup.php', 'MediaWiki\\Interwiki\\InterwikiLookupAdapter' => __DIR__ . '/includes/interwiki/InterwikiLookupAdapter.php', + 'MediaWiki\\Interwiki\\NullInterwikiLookup' => __DIR__ . '/includes/interwiki/NullInterwikiLookup.php', 'MediaWiki\\Languages\\Data\\CrhExceptions' => __DIR__ . '/languages/data/CrhExceptions.php', 'MediaWiki\\Languages\\Data\\Names' => __DIR__ . '/languages/data/Names.php', 'MediaWiki\\Languages\\Data\\ZhConversion' => __DIR__ . '/languages/data/ZhConversion.php', @@ -994,6 +996,7 @@ $wgAutoloadLocalClasses = [ 'MwSql' => __DIR__ . '/maintenance/sql.php', 'MySqlLockManager' => __DIR__ . '/includes/filebackend/lockmanager/MySqlLockManager.php', 'MysqlInstaller' => __DIR__ . '/includes/installer/MysqlInstaller.php', + 'MysqlMaintenance' => __DIR__ . '/maintenance/mysql.php', 'MysqlUpdater' => __DIR__ . '/includes/installer/MysqlUpdater.php', 'NaiveForeignTitleFactory' => __DIR__ . '/includes/title/NaiveForeignTitleFactory.php', 'NaiveImportTitleFactory' => __DIR__ . '/includes/title/NaiveImportTitleFactory.php', @@ -1067,6 +1070,7 @@ $wgAutoloadLocalClasses = [ 'PageProps' => __DIR__ . '/includes/PageProps.php', 'PageQueryPage' => __DIR__ . '/includes/specialpage/PageQueryPage.php', 'Pager' => __DIR__ . '/includes/pager/Pager.php', + 'PaginatingSearchEngine' => __DIR__ . '/includes/search/PaginatingSearchEngine.php', 'ParameterizedPassword' => __DIR__ . '/includes/password/ParameterizedPassword.php', 'Parser' => __DIR__ . '/includes/parser/Parser.php', 'ParserCache' => __DIR__ . '/includes/parser/ParserCache.php', @@ -1099,7 +1103,9 @@ $wgAutoloadLocalClasses = [ 'PopulateArchiveRevId' => __DIR__ . '/maintenance/populateArchiveRevId.php', 'PopulateBacklinkNamespace' => __DIR__ . '/maintenance/populateBacklinkNamespace.php', 'PopulateCategory' => __DIR__ . '/maintenance/populateCategory.php', + 'PopulateChangeTagDef' => __DIR__ . '/maintenance/populateChangeTagDef.php', 'PopulateContentModel' => __DIR__ . '/maintenance/populateContentModel.php', + 'PopulateContentTables' => __DIR__ . '/maintenance/populateContentTables.php', 'PopulateExternallinksIndex60' => __DIR__ . '/maintenance/populateExternallinksIndex60.php', 'PopulateFilearchiveSha1' => __DIR__ . '/maintenance/populateFilearchiveSha1.php', 'PopulateImageSha1' => __DIR__ . '/maintenance/populateImageSha1.php', @@ -1227,7 +1233,6 @@ $wgAutoloadLocalClasses = [ 'ResourceLoaderOOUIFileModule' => __DIR__ . '/includes/resourceloader/ResourceLoaderOOUIFileModule.php', 'ResourceLoaderOOUIImageModule' => __DIR__ . '/includes/resourceloader/ResourceLoaderOOUIImageModule.php', 'ResourceLoaderOOUIModule' => __DIR__ . '/includes/resourceloader/ResourceLoaderOOUIModule.php', - 'ResourceLoaderRawFileModule' => __DIR__ . '/includes/resourceloader/ResourceLoaderRawFileModule.php', 'ResourceLoaderSiteModule' => __DIR__ . '/includes/resourceloader/ResourceLoaderSiteModule.php', 'ResourceLoaderSiteStylesModule' => __DIR__ . '/includes/resourceloader/ResourceLoaderSiteStylesModule.php', 'ResourceLoaderSkinModule' => __DIR__ . '/includes/resourceloader/ResourceLoaderSkinModule.php', @@ -1278,7 +1283,6 @@ $wgAutoloadLocalClasses = [ 'SVGReader' => __DIR__ . '/includes/media/SVGMetadataExtractor.php', 'SamplingStatsdClient' => __DIR__ . '/includes/libs/stats/SamplingStatsdClient.php', 'Sanitizer' => __DIR__ . '/includes/parser/Sanitizer.php', - 'ScopedCallback' => __DIR__ . '/includes/compat/ScopedCallback.php', 'ScopedLock' => __DIR__ . '/includes/libs/lockmanager/ScopedLock.php', 'SearchApi' => __DIR__ . '/includes/api/SearchApi.php', 'SearchDatabase' => __DIR__ . '/includes/search/SearchDatabase.php', @@ -1537,7 +1541,7 @@ $wgAutoloadLocalClasses = [ 'UploadStashWrongOwnerException' => __DIR__ . '/includes/upload/UploadStash.php', 'UploadStashZeroLengthFileException' => __DIR__ . '/includes/upload/UploadStash.php', 'UppercaseCollation' => __DIR__ . '/includes/collation/UppercaseCollation.php', - 'UsageException' => __DIR__ . '/includes/api/ApiUsageException.php', + 'UsageException' => __DIR__ . '/includes/api/UsageException.php', 'User' => __DIR__ . '/includes/user/User.php', 'UserArray' => __DIR__ . '/includes/user/UserArray.php', 'UserArrayFromResult' => __DIR__ . '/includes/user/UserArrayFromResult.php', @@ -1680,9 +1684,9 @@ $wgAutoloadLocalClasses = [ 'WrapOldPasswords' => __DIR__ . '/maintenance/wrapOldPasswords.php', 'XCFHandler' => __DIR__ . '/includes/media/XCF.php', 'XMLRCFeedFormatter' => __DIR__ . '/includes/rcfeed/XMLRCFeedFormatter.php', - 'XMPInfo' => __DIR__ . '/includes/libs/xmp/XMPInfo.php', - 'XMPReader' => __DIR__ . '/includes/libs/xmp/XMP.php', - 'XMPValidate' => __DIR__ . '/includes/libs/xmp/XMPValidate.php', + 'XMPInfo' => __DIR__ . '/includes/compat/XMPReader.php', + 'XMPReader' => __DIR__ . '/includes/compat/XMPReader.php', + 'XMPValidate' => __DIR__ . '/includes/compat/XMPReader.php', 'Xhprof' => __DIR__ . '/includes/libs/Xhprof.php', 'XhprofData' => __DIR__ . '/includes/libs/XhprofData.php', 'Xml' => __DIR__ . '/includes/Xml.php', diff --git a/composer.json b/composer.json index ce137d1971..ec9ff36835 100644 --- a/composer.json +++ b/composer.json @@ -25,7 +25,7 @@ "ext-mbstring": "*", "ext-xml": "*", "liuggio/statsd-php-client": "1.0.18", - "oojs/oojs-ui": "0.27.0", + "oojs/oojs-ui": "0.27.4", "oyejorge/less.php": "1.7.0.14", "pear/mail": "1.4.1", "pear/mail_mime": "1.10.2", @@ -46,11 +46,12 @@ "wikimedia/relpath": "2.1.1", "wikimedia/remex-html": "1.0.3", "wikimedia/running-stat": "1.2.1", - "wikimedia/scoped-callback": "1.0.0", + "wikimedia/scoped-callback": "2.0.0", "wikimedia/utfnormal": "2.0.0", "wikimedia/timestamp": "1.0.0", "wikimedia/wait-condition-loop": "1.0.1", - "wikimedia/wrappedstring": "3.0.0", + "wikimedia/wrappedstring": "3.0.1", + "wikimedia/xmp-reader": "0.5.1", "zordius/lightncandy": "0.23" }, "require-dev": { @@ -59,12 +60,12 @@ "jakub-onderka/php-parallel-lint": "0.9.2", "jetbrains/phpstorm-stubs": "dev-master#1b9906084d6635456fcf3f3a01f0d7d5b99a578a", "justinrainbow/json-schema": "~5.2", - "mediawiki/mediawiki-codesniffer": "18.0.0", + "mediawiki/mediawiki-codesniffer": "20.0.0", "monolog/monolog": "~1.22.1", "nikic/php-parser": "3.1.3", "nmred/kafka-php": "0.1.5", "phpunit/phpunit": "4.8.36 || ^6.5", - "psy/psysh": "0.8.11", + "psy/psysh": "0.9.6", "wikimedia/avro": "1.8.0", "wikimedia/testing-access-wrapper": "~1.0", "wmde/hamcrest-html-matchers": "^0.1.0" diff --git a/docs/extension.schema.v1.json b/docs/extension.schema.v1.json index bcfd2aa3d5..e7e09750e4 100644 --- a/docs/extension.schema.v1.json +++ b/docs/extension.schema.v1.json @@ -285,6 +285,9 @@ "class": { "enum": ["ResourceLoaderImageModule"] }, + "defaultColor": { + "type": "string" + }, "data": { "type": "string" }, diff --git a/docs/extension.schema.v2.json b/docs/extension.schema.v2.json index 31edbd09dd..24bfb63f82 100644 --- a/docs/extension.schema.v2.json +++ b/docs/extension.schema.v2.json @@ -288,6 +288,9 @@ "class": { "enum": ["ResourceLoaderImageModule"] }, + "defaultColor": { + "type": "string" + }, "data": { "type": "string" }, diff --git a/docs/globals.txt b/docs/globals.txt index 5bdb31c15c..be887a65d8 100644 --- a/docs/globals.txt +++ b/docs/globals.txt @@ -63,5 +63,5 @@ $wgParser $wgRequest WebRequest object, to get request data -$wgMemc, $messageMemc, $parserMemc +$wgMemc, $messageMemc Object caches diff --git a/docs/hooks.txt b/docs/hooks.txt index 349cd4b5e6..708456c926 100644 --- a/docs/hooks.txt +++ b/docs/hooks.txt @@ -74,10 +74,10 @@ Using a hook-running strategy, we can avoid having all this option-specific stuff in our mainline code. Using hooks, the function becomes: function showAnArticle( $article ) { - if ( Hooks::run( 'ArticleShow', array( &$article ) ) ) { + if ( Hooks::run( 'ArticleShow', [ &$article ] ) ) { # code to actually show the article goes here - Hooks::run( 'ArticleShowComplete', array( &$article ) ); + Hooks::run( 'ArticleShowComplete', [ &$article ] ); } } @@ -137,13 +137,13 @@ Hooks are registered by adding them to the global $wgHooks array for a given event. All the following are valid ways to define hooks: $wgHooks['EventName'][] = 'someFunction'; # function, no data - $wgHooks['EventName'][] = array( 'someFunction', $someData ); - $wgHooks['EventName'][] = array( 'someFunction' ); # weird, but OK + $wgHooks['EventName'][] = [ 'someFunction', $someData ]; + $wgHooks['EventName'][] = [ 'someFunction' ]; # weird, but OK $wgHooks['EventName'][] = $object; # object only - $wgHooks['EventName'][] = array( $object, 'someMethod' ); - $wgHooks['EventName'][] = array( $object, 'someMethod', $someData ); - $wgHooks['EventName'][] = array( $object ); # weird but OK + $wgHooks['EventName'][] = [ $object, 'someMethod' ]; + $wgHooks['EventName'][] = [ $object, 'someMethod', $someData ]; + $wgHooks['EventName'][] = [ $object ]; # weird but OK When an event occurs, the function (or object method) will be called with the optional data provided as well as event-specific parameters. The above examples @@ -168,8 +168,8 @@ different: 'onArticleSave', 'onUserLogin', etc. The extra data is useful if we want to use the same function or object for different purposes. For example: - $wgHooks['PageContentSaveComplete'][] = array( 'ircNotify', 'TimStarling' ); - $wgHooks['PageContentSaveComplete'][] = array( 'ircNotify', 'brion' ); + $wgHooks['PageContentSaveComplete'][] = [ 'ircNotify', 'TimStarling' ]; + $wgHooks['PageContentSaveComplete'][] = [ 'ircNotify', 'brion' ]; This code would result in ircNotify being run twice when an article is saved: once for 'TimStarling', and once for 'brion'. @@ -187,7 +187,7 @@ The last result would be for cases where the hook function replaces the main functionality. For example, if you wanted to authenticate users to a custom system (LDAP, another PHP program, whatever), you could do: - $wgHooks['UserLogin'][] = array( 'ldapLogin', $ldapServer ); + $wgHooks['UserLogin'][] = [ 'ldapLogin', $ldapServer ]; function ldapLogin( $username, $password ) { # log user into LDAP @@ -232,7 +232,7 @@ wfRunHooks must be used, which was deprecated in MediaWiki 1.25. Note that hook parameters are passed in an array; this is a necessary inconvenience to make it possible to pass reference values (that can be changed) into the hook code. Also note that earlier versions of wfRunHooks took a -variable number of arguments; the array() calling protocol came about after +variable number of arguments; the array calling protocol came about after MediaWiki 1.4rc1. ==Events and parameters== @@ -240,8 +240,8 @@ MediaWiki 1.4rc1. This is a list of known events and parameters; please add to it if you're going to add events to the MediaWiki code. -'AbortAutoAccount': DEPRECATED! Create a PreAuthenticationProvider instead. -Return false to cancel automated local account creation, where normally +'AbortAutoAccount': DEPRECATED since 1.27! Create a PreAuthenticationProvider +instead. Return false to cancel automated local account creation, where normally authentication against an external auth plugin would be creating a local account. $user: the User object about to be created (read-only, incomplete) @@ -259,7 +259,7 @@ $editor: The User who made the change. $title: The Title of the page that was edited. $rc: The current RecentChange object. -'AbortLogin': DEPRECATED! Create a PreAuthenticationProvider instead. +'AbortLogin': DEPRECATED since 1.27! Create a PreAuthenticationProvider instead. Return false to cancel account login. $user: the User object being authenticated against $password: the password being submitted, not yet checked for validity @@ -269,8 +269,8 @@ $password: the password being submitted, not yet checked for validity &$msg: the message identifier for abort reason (new in 1.18, not available before 1.18) -'AbortNewAccount': DEPRECATED! Create a PreAuthenticationProvider instead. -Return false to cancel explicit account creation. +'AbortNewAccount': DEPRECATED since 1.27! Create a PreAuthenticationProvider +instead. Return false to cancel explicit account creation. $user: the User object about to be created (read-only, incomplete) &$msg: out parameter: HTML to display on abort &$status: out parameter: Status object to return, replaces the older $msg param @@ -294,14 +294,14 @@ $name: name of the action &$fields: HTMLForm descriptor array $article: Article object -'AddNewAccount': DEPRECATED! Use LocalUserCreated. +'AddNewAccount': DEPRECATED since 1.27! Use LocalUserCreated. After a user account is created. $user: the User object that was created. (Parameter added in 1.7) $byEmail: true when account was created "by email" (added in 1.12) -'AfterBuildFeedLinks': Executed in OutputPage.php after all feed links (atom, rss,...) -are created. Can be used to omit specific feeds from being outputted. You must not use -this hook to add feeds, use OutputPage::addFeedLink() instead. +'AfterBuildFeedLinks': Executed in OutputPage.php after all feed links (atom, +rss,...) are created. Can be used to omit specific feeds from being outputted. +You must not use this hook to add feeds, use OutputPage::addFeedLink() instead. &$feedLinks: Array of created feed links 'AfterFinalPageOutput': Nearly at the end of OutputPage::output() but @@ -372,7 +372,7 @@ from ApiBase::addDeprecation(). &$msgs: Message[] Messages to include in the help. Multiple messages will be joined with spaces. -'APIEditBeforeSave': DEPRECATED! Use EditFilterMergedContent instead. +'APIEditBeforeSave': DEPRECATED since 1.28! Use EditFilterMergedContent instead. Before saving a page with api.php?action=edit, after processing request parameters. Return false to let the request fail, returning an error message or an tag if $resultArr was filled. @@ -409,8 +409,8 @@ $format: API format code for $text. &$params: Array of parameters $flags: int zero or OR-ed flags like ApiBase::GET_VALUES_FOR_HELP -'APIGetDescription': DEPRECATED! Use APIGetDescriptionMessages instead. -Use this hook to modify a module's description. +'APIGetDescription': DEPRECATED since 1.25! Use APIGetDescriptionMessages +instead. Use this hook to modify a module's description. &$module: ApiBase Module object &$desc: String description, or array of description strings @@ -418,8 +418,8 @@ Use this hook to modify a module's description. $module: ApiBase Module object &$msg: Array of Message objects -'APIGetParamDescription': DEPRECATED! Use APIGetParamDescriptionMessages -instead. +'APIGetParamDescription': DEPRECATED since 1.25! Use +APIGetParamDescriptionMessages instead. Use this hook to modify a module's parameter descriptions. &$module: ApiBase Module object &$desc: Array of parameter descriptions @@ -488,8 +488,8 @@ documentation. $module: ApiQueryBase module in question $result: ResultWrapper|bool returned from the IDatabase::select() &$hookData: array that was passed to the 'ApiQueryBaseBeforeQuery' hook and - will be passed to the 'ApiQueryBaseProcessRow' hook, intended for inter-hook - communication. + will be passed to the 'ApiQueryBaseProcessRow' hook, intended for inter-hook + communication. 'ApiQueryBaseBeforeQuery': Called for (some) API query modules before a database query is made. WARNING: It would be very easy to misuse this hook and @@ -504,7 +504,7 @@ $module: ApiQueryBase module in question &$query_options: array of options for the database request &$join_conds: join conditions for the tables &$hookData: array that will be passed to the 'ApiQueryBaseAfterQuery' and - 'ApiQueryBaseProcessRow' hooks, intended for inter-hook communication. + 'ApiQueryBaseProcessRow' hooks, intended for inter-hook communication. 'ApiQueryBaseProcessRow': Called for (some) API query modules as each row of the database result is processed. Return false to stop processing the result @@ -514,26 +514,26 @@ $module: ApiQueryBase module in question $row: stdClass Database result row &$data: array to be included in the ApiResult. &$hookData: array that was be passed to the 'ApiQueryBaseBeforeQuery' and - 'ApiQueryBaseAfterQuery' hooks, intended for inter-hook communication. + 'ApiQueryBaseAfterQuery' hooks, intended for inter-hook communication. 'APIQueryGeneratorAfterExecute': After calling the executeGenerator() method of an action=query submodule. Use this to extend core API modules. &$module: Module object &$resultPageSet: ApiPageSet object -'APIQueryInfoTokens': DEPRECATED! Use ApiQueryTokensRegisterTypes instead. -Use this hook to add custom tokens to prop=info. Every token has an action, -which will be used in the intoken parameter and in the output +'APIQueryInfoTokens': DEPRECATED since 1.24! Use ApiQueryTokensRegisterTypes +instead. Use this hook to add custom tokens to prop=info. Every token has an +action, which will be used in the intoken parameter and in the output (actiontoken="..."), and a callback function which should return the token, or false if the user isn't allowed to obtain it. The prototype of the callback function is func($pageid, $title), where $pageid is the page ID of the page the token is requested for and $title is the associated Title object. In the hook, just add your callback to the $tokenFunctions array and return true (returning false makes no sense). -&$tokenFunctions: array(action => callback) +&$tokenFunctions: [ action => callback ] -'APIQueryRecentChangesTokens': DEPRECATED! Use ApiQueryTokensRegisterTypes -instead. +'APIQueryRecentChangesTokens': DEPRECATED since 1.24! Use +ApiQueryTokensRegisterTypes instead. Use this hook to add custom tokens to list=recentchanges. Every token has an action, which will be used in the rctoken parameter and in the output (actiontoken="..."), and a callback function which should return the token, or @@ -543,9 +543,10 @@ page associated to the revision the token is requested for, $title the associated Title object and $rc the associated RecentChange object. In the hook, just add your callback to the $tokenFunctions array and return true (returning false makes no sense). -&$tokenFunctions: array(action => callback) +&$tokenFunctions: [ action => callback ] -'APIQueryRevisionsTokens': DEPRECATED! Use ApiQueryTokensRegisterTypes instead. +'APIQueryRevisionsTokens': DEPRECATED since 1.24! Use +ApiQueryTokensRegisterTypes instead. Use this hook to add custom tokens to prop=revisions. Every token has an action, which will be used in the rvtoken parameter and in the output (actiontoken="..."), and a callback function which should return the token, or @@ -555,7 +556,7 @@ page associated to the revision the token is requested for, $title the associated Title object and $rev the associated Revision object. In the hook, just add your callback to the $tokenFunctions array and return true (returning false makes no sense). -&$tokenFunctions: array(action => callback) +&$tokenFunctions: [ action => callback ] 'APIQuerySiteInfoGeneralInfo': Use this hook to add extra information to the sites general information. @@ -569,10 +570,11 @@ sites statistics information. 'ApiQueryTokensRegisterTypes': Use this hook to add additional token types to action=query&meta=tokens. Note that most modules will probably be able to use the 'csrf' token instead of creating their own token types. -&$salts: array( type => salt to pass to User::getEditToken() or array of salt - and key to pass to Session::getToken() ) +&$salts: [ type => salt to pass to User::getEditToken(), or array of salt + and key to pass to Session::getToken() ] -'APIQueryUsersTokens': DEPRECATED! Use ApiQueryTokensRegisterTypes instead. +'APIQueryUsersTokens': DEPRECATED since 1.24! Use ApiQueryTokensRegisterTypes +instead. Use this hook to add custom token to list=users. Every token has an action, which will be used in the ustoken parameter and in the output (actiontoken="..."), and a callback function which should return the token, or @@ -580,7 +582,7 @@ false if the user isn't allowed to obtain it. The prototype of the callback function is func($user) where $user is the User object. In the hook, just add your callback to the $tokenFunctions array and return true (returning false makes no sense). -&$tokenFunctions: array(action => callback) +&$tokenFunctions: [ action => callback ] 'ApiQueryWatchlistExtractOutputData': Extract row data for ApiQueryWatchlist. $module: ApiQueryWatchlist instance @@ -600,7 +602,7 @@ key for the array that represents the service data. In this data array, the key-value-pair identified by the apiLink key is required. &$apis: array of services -'ApiTokensGetTokenTypes': DEPRECATED! Use ApiQueryTokensRegisterTypes instead. +'ApiTokensGetTokenTypes': DEPRECATED since 1.24! Use ApiQueryTokensRegisterTypes instead. Use this hook to extend action=tokens with new token types. &$tokenTypes: supported token types in format 'type' => callback function used to retrieve this type of tokens. @@ -778,7 +780,8 @@ redirect was followed. from a set of AuthenticationRequest classes into a form descriptor; hooks can tweak the array to change how login etc. forms should look. $requests: array of AuthenticationRequests the fields are created from -$fieldInfo: field information array (union of all AuthenticationRequest::getFieldInfo() responses). +$fieldInfo: field information array (union of all + AuthenticationRequest::getFieldInfo() responses). &$formDescriptor: HTMLForm descriptor. The special key 'weight' can be set to change the order of the fields. $action: one of the AuthManager::ACTION_* constants. @@ -786,20 +789,21 @@ $action: one of the AuthManager::ACTION_* constants. 'AuthManagerLoginAuthenticateAudit': A login attempt either succeeded or failed for a reason other than misconfiguration or session loss. No return data is accepted; this hook is for auditing only. -$response: The MediaWiki\Auth\AuthenticationResponse in either a PASS or FAIL state. +$response: The MediaWiki\Auth\AuthenticationResponse in either a PASS or FAIL + state. $user: The User object being authenticated against, or null if authentication failed before getting that far. $username: A guess at the user name being authenticated, or null if we can't even determine that. -'AuthPluginAutoCreate': DEPRECATED! Use the 'LocalUserCreated' hook instead. -Called when creating a local account for an user logged in from an external -authentication method. +'AuthPluginAutoCreate': DEPRECATED since 1.27! Use the 'LocalUserCreated' hook +instead. Called when creating a local account for an user logged in from an +external authentication method. $user: User object created locally -'AuthPluginSetup': DEPRECATED! Extensions should be updated to use AuthManager. -Update or replace authentication plugin object ($wgAuth). Gives a chance for an -extension to set it programmatically to a variable class. +'AuthPluginSetup': DEPRECATED since 1.27! Extensions should be updated to use +AuthManager. Update or replace authentication plugin object ($wgAuth). Gives a +chance for an extension to set it programmatically to a variable class. &$auth: the $wgAuth object, probably a stub 'AutopromoteCondition': Check autopromote condition for user. @@ -972,9 +976,9 @@ No return data is accepted; this hook is for auditing only. $req: AuthenticationRequest object describing the change (and target user) $status: StatusValue with the result of the action -'ChangePasswordForm': DEPRECATED! Use AuthChangeFormFields or security levels. -For extensions that need to add a field to the ChangePassword form via the -Preferences form. +'ChangePasswordForm': DEPRECATED since 1.27! Use AuthChangeFormFields or +security levels. For extensions that need to add a field to the ChangePassword +form via the Preferences form. &$extraFields: An array of arrays that hold fields like would be passed to the pretty function. @@ -991,8 +995,8 @@ $rows: The data that will be rendered. May be a ResultWrapper instance or $unpatrolled: Whether or not we are showing unpatrolled changes. $watched: Whether or not the change is watched by the user. -'ChangesListSpecialPageFilters': DEPRECATED! Use 'ChangesListSpecialPageStructuredFilters' -instead. +'ChangesListSpecialPageFilters': DEPRECATED since 1.29! Use +'ChangesListSpecialPageStructuredFilters' instead. Called after building form options on pages inheriting from ChangesListSpecialPage (in core: RecentChanges, RecentChangesLinked and Watchlist). @@ -1075,8 +1079,9 @@ $rc_id: recentchanges table id $rev_id: revision table id $log_id: logging table id $params: tag params -$rc: RecentChange being tagged when the tagging accompanies the action or null -$user: User who performed the tagging when the tagging is subsequent to the action or null +$rc: RecentChange being tagged when the tagging accompanies the action, or null +$user: User who performed the tagging when the tagging is subsequent to the + action, or null 'ChangeTagsAllowedAdd': Called when checking if a user can add tags to a change. &$allowedTags: List of all the tags the user is allowed to add. Any tags the @@ -1186,16 +1191,16 @@ $lossy: boolean indicating whether lossy conversion is allowed. converted Content object. Note that $result->getContentModel() must return $toModel. -'ContentSecurityPolicyDefaultSource': Modify the allowed CSP load sources. This affects all -directives except for the script directive. If you want to add a script -source, see ContentSecurityPolicyScriptSource hook. +'ContentSecurityPolicyDefaultSource': Modify the allowed CSP load sources. This +affects all directives except for the script directive. If you want to add a +script source, see ContentSecurityPolicyScriptSource hook. &$defaultSrc: Array of Content-Security-Policy allowed sources $policyConfig: Current configuration for the Content-Security-Policy header -$mode: ContentSecurityPolicy::REPORT_ONLY_MODE or ContentSecurityPolicy::FULL_MODE - depending on type of header +$mode: ContentSecurityPolicy::REPORT_ONLY_MODE or + ContentSecurityPolicy::FULL_MODE depending on type of header -'ContentSecurityPolicyDirectives': Modify the content security policy directives. -Use this only if ContentSecurityPolicyDefaultSource and +'ContentSecurityPolicyDirectives': Modify the content security policy +directives. Use this only if ContentSecurityPolicyDefaultSource and ContentSecurityPolicyScriptSource do not meet your needs. &$directives: Array of CSP directives $policyConfig: Current configuration for the CSP header @@ -1208,8 +1213,8 @@ want non-script sources to be loaded from whatever you add. &$scriptSrc: Array of CSP directives $policyConfig: Current configuration for the CSP header -$mode: ContentSecurityPolicy::REPORT_ONLY_MODE or ContentSecurityPolicy::FULL_MODE - depending on type of header +$mode: ContentSecurityPolicy::REPORT_ONLY_MODE or + ContentSecurityPolicy::FULL_MODE depending on type of header 'CustomEditor': When invoking the page editor Return true to allow the normal editor to be used, or false if implementing @@ -1240,12 +1245,15 @@ $row: the DB row for this line Currently only data attributes reserved to MediaWiki are allowed (see Sanitizer::isReservedDataAttribute). -'DeleteUnknownPreferences': Called by the cleanupPreferences.php maintenance script to build a WHERE clause with which -to delete preferences that are not known about. This hook is used by extensions that have dynamically-named preferences -that should not be deleted in the usual cleanup process. For example, the Gadgets extension creates preferences prefixed -with 'gadget-', and so anything with that prefix is excluded from the deletion. -&where: An array that will be passed as the $cond parameter to IDatabase::select() to determine what will be deleted - from the user_properties table. +'DeleteUnknownPreferences': Called by the cleanupPreferences.php maintenance +script to build a WHERE clause with which to delete preferences that are not +known about. This hook is used by extensions that have dynamically-named +preferences that should not be deleted in the usual cleanup process. For +example, the Gadgets extension creates preferences prefixed with 'gadget-', and +so anything with that prefix is excluded from the deletion. +&where: An array that will be passed as the $cond parameter to + IDatabase::select() to determine what will be deleted from the user_properties + table. $db: The IDatabase object, useful for accessing $db->buildLike() etc. 'DifferenceEngineAfterLoadNewText': called in DifferenceEngine::loadNewText() @@ -1260,82 +1268,88 @@ checking if the variable's value is null. This hook can be used to inject content into said class member variable. $differenceEngine: DifferenceEngine object -'DifferenceEngineMarkPatrolledLink': Allows extensions to change the "mark as patrolled" link -which is shown both on the diff header as well as on the bottom of a page, usually -wrapped in a span element which has class="patrollink". +'DifferenceEngineMarkPatrolledLink': Allows extensions to change the "mark as +patrolled" link which is shown both on the diff header as well as on the bottom +of a page, usually wrapped in a span element which has class="patrollink". $differenceEngine: DifferenceEngine object &$markAsPatrolledLink: The "mark as patrolled" link HTML (string) $rcid: Recent change ID (rc_id) for this change (int) -'DifferenceEngineMarkPatrolledRCID': Allows extensions to possibly change the rcid parameter. -For example the rcid might be set to zero due to the user being the same as the -performer of the change but an extension might still want to show it under certain -conditions. +'DifferenceEngineMarkPatrolledRCID': Allows extensions to possibly change the +rcid parameter. For example the rcid might be set to zero due to the user being +the same as the performer of the change but an extension might still want to +show it under certain conditions. &$rcid: rc_id (int) of the change or 0 $differenceEngine: DifferenceEngine object $change: RecentChange object $user: User object representing the current user -'DifferenceEngineNewHeader': Allows extensions to change the $newHeader variable, which -contains information about the new revision, such as the revision's author, whether -the revision was marked as a minor edit or not, etc. +'DifferenceEngineNewHeader': Allows extensions to change the $newHeader +variable, which contains information about the new revision, such as the +revision's author, whether the revision was marked as a minor edit or not, etc. $differenceEngine: DifferenceEngine object &$newHeader: The string containing the various #mw-diff-otitle[1-5] divs, which -include things like revision author info, revision comment, RevisionDelete link and more + include things like revision author info, revision comment, RevisionDelete + link and more $formattedRevisionTools: Array containing revision tools, some of which may have -been injected with the DiffRevisionTools hook -$nextlink: String containing the link to the next revision (if any); also included in $newHeader -$rollback: Rollback link (string) to roll this revision back to the previous one, if any + been injected with the DiffRevisionTools hook +$nextlink: String containing the link to the next revision (if any); also + included in $newHeader +$rollback: Rollback link (string) to roll this revision back to the previous + one, if any $newminor: String indicating if the new revision was marked as a minor edit $diffOnly: Boolean parameter passed to DifferenceEngine#showDiffPage, indicating -whether we should show just the diff; passed in as a query string parameter to the -various URLs constructed here (i.e. $nextlink) + whether we should show just the diff; passed in as a query string parameter to + the various URLs constructed here (i.e. $nextlink) $rdel: RevisionDelete link for the new revision, if the current user is allowed -to use the RevisionDelete feature + to use the RevisionDelete feature $unhide: Boolean parameter indicating whether to show RevisionDeleted revisions -'DifferenceEngineOldHeader': Allows extensions to change the $oldHeader variable, which -contains information about the old revision, such as the revision's author, whether -the revision was marked as a minor edit or not, etc. +'DifferenceEngineOldHeader': Allows extensions to change the $oldHeader +variable, which contains information about the old revision, such as the +revision's author, whether the revision was marked as a minor edit or not, etc. $differenceEngine: DifferenceEngine object &$oldHeader: The string containing the various #mw-diff-otitle[1-5] divs, which -include things like revision author info, revision comment, RevisionDelete link and more -$prevlink: String containing the link to the previous revision (if any); also included in $oldHeader + include things like revision author info, revision comment, RevisionDelete + link and more +$prevlink: String containing the link to the previous revision (if any); also + included in $oldHeader $oldminor: String indicating if the old revision was marked as a minor edit $diffOnly: Boolean parameter passed to DifferenceEngine#showDiffPage, indicating -whether we should show just the diff; passed in as a query string parameter to the -various URLs constructed here (i.e. $prevlink) + whether we should show just the diff; passed in as a query string parameter to + the various URLs constructed here (i.e. $prevlink) $ldel: RevisionDelete link for the old revision, if the current user is allowed -to use the RevisionDelete feature + to use the RevisionDelete feature $unhide: Boolean parameter indicating whether to show RevisionDeleted revisions -'DifferenceEngineOldHeaderNoOldRev': Change the $oldHeader variable in cases when -there is no old revision +'DifferenceEngineOldHeaderNoOldRev': Change the $oldHeader variable in cases +when there is no old revision &$oldHeader: empty string by default -'DifferenceEngineRenderRevisionAddParserOutput': Allows extensions to change the parser output. -Return false to not add parser output via OutputPage's addParserOutput method. +'DifferenceEngineRenderRevisionAddParserOutput': Allows extensions to change the +parser output. Return false to not add parser output via OutputPage's +addParserOutput method. $differenceEngine: DifferenceEngine object $out: OutputPage object $parserOutput: ParserOutput object $wikiPage: WikiPage object -'DifferenceEngineRenderRevisionShowFinalPatrolLink': An extension can hook into this hook -point and return false to not show the final "mark as patrolled" link on the bottom -of a page. +'DifferenceEngineRenderRevisionShowFinalPatrolLink': An extension can hook into +this hook point and return false to not show the final "mark as patrolled" link +on the bottom of a page. This hook has no arguments. 'DifferenceEngineShowDiff': Allows extensions to affect the diff text which eventually gets sent to the OutputPage object. $differenceEngine: DifferenceEngine object -'DifferenceEngineShowEmptyOldContent': Allows extensions to change the diff table -body (without header) in cases when there is no old revision or the old and new -revisions are identical. +'DifferenceEngineShowEmptyOldContent': Allows extensions to change the diff +table body (without header) in cases when there is no old revision or the old +and new revisions are identical. $differenceEngine: DifferenceEngine object -'DifferenceEngineShowDiffPage': Add additional output via the available OutputPage -object into the diff view +'DifferenceEngineShowDiffPage': Add additional output via the available +OutputPage object into the diff view $out: OutputPage object 'DifferenceEngineShowDiffPageMaybeShowMissingRevision': called in @@ -1361,7 +1375,7 @@ an article &$article: article (object) being viewed &$oldid: oldid (int) being viewed -'DoEditSectionLink': DEPRECATED! Use SkinEditSectionLinks instead. +'DoEditSectionLink': DEPRECATED since 1.25! Use SkinEditSectionLinks instead. Override the HTML generated for section edit links $skin: Skin object rendering the UI $title: Title object for the title being linked to (may not be the same as @@ -1381,7 +1395,6 @@ $section: Section being edited &$error: Error message to return $summary: Edit summary for page - 'EditFilterMergedContent': Post-section-merge edit filter. This may be triggered by the EditPage or any other facility that modifies page content. Use the $status object to indicate whether the edit should be allowed, @@ -1389,7 +1402,7 @@ and to provide a reason for disallowing it. Return false to abort the edit, and true to continue. Returning true if $status->isOK() returns false means "don't save but continue user interaction", e.g. show the edit form. $status->apiHookResult can be set to an array to be returned by api.php -action=edit. This is used to deliver captchas. + action=edit. This is used to deliver captchas. $context: object implementing the IContextSource interface. $content: content of the edit box, as a Content object. $status: Status object to represent errors, etc. @@ -1417,9 +1430,9 @@ $resultDetails: Result details array 'EditPage::importFormData': allow extensions to read additional data posted in the form +Return value is ignored (should always return true) $editpage: EditPage instance $request: Webrequest -return value is ignored (should always return true) 'EditPage::showEditForm:fields': allows injection of form field into edit form Return value is ignored (should always return true) @@ -1461,18 +1474,11 @@ textarea in the edit form. &$buttons: Array of edit buttons "Save", "Preview", "Live", and "Diff" &$tabindex: HTML tabindex of the last edit check/button -'EditPageBeforeEditChecks': DEPRECATED! Use 'EditPageGetCheckboxesDefinition' instead, -or 'EditPage::showStandardInputs:options' if you don't actually care about checkboxes -and just want to add some HTML to the page. -Allows modifying the edit checks below the textarea in the edit form. -&$editpage: The current EditPage object -&$checks: Array of the HTML for edit checks like "watch this page"/"minor edit" -&$tabindex: HTML tabindex of the last edit check/button - 'EditPageBeforeEditToolbar': Allows modifying the edit toolbar above the textarea in the edit form. +Hook subscribers can return false to avoid the default toolbar code being +loaded. &$toolbar: The toolbar HTML -Hook subscribers can return false to avoid the default toolbar code being loaded. 'EditPageCopyrightWarning': Allow for site and per-namespace customization of contribution/copyright notice. @@ -1483,8 +1489,8 @@ $title: title of page being edited 'EditPageGetCheckboxesDefinition': Allows modifying the edit checkboxes below the textarea in the edit form. $editpage: The current EditPage object -&$checkboxes: Array of checkbox definitions. See EditPage::getCheckboxesDefinition() -for the format. +&$checkboxes: Array of checkbox definitions. See + EditPage::getCheckboxesDefinition() for the format. 'EditPageGetDiffContent': Allow modifying the wikitext that will be used in "Show changes". Note that it is preferable to implement diff handling for @@ -1520,7 +1526,8 @@ true to allow those checks to occur, and false if checking is done. &$from: MailAddress object of sending user &$subject: subject of the mail &$text: text of the mail -&$error: Out-param for an error. Should be set to a Status object or boolean false. +&$error: Out-param for an error. Should be set to a Status object or boolean + false. 'EmailUserCC': Before sending the copy of the email to the author. &$to: MailAddress object of receiving user @@ -1555,7 +1562,8 @@ $block: The RecentChanges objects in that block a grouped recent change inner line in EnhancedChangesList. Hook subscribers can return false to omit this line from recentchanges. $changesList: EnhancedChangesList object -&$data: An array with all the components that will be joined in order to create the line +&$data: An array with all the components that will be joined in order to create + the line $block: An array of RecentChange objects in that block $rc: The RecentChange object for this line &$classes: An array of classes to change @@ -1566,7 +1574,8 @@ $rc: The RecentChange object for this line 'EnhancedChangesListModifyBlockLineData': to alter data used to build a non-grouped recent change line in EnhancedChangesList. $changesList: EnhancedChangesList object -&$data: An array with all the components that will be joined in order to create the line +&$data: An array with all the components that will be joined in order to create + the line $rc: The RecentChange object for this line 'ExemptFromAccountCreationThrottle': Exemption from the account creation @@ -1672,10 +1681,10 @@ underscore) magic words. Called by MagicWord. 'GetExtendedMetadata': Get extended file metadata for the API &$combinedMeta: Array of the form: - 'MetadataPropName' => array( + 'MetadataPropName' => [ value' => prop value, 'source' => 'name of hook' - ). + ]. $file: File object of file in question $context: RequestContext (including language to use) $single: Only extract the current language; if false, the prop value should @@ -1773,7 +1782,7 @@ $lang: Language that will be used to render the timestamp 'getUserPermissionsErrors': Add a permissions error when permissions errors are checked for. Use instead of userCan for most cases. Return false if the user can't do it, and populate $result with the reason in the form of -array( messagename, param1, param2, ... ) or a MessageSpecifier instance (you +[ messagename, param1, param2, ... ] or a MessageSpecifier instance (you might want to use ApiMessage to provide machine-readable details for the API). For consistency, error messages should be plain text with no special coloring, bolding, etc. to show that @@ -1787,12 +1796,12 @@ $action: Action being checked 'getUserPermissionsErrorsExpensive': Equal to getUserPermissionsErrors, but is called only if expensive checks are enabled. Add a permissions error when permissions errors are checked for. Return false if the user can't do it, and -populate $result with the reason in the form of array( messagename, param1, -param2, ... ) or a MessageSpecifier instance (you might want to use ApiMessage -to provide machine-readable details for the API). For consistency, error -messages should be plain text with no -special coloring, bolding, etc. to show that they're errors; presenting them -properly to the user as errors is done by the caller. +populate $result with the reason in the form of [ messagename, param1, param2, +... ] or a MessageSpecifier instance (you might want to use ApiMessage to +provide machine-readable details for the API). For consistency, error messages +should be plain text with no special coloring, bolding, etc. to show that +they're errors; presenting them properly to the user as errors is done by the +caller. &$title: Title object being checked against &$user: Current user object $action: Action being checked @@ -1826,6 +1835,9 @@ just modify a few things using call-by-reference. includes/Linker.php for Linker::makeImageLink &$time: Timestamp of file in 'YYYYMMDDHHIISS' string form, or false for current &$res: Final HTML output, used if you return false +$parser: Parser instance +&$query: Query params for desc URL +&$widthOption: Used by the parser to remember the user preference thumbnailsize 'ImageOpenShowImageInlineBefore': Call potential extension just before showing the image on an image page. @@ -1886,9 +1898,9 @@ $revisionInfo: Array of revision information Return false to stop further processing of the tag $reader: XMLReader object -'ImportHandleUnknownUser': When a user doesn't exist locally, this hook is called -to give extensions an opportunity to auto-create it. If the auto-creation is -successful, return false. +'ImportHandleUnknownUser': When a user doesn't exist locally, this hook is +called to give extensions an opportunity to auto-create it. If the auto-creation +is successful, return false. $name: User name 'ImportHandleUploadXMLTag': When parsing a XML tag in a file upload. @@ -1972,7 +1984,7 @@ $user: User the password is being validated for $code: The language code or the language we're looking for a messages file for &$file: The messages file path, you can override this to change the location. -'LanguageGetMagic': DEPRECATED! Use $magicWords in a file listed in +'LanguageGetMagic': DEPRECATED since 1.16! Use $magicWords in a file listed in $wgExtensionMessagesFiles instead. Use this to define synonyms of magic words depending of the language &$magicExtensions: associative array of magic words synonyms @@ -2007,11 +2019,11 @@ $title: The page's Title. $out: The output page. $cssClassName: CSS class name of the language selector. -'LinkBegin': DEPRECATED! Use HtmlPageLinkRendererBegin instead. -Used when generating internal and interwiki links in -Linker::link(), before processing starts. Return false to skip default -processing and return $ret. See documentation for Linker::link() for details on -the expected meanings of parameters. +'LinkBegin': DEPRECATED since 1.28! Use HtmlPageLinkRendererBegin instead. +Used when generating internal and interwiki links in Linker::link(), before +processing starts. Return false to skip default processing and return $ret. See +documentation for Linker::link() for details on the expected meanings of +parameters. $skin: the Skin object $target: the Title that the link is pointing to &$html: the contents that the tag should have (raw HTML); null means @@ -2025,7 +2037,7 @@ $target: the Title that the link is pointing to &$options: array of options. Can include 'known', 'broken', 'noclasses'. &$ret: the value to return if your hook returns false. -'LinkEnd': DEPRECATED! Use HtmlPageLinkRendererEnd hook instead +'LinkEnd': DEPRECATED since 1.28! Use HtmlPageLinkRendererEnd hook instead Used when generating internal and interwiki links in Linker::link(), just before the function returns a value. If you return true, an element with HTML attributes $attribs and contents $html will be returned. If you @@ -2207,11 +2219,11 @@ in LoginForm::$validErrorMessages). &$messages: Already added messages (inclusive messages from LoginForm::$validErrorMessages) -'LoginUserMigrated': DEPRECATED! Create a PreAuthenticationProvider instead. -Called during login to allow extensions the opportunity to inform a user that -their username doesn't exist for a specific reason, instead of letting the -login form give the generic error message that the account does not exist. For -example, when the account has been renamed or deleted. +'LoginUserMigrated': DEPRECATED since 1.27! Create a PreAuthenticationProvider +instead. Called during login to allow extensions the opportunity to inform a +user that their username doesn't exist for a specific reason, instead of letting +the login form give the generic error message that the account does not exist. +For example, when the account has been renamed or deleted. $user: the User object being authenticated against. &$msg: the message identifier for abort reason, or an array to pass a message key and parameters. @@ -2265,6 +2277,18 @@ $wcOnlySysopsCanPatrol: config setting indicating whether the user must be a sysop to patrol the edit. $auto: true if the edit is being marked as patrolled automatically +'ApiMaxLagInfo': When lag information is being requested via API. Use this to +override lag information. Generally a hook function should only replace +$lagInfo if the new $lagInfo['lag'] is greater than the current $lagInfo['lag']. +&$lagInfo: Maximum lag information array. Fields in the array are: + 'lag' is the number of seconds of lag. + 'host' is the host name on which the lag exists. + 'type' is an indication of the type of lag, + e.g. "db" for database replication lag or "jobqueue" for job queue size + converted to pseudo-seconds. + It is possible to add more fields and they will be returned to the user in + the API response. + 'MediaWikiPerformAction': Override MediaWiki::performAction(). Use this to do something completely different, after the basic globals have been set up, but before ordinary actions take place. @@ -2359,8 +2383,8 @@ $new: the ?new= param value from the url 'NewPagesLineEnding': Called before a NewPages line is finished. $page: the SpecialNewPages object &$ret: the HTML line -$row: the database row for this page (the recentchanges record and a few extras - see - NewPagesPager::getQueryInfo) +$row: the database row for this page (the recentchanges record and a few extras + - see NewPagesPager::getQueryInfo) &$classes: the classes to add to the surrounding
  • &$attribs: associative array of other HTML attributes for the
  • element. Currently only data attributes reserved to MediaWiki are allowed @@ -2370,7 +2394,9 @@ $row: the database row for this page (the recentchanges record and a few extras edit. $wikiPage: the WikiPage edited $rev: the new revision -$baseID: the revision ID this was based off, if any +$originalRevId: if the edit restores or repeats an earlier revision (such as a + rollback or a null revision), the ID of that earlier revision. False otherwise. + (Used to be called $baseID.) $user: the editing user &$tags: tags to apply to the edit and recent change @@ -2478,7 +2504,9 @@ $flags: Flags passed to WikiPage::doEditContent() $revision: New Revision of the article (can be null for edits that change nothing) $status: Status object about to be returned by doEditContent() -$baseRevId: the rev ID (or false) this edit was based on +$originalRevId: if the edit restores or repeats an earlier revision (such as a + rollback or a null revision), the ID of that earlier revision. False otherwise. + (Used to be called $baseRevId.) $undidRevId: the rev ID (or 0) this edit undid 'PageHistoryBeforeList': When a history page list is about to be constructed. @@ -2599,7 +2627,7 @@ cache or return false to not use it. &$parser: Parser object &$varCache: variable cache (array) -'ParserLimitReport': DEPRECATED! Use ParserLimitReportPrepare and +'ParserLimitReport': DEPRECATED since 1.22! Use ParserLimitReportPrepare and ParserLimitReportFormat instead. Called at the end of Parser:parse() when the parser will include comments about size of the text parsed. @@ -2636,7 +2664,8 @@ change the default value for an option, all existing parser cache entries will be invalid. To avoid bugs, you'll need to handle that somehow (e.g. with the RejectParserCacheValue hook) because MediaWiki won't do it for you. &$defaults: Set the default value for your option here. -&$inCacheKey: To fragment the parser cache on your option, set a truthy value here. +&$inCacheKey: To fragment the parser cache on your option, set a truthy value + here. &$lazyLoad: To lazy-initialize your option, set it null in $defaults and set a callable here. The callable is passed the ParserOptions object and the option name. @@ -2666,7 +2695,8 @@ run. Use when page save hooks require the presence of custom tables to ensure that tests continue to run properly. &$tables: array of table names -'ParserOutputStashForEdit': Called when an edit stash parse finishes, before the output is cached. +'ParserOutputStashForEdit': Called when an edit stash parse finishes, before the +output is cached. $page: the WikiPage of the candidate edit $content: the Content object of the candidate edit $output: the ParserOutput result of the candidate edit @@ -2728,7 +2758,8 @@ $key: the section name &$legend: the legend text. Defaults to wfMessage( "prefs-$key" )->text() but may be overridden -'PrefixSearchBackend': DEPRECATED! Override SearchEngine::completionSearchBackend instead. +'PrefixSearchBackend': DEPRECATED since 1.27! Override +SearchEngine::completionSearchBackend instead. Override the title prefix search used for OpenSearch and AJAX search suggestions. Put results into &$results outparam and return false. $ns: array of int namespace keys to search in @@ -2824,7 +2855,7 @@ $context: ResourceLoaderContext|null ResourceLoaderStartUpModule::getConfigSettings(). Use this to export static configuration variables to JavaScript. Things that depend on the current page or request state must be added through MakeGlobalVariablesScript instead. -&$vars: array( variable name => value ) +&$vars: [ variable name => value ] 'ResourceLoaderJqueryMsgModuleMagicWords': Called in ResourceLoaderJqueryMsgModule to allow adding magic words for jQueryMsg. @@ -2843,10 +2874,10 @@ called after the addition of 'qunit' and MediaWiki testing resources. &$testModules: array of JavaScript testing modules. The 'qunit' framework, included in core, is fed using tests/qunit/QUnitTestResources.php. To add a new qunit module named 'myext.tests': - $testModules['qunit']['myext.tests'] = array( + $testModules['qunit']['myext.tests'] = [ 'script' => 'extension/myext/tests.js', 'dependencies' => - ); + ]; For QUnit framework, the mediawiki.tests.qunit.testrunner dependency will be added to any module. &$ResourceLoader: object @@ -2854,8 +2885,8 @@ called after the addition of 'qunit' and MediaWiki testing resources. 'RevisionRecordInserted': Called after a revision is inserted into the database. $revisionRecord: the RevisionRecord that has just been inserted. -'RevisionInsertComplete': DEPRECATED! Use RevisionRecordInserted hook instead. -Called after a revision is inserted into the database. +'RevisionInsertComplete': DEPRECATED since 1.31! Use RevisionRecordInserted hook +instead. Called after a revision is inserted into the database. $revision: the Revision $data: DEPRECATED! Always null! $flags: DEPRECATED! Always null! @@ -2903,10 +2934,12 @@ $engine: SearchEngine for which the indexing is intended 'SearchResultsAugment': Allows extension to add its code to the list of search result augmentors. -&$setAugmentors: List of whole-set augmentor objects, must implement ResultSetAugmentor -&$rowAugmentors: List of per-row augmentor objects, must implement ResultAugmentor. -Note that lists should be in the format name => object and the names in both lists should -be distinct. +&$setAugmentors: List of whole-set augmentor objects, must implement + ResultSetAugmentor. +&$rowAugmentors: List of per-row augmentor objects, must implement + ResultAugmentor. +Note that lists should be in the format name => object and the names in both + lists should be distinct. 'SecondaryDataUpdates': Allows modification of the list of DataUpdates to perform when page content is modified. Currently called by @@ -2989,11 +3022,13 @@ $terms: Search terms, for highlighting 'ShowSearchHitTitle': Customise display of search hit title/link. &$title: Title to link to -&$titleSnippet: Label for the link representing the search result. Typically the article title. +&$titleSnippet: Label for the link representing the search result. Typically the + article title. $result: The SearchResult object $terms: String of the search terms entered $specialSearch: The SpecialSearch object -&$query: Array of query string parameters for the link representing the search result. +&$query: Array of query string parameters for the link representing the search + result. &$attributes: Array of title link attributes, can be modified by extension. 'SidebarBeforeOutput': Allows to edit sidebar just before it is output by skins. @@ -3171,7 +3206,7 @@ $pager: The UsersPager instance 'SpecialListusersFormatRow': Called right before the end of UsersPager::formatRow(). -&$item: HTML to be returned. Will be wrapped in
  • after the hook finishes +&$item: HTML to be returned. Will be wrapped in an
  • after the hook finishes $row: Database row object 'SpecialListusersHeader': Called after adding the submit button in @@ -3248,8 +3283,8 @@ use this to change some selection criteria or substitute a different title. &$title: If the hook returns false, a Title object to use instead of the result from the normal query -'SpecialRecentChangesFilters': DEPRECATED! Use ChangesListSpecialPageStructuredFilters -instead. +'SpecialRecentChangesFilters': DEPRECATED since 1.23! Use +ChangesListSpecialPageStructuredFilters instead. Called after building form options at RecentChanges. $special: the special page object &$filters: associative array of filter definitions. The keys are the HTML @@ -3261,8 +3296,8 @@ SpecialRecentChanges. &$extraOpts: array of added items, to which can be added $opts: FormOptions for this request -'SpecialRecentChangesQuery': DEPRECATED! Use ChangesListSpecialPageStructuredFilters -or ChangesListSpecialPageQuery instead. +'SpecialRecentChangesQuery': DEPRECATED since 1.23! Use +ChangesListSpecialPageStructuredFilters or ChangesListSpecialPageQuery instead. Called when building SQL query for SpecialRecentChanges and SpecialRecentChangesLinked. &$conds: array of WHERE conditionals for query @@ -3275,10 +3310,10 @@ $opts: FormOptions for this request 'SpecialResetTokensTokens': Called when building token list for SpecialResetTokens. &$tokens: array of token information arrays in the format of - array( + [ 'preference' => '', 'label-message' => '', - ) + ] 'SpecialSearchCreateLink': Called when making the message to create a page or go to the existing page. @@ -3291,7 +3326,8 @@ $url does a standard redirect to $title. Setting $url redirects to the specified URL. $term: The string the user searched for $title: The title the 'go' feature has decided to forward the user to -&$url: Initially null, hook subscribers can set this to specify the final url to redirect to +&$url: Initially null, hook subscribers can set this to specify the final url to + redirect to 'SpecialSearchNogomatch': Called when the 'Go' feature is triggered (generally from autocomplete search other than the main bar on Special:Search) and the @@ -3349,11 +3385,14 @@ $engine: the search engine message key to use in the name column, $context: IContextSource object -'SpecialTrackingCategories::preprocess': Called after LinkBatch on Special:TrackingCategories +'SpecialTrackingCategories::preprocess': Called after LinkBatch on +Special:TrackingCategories $specialPage: The SpecialTrackingCategories object -$trackingCategories: Array of data from Special:TrackingCategories with msg and cats +$trackingCategories: Array of data from Special:TrackingCategories with msg and + cats -'SpecialTrackingCategories::generateCatLink': Called for each cat link on Special:TrackingCategories +'SpecialTrackingCategories::generateCatLink': Called for each cat link on +Special:TrackingCategories $specialPage: The SpecialTrackingCategories object $catTitle: The Title object of the linked category &$html: The Result html @@ -3366,8 +3405,8 @@ Special:Upload. $wgVersion: Current $wgVersion for you to use &$versionUrl: Raw url to link to (eg: release notes) -'SpecialWatchlistFilters': DEPRECATED! Use ChangesListSpecialPageStructuredFilters -instead. +'SpecialWatchlistFilters': DEPRECATED since 1.23! Use +ChangesListSpecialPageStructuredFilters instead. Called after building form options at Watchlist. $special: the special page object &$filters: associative array of filter definitions. The keys are the HTML @@ -3379,8 +3418,8 @@ SpecialWatchlist. Allows extensions to register custom values they have inserted to rc_type so they can be returned as part of the watchlist. &$nonRevisionTypes: array of values in the rc_type field of recentchanges table -'SpecialWatchlistQuery': DEPRECATED! Use ChangesListSpecialPageStructuredFilters -or ChangesListSpecialPageQuery instead. +'SpecialWatchlistQuery': DEPRECATED since 1.23! Use +ChangesListSpecialPageStructuredFilters or ChangesListSpecialPageQuery instead. Called when building sql query for SpecialWatchlist. &$conds: array of WHERE conditionals for query &$tables: array of tables to be queried @@ -3443,7 +3482,8 @@ $old: old title $nt: new title $user: user who does the move -'TitleMoveStarting': Before moving an article (title), but just after the atomic DB section starts. +'TitleMoveStarting': Before moving an article (title), but just after the atomic +DB section starts. $old: old title $nt: new title $user: user who does the move @@ -3516,8 +3556,8 @@ $title: Title object of the page that we're about to undelete $title: title object related to the revision $rev: revision (object) that will be viewed -'UnitTestsAfterDatabaseSetup': Called right after MediaWiki's test infrastructure -has finished creating/duplicating core tables for unit tests. +'UnitTestsAfterDatabaseSetup': Called right after MediaWiki's test +infrastructure has finished creating/duplicating core tables for unit tests. $database: Database in question $prefix: Table prefix to be used in unit tests @@ -3529,7 +3569,7 @@ Since 1.24: Paths pointing to a directory will be recursively scanned for test case files matching the suffix "Test.php". &$paths: list of test cases and directories to search. -'UnknownAction': DEPRECATED! To add an action in an extension, +'UnknownAction': DEPRECATED since 1.19! To add an action in an extension, create a subclass of Action, and add a new key to $wgActions. An unknown "action" has occurred (useful for defining your own actions). $action: action name @@ -3556,11 +3596,11 @@ $type: (string) the requested upload type &$className: the class name of the Upload instance to be created 'UploadForm:BeforeProcessing': At the beginning of processUpload(). Lets you -poke at member variables like $mUploadDescription before the file is saved. Do -not use this hook to break upload processing. This will return the user to a -blank form with no error message; use UploadVerification and UploadVerifyFile -instead. -&$form: UploadForm object +poke at member variables like $mUploadDescription before the file is saved. +Do not use this hook to break upload processing. +This will return the user to a blank form with no error message; +use UploadVerifyUpload or UploadVerifyFile instead. +&$upload: SpecialUpload object 'UploadForm:getInitialPageText': After the initial page text for file uploads is generated, to allow it to be altered. @@ -3571,7 +3611,7 @@ $config: Config object 'UploadForm:initial': Before the upload form is generated. You might set the member-variables $uploadFormTextTop and $uploadFormTextAfterSummary to inject text (HTML) either before or after the editform. -&$form: UploadForm object +&$upload: SpecialUpload object 'UploadFormInitDescriptor': After the descriptor for the upload form as been assembled. @@ -3590,12 +3630,12 @@ being uploaded, use UploadVerifyFile or UploadVerifyUpload. $upload: (object) An instance of UploadBase, with all info about the upload $user: (object) An instance of User, the user uploading this file $props: (array) File properties, as returned by FSFile::getPropsFromPath() -&$error: output: If the file stashing should be prevented, set this to the reason - in the form of array( messagename, param1, param2, ... ) or a MessageSpecifier - instance (you might want to use ApiMessage to provide machine-readable details - for the API). +&$error: output: If the file stashing should be prevented, set this to the + reason in the form of [ messagename, param1, param2, ... ] or a + MessageSpecifier instance (you might want to use ApiMessage to provide machine + -readable details for the API). -'UploadVerification': DEPRECATED! Use UploadVerifyFile instead. +'UploadVerification': DEPRECATED since 1.28! Use UploadVerifyFile instead. Additional chances to reject an uploaded file. $saveName: (string) destination file name $tempName: (string) filesystem path to the temporary file for checks @@ -3608,10 +3648,10 @@ in most cases over UploadVerification. $upload: (object) an instance of UploadBase, with all info about the upload $mime: (string) The uploaded file's MIME type, as detected by MediaWiki. Handlers will typically only apply for specific MIME types. -&$error: (object) output: true if the file is valid. Otherwise, set this to the reason - in the form of array( messagename, param1, param2, ... ) or a MessageSpecifier - instance (you might want to use ApiMessage to provide machine-readable details - for the API). +&$error: (object) output: true if the file is valid. Otherwise, set this to the + reason in the form of [ messagename, param1, param2, ... ] or a + MessageSpecifier instance (you might want to use ApiMessage to provide machine + -readable details for the API). 'UploadVerifyUpload': Upload verification, based on both file properties like MIME type (same as UploadVerifyFile) and the information entered by the user @@ -3622,7 +3662,7 @@ $props: (array) File properties, as returned by FSFile::getPropsFromPath() $comment: (string) Upload log comment (also used as edit summary) $pageText: (string) File description page text (only used for new uploads) &$error: output: If the file upload should be prevented, set this to the reason - in the form of array( messagename, param1, param2, ... ) or a MessageSpecifier + in the form of [ messagename, param1, param2, ... ] or a MessageSpecifier instance (you might want to use ApiMessage to provide machine-readable details for the API). @@ -3665,8 +3705,8 @@ messages!" message, return false to not delete it. &$user: User (object) that will clear the message $oldid: ID of the talk page revision being viewed (0 means the most recent one) -'UserCreateForm': DEPRECATED! Create an AuthenticationProvider instead. -Manipulate the login form. +'UserCreateForm': DEPRECATED since 1.27! Create an AuthenticationProvider +instead. Manipulate the login form. &$template: SimpleTemplate instance for the form 'UserEffectiveGroups': Called in User::getEffectiveGroups(). @@ -3693,7 +3733,7 @@ $user: User object &$timestamp: timestamp, change this to override local email authentication timestamp -'UserGetImplicitGroups': DEPRECATED! +'UserGetImplicitGroups': DEPRECATED since 1.25! Called in User::getImplicitGroups(). &$groups: List of implicit (automatically-assigned) groups @@ -3759,7 +3799,8 @@ $name: user name $user: user object &$s: database query object -'UserLoadFromSession': DEPRECATED! Create a MediaWiki\Session\SessionProvider instead. +'UserLoadFromSession': DEPRECATED since 1.27! Create a +MediaWiki\Session\SessionProvider instead. Called to authenticate users on external/environmental means; occurs before session is loaded. $user: user object being loaded @@ -3774,16 +3815,17 @@ $user: User object 'UserLoggedIn': Called after a user is logged in $user: User object for the logged-in user -'UserLoginComplete': Show custom content after a user has logged in via the web interface. -For functionality that needs to run after any login (API or web) use UserLoggedIn. +'UserLoginComplete': Show custom content after a user has logged in via the Web +interface. For functionality that needs to run after any login (API or web) use +UserLoggedIn. &$user: the user object that was created on login &$inject_html: Any HTML to inject after the "logged in" message. -$direct: (bool) The hook is called directly after a successful login. This will only happen once - per login. A UserLoginComplete call with direct=false can happen when the user visits the login - page while already logged in. +$direct: (bool) The hook is called directly after a successful login. This will + only happen once per login. A UserLoginComplete call with direct=false can + happen when the user visits the login page while already logged in. -'UserLoginForm': DEPRECATED! Create an AuthenticationProvider instead. -Manipulate the login form. +'UserLoginForm': DEPRECATED since 1.27! Create an AuthenticationProvider +instead. Manipulate the login form. &$template: QuickTemplate instance for the form 'UserLogout': Before a user logs out. @@ -3801,21 +3843,26 @@ $to: Array of MailAddress objects for the recipients 'UserMailerSplitTo': Called in UserMailer::send() to give extensions a chance to split up an email with multiple the To: field into separate emails. -&$to: array of MailAddress objects; unset the ones which should be mailed separately +&$to: array of MailAddress objects; unset the ones which should be mailed +separately -'UserMailerTransformContent': Called in UserMailer::send() to change email contents. -Extensions can block sending the email by returning false and setting $error. +'UserMailerTransformContent': Called in UserMailer::send() to change email +contents. Extensions can block sending the email by returning false and setting +$error. $to: array of MailAdresses of the targets $from: MailAddress of the sender -&$body: email body, either a string (for plaintext emails) or an array with 'text' and 'html' keys +&$body: email body, either a string (for plaintext emails) or an array with + 'text' and 'html' keys &$error: should be set to an error message string -'UserMailerTransformMessage': Called in UserMailer::send() to change email after it has gone through -the MIME transform. Extensions can block sending the email by returning false and setting $error. +'UserMailerTransformMessage': Called in UserMailer::send() to change email after +it has gone through the MIME transform. Extensions can block sending the email +by returning false and setting $error. $to: array of MailAdresses of the targets $from: MailAddress of the sender &$subject: email subject (not MIME encoded) -&$headers: email headers (except To: and Subject:) as an array of header name => value pairs +&$headers: email headers (except To: and Subject:) as an array of header +name => value pairs &$body: email body (in MIME format) as a string &$error: should be set to an error message string @@ -3844,27 +3891,29 @@ message(s). &$user: user retrieving new talks messages &$talks: array of new talks page(s) -'UserRights': DEPRECATED! Use UserGroupsChanged instead. +'UserRights': DEPRECATED since 1.26! Use UserGroupsChanged instead. After a user's group memberships are changed. &$user: User object that was changed $add: Array of strings corresponding to groups added $remove: Array of strings corresponding to groups removed -'UserSaveOptions': Called just before saving user preferences. Hook handlers can either add or -manipulate options, or reset one back to it's default to block changing it. Hook handlers are also -allowed to abort the process by returning false, e.g. to save to a global profile instead. Compare -to the UserSaveSettings hook, which is called after the preferences have been saved. +'UserSaveOptions': Called just before saving user preferences. Hook handlers can +either add or manipulate options, or reset one back to it's default to block +changing it. Hook handlers are also allowed to abort the process by returning +false, e.g. to save to a global profile instead. Compare to the UserSaveSettings +hook, which is called after the preferences have been saved. $user: The User for which the options are going to be saved &$options: The users options as an associative array, modifiable -'UserSaveSettings': Called directly after user preferences (user_properties in the database) have -been saved. Compare to the UserSaveOptions hook, which is called before. +'UserSaveSettings': Called directly after user preferences (user_properties in +the database) have been saved. Compare to the UserSaveOptions hook, which is +called before. $user: The User for which the options have been saved -'UserSetCookies': DEPRECATED! If you're trying to replace core session cookie -handling, you want to create a subclass of MediaWiki\Session\CookieSessionProvider -instead. Otherwise, you can no longer count on user data being saved to cookies -versus some other mechanism. +'UserSetCookies': DEPRECATED since 1.27! If you're trying to replace core +session cookie handling, you want to create a subclass of +MediaWiki\Session\CookieSessionProvider instead. Otherwise, you can no longer +count on user data being saved to cookies versus some other mechanism. Called when setting user cookies. $user: User object &$session: session array, will be added to the session @@ -3893,7 +3942,7 @@ displayed correctly in Special:ListUsers. $dbr: Read-only database handle $userIds: Array of user IDs whose groups we should look up &$cache: Array of user ID -> (array of internal group name (e.g. 'sysop') -> -UserGroupMembership object) + UserGroupMembership object) &$groups: Array of group name -> bool true mappings for members of a given user group @@ -3968,15 +4017,15 @@ dumps. One, and only one hook should set this, and return false. &$opts: Options to use for the query &$join: Join conditions -'WikiPageDeletionUpdates': manipulate the list of DeferrableUpdates to be applied when -a page is deleted. Called in WikiPage::getDeletionUpdates(). Note that updates -specific to a content model should be provided by the respective Content's -getDeletionUpdates() method. +'WikiPageDeletionUpdates': manipulate the list of DeferrableUpdates to be +applied when a page is deleted. Called in WikiPage::getDeletionUpdates(). Note +that updates specific to a content model should be provided by the respective +Content's getDeletionUpdates() method. $page: the WikiPage -$content: the Content to generate updates for, or null in case the page revision could not be - loaded. The delete will succeed despite this. -&$updates: the array of objects that implement DeferrableUpdate. Hook function may want to add to - it. +$content: the Content to generate updates for, or null in case the page revision + could not be loaded. The delete will succeed despite this. +&$updates: the array of objects that implement DeferrableUpdate. Hook function + may want to add to it. 'WikiPageFactory': Override WikiPage class used for a title $title: Title of the page diff --git a/docs/memcached.txt b/docs/memcached.txt index 8c59e72dd6..1e68fb7cc3 100644 --- a/docs/memcached.txt +++ b/docs/memcached.txt @@ -80,18 +80,15 @@ usage evenly), make its entry a subarray: MediaWiki uses a fork of Ryan T. Dean's pure-PHP memcached client. It also supports the PECL PHP extension for memcached. -MediaWiki uses three object for object caching: -* $wgMemc, controlled by $wgMainCacheType -* $parserMemc, controlled by $wgParserCacheType -* $messageMemc, controlled by $wgMessageCacheType -If you set CACHE_NONE to one of the three control variable, (default -value for $wgMainCacheType), MediaWiki still create a MemCacheClient, -but requests to it are no-ops and we always fall through to the -database. If the cache daemon can't be contacted, it should also -disable itself fairly smoothly. - -By default, $wgMemc is used but when it is $parserMemc or $messageMemc -this is mentioned below. +MediaWiki uses the ObjectCache class to retrieve instances of +BagOStuff by purpose, controlled by the following variables: +* $wgMainCacheType +* $wgParserCacheType +* $wgMessageCacheType + +If you set one of these to CACHE_NONE, MediaWiki still creates a +BagOStuff object, but calls it to it are no-ops. If the cache daemon +can't be contacted, it should also disable itself fairly smoothly. == Keys used == @@ -134,7 +131,7 @@ Localisation: cleared by: Language::loadLocalisation() Message Cache: - stored in: $messageMemc + backend: $wgMessageCacheType key: $wgDBname:messages, $wgDBname:messages-hash, $wgDBname:messages-status ex: wikidb:messages, wikidb:messages-hash, wikidb:messages-status stores: an array where the keys are DB keys and the values are messages @@ -151,7 +148,8 @@ Newtalk: expiry: 30 minutes Parser Cache: - stored in: $parserMemc + access: ParserCache + backend: $wgParserCacheType key: $wgDBname:pcache:idhash:$pageid-$renderkey!$hash $pageid: id of the page $renderkey: 1 if action=render, 0 otherwise @@ -205,7 +203,7 @@ Sessions: cleared by: session_destroy() Sidebar: - stored in: $parserMemc + access: WANObjectCache controlled by: $wgEnableSidebarCache key: $wgDBname:sidebar ex: wikidb:sidebar @@ -221,7 +219,7 @@ Special:Allpages: cleared by: nothing Special:Recentchanges (feed): - stored in: $messageMemc + backend: $wgMessageCacheType key: $wgDBname:rcfeed:$format:$limit:$hideminor:$target and rcfeed:$format:timestamp ex: wikidb:rcfeed:rss:50:: and rcfeed:rss:timestamp diff --git a/docs/pageupdater.txt b/docs/pageupdater.txt new file mode 100644 index 0000000000..4980c9242b --- /dev/null +++ b/docs/pageupdater.txt @@ -0,0 +1,191 @@ +This document provides an overview of the usage of PageUpdater and DerivedPageDataUpdater. + +== PageUpdater == +PageUpdater is the canonical way to create page revisions, that is, to perform edits. + +PageUpdater is a stateful, handle-like object that allows new revisions to be created +on a given wiki page using the saveRevision() method. PageUpdater provides setters for +defining the new revision's content as well as meta-data such as change tags. saveRevision() +stores the new revision's primary content and metadata, and triggers the necessary +updates to derived secondary data and cached artifacts e.g. in the ParserCache and the +CDN layer, using a DerivedPageDataUpdater. + +PageUpdater instances follow the below life cycle, defined by a number of +methods: + + +----------------------------+ + | | + | new | + | | + +------|--------------|------+ + | | + grabParentRevision()-| | + or hasEditConflict()-| | + | | + +--------v-------+ | + | | | + | parent known | | + | | | + Enables---------------+--------|-------+ | + safe operations based on | |-saveRevision() + the parent revision, e.g. | | + section replacement or | | + edit conflict resolution. | | + | | + saveRevision()-| | + | | + +------v--------------v------+ + | | + | creation committed | + | | + Enables-----------------+----------------------------+ + wasSuccess() + isUnchanged() + isNew() + getState() + getNewRevision() + etc. + +The stateful nature of PageUpdater allows it to be used to safely perform +transformations that depend on the new revision's parent revision, such as replacing +sections or applying 3-way conflict resolution, while protecting against race +conditions using a compare-and-swap (CAS) mechanism: after calling code used the +grabParentRevision() method to access the edit's logical parent, PageUpdater +remembers that revision, and ensure that that revision is still the page's current +revision when performing the atomic database update for the revision's primary +meta-data when saveRevision() is called. If another revision was created concurrently, +saveRevision() will fail, indicating the problem with the "edit-conflict" code in the status +object. + +Typical usage for programmatic revision creation (with $page being a WikiPage as of 1.32, to be +replaced by a repository service later): + + $updater = $page->newPageUpdater( $user ); + $updater->setContent( 'main', $content ); + $updater->setRcPatrolStatus( RecentChange::PRC_PATROLLED ); + $newRev = $updater->saveRevision( $comment ); + +Usage with content depending on the parent revision + + $updater = $page->newPageUpdater( $user ); + $parent = $updater->grabParentRevision(); + $content = $parent->getContent( 'main' )->replaceSection( $section, $sectionContent ); + $updater->setContent( 'main', $content ); + $newRev = $updater->saveRevision( $comment, EDIT_UPDATE ); + +In both cases, all secondary updates will be triggered automatically. + +== DerivedPageDataUpdater == +DerivedPageDataUpdater is a stateful, handle-like object that caches derived data representing +a revision, and can trigger updates of cached copies of that data, e.g. in the links tables, +page_props, the ParserCache, and the CDN layer. + +DerivedPageDataUpdater is used by PageUpdater when creating new revisions, but can also +be used independently when performing meta data updates during undeletion, import, or +when puring a page. It's a stepping stone on the way to a more complete refactoring of WikiPage. + +NOTE: Avoid direct usage of DerivedPageDataUpdater. In the future, we want to define interfaces +for the different use cases of DerivedPageDataUpdater, particularly providing access to post-PST +content and ParserOutput to callbacks during revision creation, which currently use +WikiPage::prepareContentForEdit, and allowing updates to be triggered on purge, import, and +undeletion, which currently use WikiPage::doEditUpdates() and Content::getSecondaryDataUpdates(). + +The primary reason for DerivedPageDataUpdater to be stateful is internal caching of state +that avoids the re-generation of ParserOutput and re-application of pre-save- +transformations (PST). + +DerivedPageDataUpdater instances follow the below life cycle, defined by a number of +methods: + + +---------------------------------------------------------------------+ + | | + | new | + | | + +---------------|------------------|------------------|---------------+ + | | | + grabCurrentRevision()-| | | + | | | + +-----------v----------+ | | + | | |-prepareContent() | + | knows current | | | + | | | | + Enables------------------+-----|-----|----------+ | | + pageExisted() | | | | + wasRedirect() | |-prepareContent() | |-prepareUpdate() + | | | | + | | +-------------v------------+ | + | | | | | + | +----> has content | | + | | | | + Enables------------------------|----------+--------------------------+ | + isChange() | | | + isCreation() |-prepareUpdate() | | + getSlots() | prepareUpdate()-| | + getTouchedSlotRoles() | | | + getCanonicalParserOutput() | +-----------v------------v-----------------+ + | | | + +------------------> has revision | + | | + Enables-------------------------------------------+------------------------|-----------------+ + updateParserCache() | + runSecondaryDataUpdates() |-doUpdates() + | + +-----------v---------+ + | | + | updates done | + | | + +---------------------+ + + +- grabCurrentRevision() returns the logical parent revision of the target revision. It is +guaranteed to always return the same revision for a given DerivedPageDataUpdater instance. +If called before prepareUpdate(), this fixates the logical parent to be the page's current +revision. If called for the first time after prepareUpdate(), it returns the revision +passed as the 'oldrevision' option to prepareUpdate(), or, if that wasn't given, the +parent of $revision parameter passed to prepareUpdate(). + +- prepareContent() is called before the new revision is created, to apply pre-save- +transformation (PST) and allow subsequent access to the canonical ParserOutput of the +revision. getSlots() and getCanonicalParserOutput() as well as getSecondaryDataUpdates() +may be used after prepareContent() was called. Calling prepareContent() with the same +parameters again has no effect. Calling it again with mismatching paramters, or calling +it after prepareUpdate() was called, triggers a LogicException. + +- prepareUpdate() is called after the new revision has been created. This may happen +right after the revision was created, on the same instance on which prepareContent() was +called, or later (possibly much later), on a fresh instance in a different process, +due to deferred or asynchronous updates, or during import, undeletion, purging, etc. +prepareUpdate() is required before a call to doUpdates(), and it also enables calls to +getSlots() and getCanonicalParserOutput() as well as getSecondaryDataUpdates(). +Calling prepareUpdate() with the same parameters again has no effect. +Calling it again with mismatching parameters, or calling it with parameters mismatching +the ones prepareContent() was called with, triggers a LogicException. + +- getSecondaryDataUpdtes() returns DataUpdates that represent derived data for the revision. +These may be used to update such data, e.g. in ApiPurge, RefreshLinksJob, and the refreshLinks +script. + +- doUpdates() triggers the updates defined by getSecondaryDataUpdtes(), and also causes +updates to cached artifacts in the ParserCache, the CDN layer, etc. This is primarily +used by PageUpdater, but also by PageArchive during undeletion, and when importing +revisions from XML. doUpdates() can only be called after prepareUpdate() was used to +initialize the DerivedPageDataUpdater instance for a specific revision. Calling it before +prepareUpdate() is called raises a LogicException. + +A DerivedPageDataUpdater instance is intended to be re-used during different stages +of complex update operations that often involve callbacks to extension code via +MediaWiki's hook mechanism, or deferred or even asynchronous execution of Jobs and +DeferredUpdates. Since these mechanisms typically do not provide a way to pass a +DerivedPageDataUpdater directly, WikiPage::getDerivedPageDataUpdater() has to be used to +obtain a DerivedPageDataUpdater for the update currently in progress - re-using the +same DerivedPageDataUpdater if possible avoids re-generation of ParserOutput objects +and other expensively derived artifacts. + +This mechanism for re-using a DerivedPageDataUpdater instance without passing it directly +requires a way to ensure that a given DerivedPageDataUpdater instance can actually be used +in the calling code's context. For this purpose, WikiPage::getDerivedPageDataUpdater() +calls the isReusableFor() method on DerivedPageDataUpdater, which ensures that the given +instance is applicable to the given parameters. In other words, isReusableFor() predicts +whether calling prepareContent() or prepareUpdate() with a given set of parameters will +trigger a LogicException. In that case, WikiPage::getDerivedPageDataUpdater() creates a +fresh DerivedPageDataUpdater instance. diff --git a/docs/skin.txt b/docs/skin.txt index 0b4e0bdac5..8dff602c83 100644 --- a/docs/skin.txt +++ b/docs/skin.txt @@ -58,7 +58,7 @@ These can also be customised on a per-user basis, by editing Several custom skins are available as of 2014. -https://www.mediawiki.org/wiki/Category:All_skins +https://www.mediawiki.org/wiki/Special:MyLanguage/Category:All_skins Installing a skin requires adding its files in a subdirectory under skins/ and adding an appropriate require_once line to LocalSettings.php, similarly to how diff --git a/includes/AjaxDispatcher.php b/includes/AjaxDispatcher.php index 35b556df7b..5f825c8b5a 100644 --- a/includes/AjaxDispatcher.php +++ b/includes/AjaxDispatcher.php @@ -76,7 +76,7 @@ class AjaxDispatcher { switch ( $this->mode ) { case 'get': - $this->func_name = isset( $_GET["rs"] ) ? $_GET["rs"] : ''; + $this->func_name = $_GET["rs"] ?? ''; if ( !empty( $_GET["rsargs"] ) ) { $this->args = $_GET["rsargs"]; } else { @@ -84,7 +84,7 @@ class AjaxDispatcher { } break; case 'post': - $this->func_name = isset( $_POST["rs"] ) ? $_POST["rs"] : ''; + $this->func_name = $_POST["rs"] ?? ''; if ( !empty( $_POST["rsargs"] ) ) { $this->args = $_POST["rsargs"]; } else { diff --git a/includes/AjaxResponse.php b/includes/AjaxResponse.php index 3e42c08650..0c115053ba 100644 --- a/includes/AjaxResponse.php +++ b/includes/AjaxResponse.php @@ -242,7 +242,7 @@ class AjaxResponse { # this breaks strtotime(). $modsince = preg_replace( '/;.*$/', '', $_SERVER["HTTP_IF_MODIFIED_SINCE"] ); $modsinceTime = strtotime( $modsince ); - $ismodsince = wfTimestamp( TS_MW, $modsinceTime ? $modsinceTime : 1 ); + $ismodsince = wfTimestamp( TS_MW, $modsinceTime ?: 1 ); wfDebug( "$fname: -- client send If-Modified-Since: $modsince", 'private' ); wfDebug( "$fname: -- we might send Last-Modified : $lastmod", 'private' ); diff --git a/includes/AuthPlugin.php b/includes/AuthPlugin.php index b73ecbd8ed..e12db24319 100644 --- a/includes/AuthPlugin.php +++ b/includes/AuthPlugin.php @@ -96,11 +96,7 @@ class AuthPlugin { * @return string */ public function getDomain() { - if ( isset( $this->domain ) ) { - return $this->domain; - } else { - return 'invaliddomain'; - } + return $this->domain ?? 'invaliddomain'; } /** diff --git a/includes/AutoLoader.php b/includes/AutoLoader.php index 62b1d39f3c..9fc063a285 100644 --- a/includes/AutoLoader.php +++ b/includes/AutoLoader.php @@ -123,6 +123,7 @@ class AutoLoader { * * @see * @private Only public for usage in AutoloadGenerator + * @codeCoverageIgnore * @since 1.31 * @return string[] */ diff --git a/includes/Block.php b/includes/Block.php index 2ce1f3ebfc..9567b06803 100644 --- a/includes/Block.php +++ b/includes/Block.php @@ -458,7 +458,7 @@ class Block { protected function initFromRow( $row ) { $this->setTarget( $row->ipb_address ); $this->setBlocker( User::newFromAnyId( - $row->ipb_by, $row->ipb_by_text, isset( $row->ipb_by_actor ) ? $row->ipb_by_actor : null + $row->ipb_by, $row->ipb_by_text, $row->ipb_by_actor ?? null ) ); $this->mTimestamp = wfTimestamp( TS_MW, $row->ipb_timestamp ); diff --git a/includes/Category.php b/includes/Category.php index 46b86d8cd8..41ecc65032 100644 --- a/includes/Category.php +++ b/includes/Category.php @@ -48,7 +48,7 @@ class Category { /** * Set up all member variables using a database query. - * @param int $mode + * @param int $mode One of (Category::LOAD_ONLY, Category::LAZY_INIT_ROW) * @throws MWException * @return bool True on success, false on failure. */ @@ -335,6 +335,16 @@ class Category { $dbw->startAtomic( __METHOD__ ); + // Lock the `category` row before locking `categorylinks` rows to try + // to avoid deadlocks with LinksDeletionUpdate (T195397) + $dbw->selectField( + 'category', + 1, + [ 'cat_title' => $this->mName ], + __METHOD__, + [ 'FOR UPDATE' ] + ); + // Lock all the `categorylinks` records and gaps for this category; // this is a separate query due to postgres/oracle limitations $dbw->selectRowCount( diff --git a/includes/CategoryViewer.php b/includes/CategoryViewer.php index 4202249578..79ab8b4463 100644 --- a/includes/CategoryViewer.php +++ b/includes/CategoryViewer.php @@ -581,7 +581,7 @@ class CategoryViewer extends ContextSource { foreach ( $colContents as $char => $articles ) { # Change space to non-breaking space to keep headers aligned - $h3char = $char === ' ' ? ' ' : htmlspecialchars( $char ); + $h3char = $char === ' ' ? "\u{00A0}" : htmlspecialchars( $char ); $ret .= '

    ' . $h3char; $ret .= "

    \n"; diff --git a/includes/CommentStore.php b/includes/CommentStore.php index e9b08e89dc..6b94d58e6c 100644 --- a/includes/CommentStore.php +++ b/includes/CommentStore.php @@ -261,7 +261,7 @@ class CommentStore { private function getCommentInternal( IDatabase $db = null, $key, $row, $fallback = false ) { $row = (array)$row; if ( array_key_exists( "{$key}_text", $row ) && array_key_exists( "{$key}_data", $row ) ) { - $cid = isset( $row["{$key}_cid"] ) ? $row["{$key}_cid"] : null; + $cid = $row["{$key}_cid"] ?? null; $text = $row["{$key}_text"]; $data = $row["{$key}_data"]; } elseif ( $this->stage === MIGRATION_OLD ) { diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 853315f142..3771df14fe 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -1500,10 +1500,6 @@ $wgDirectoryMode = 0777; * * This means a 320x240 use of an image on the wiki will also generate 480x360 and 640x480 * thumbnails, output via the srcset attribute. - * - * On older browsers, a JavaScript polyfill switches the appropriate images in after loading - * the original low-resolution versions depending on the reported window.devicePixelRatio. - * The polyfill can be found in the jquery.hidpi module. */ $wgResponsiveImages = true; @@ -1894,6 +1890,13 @@ $wgSQLMode = ''; */ $wgDBmwschema = null; +/** + * Default group to use when getting database connections. + * Will be used as default query group in ILoadBalancer::getConnection. + * @since 1.32 + */ +$wgDBDefaultGroup = null; + /** * To override default SQLite data directory ($docroot/../data) */ @@ -2059,6 +2062,8 @@ $wgDBerrorLogTZ = false; * Even correct usage may cause failures with Unicode supplementary * characters (those not in the Basic Multilingual Plane) unless MySQL * has enhanced their Unicode support. + * + * @deprecated since 1.31 */ $wgDBmysql5 = false; @@ -3778,23 +3783,6 @@ $wgResourceLoaderLESSVars = [ 'deviceWidthTablet' => '720px', ]; -/** - * Default import paths for LESS modules. LESS files referenced in @import - * statements will be looked up here first, and relative to the importing file - * second. To avoid collisions, it's important for the LESS files in these - * directories to have a common, predictable file name prefix. - * - * Extensions need not (and should not) register paths in - * $wgResourceLoaderLESSImportPaths. The import path includes the path of the - * currently compiling LESS file, which allows each extension to freely import - * files from its own tree. - * - * @since 1.22 - */ -$wgResourceLoaderLESSImportPaths = [ - "$IP/resources/src/mediawiki.less/", -]; - /** * Whether ResourceLoader should attempt to persist modules in localStorage on * browsers that support the Web Storage API. @@ -4746,10 +4734,10 @@ $wgPasswordDefault = 'pbkdf2'; * $wgPasswordConfig['bcrypt-peppered'] = [ * 'class' => EncryptedPassword::class, * 'underlying' => 'bcrypt', - * 'secrets' => [], - * 'cipher' => MCRYPT_RIJNDAEL_256, - * 'mode' => MCRYPT_MODE_CBC, - * 'cost' => 5, + * 'secrets' => [ + * hash( 'sha256', 'secret', true ), + * ], + * 'cipher' => 'aes-256-cbc', * ]; * @endcode * @@ -4894,6 +4882,7 @@ $wgDefaultUserOptions = [ 'watchlistunwatchlinks' => 0, 'watchmoves' => 0, 'watchrollback' => 0, + 'wlenhancedfilters-disable' => 0, 'wllimit' => 250, 'useeditwarning' => 1, 'prefershttps' => 1, @@ -6032,6 +6021,15 @@ $wgSessionName = false; */ $wgCookieSetOnAutoblock = false; +/** + * Whether to set a cookie when a logged-out user is blocked. Doing so means that a blocked user, + * even after moving to a new IP address, will still be blocked. This cookie will contain an + * authentication code if $wgSecretKey is set, or otherwise will just be the block ID (in which + * case there is a possibility of an attacker discovering the names of revdeleted users, so it + * is best to use this in conjunction with $wgSecretKey being set). + */ +$wgCookieSetOnIpBlock = false; + /** @} */ # end of cookie settings } /************************************************************************//** @@ -6879,6 +6877,15 @@ $wgUseRCPatrol = true; */ $wgStructuredChangeFiltersShowPreference = false; +/** + * Whether a preference is displayed for structured change filters on watchlist. + * Works just like $wgStructuredChangeFiltersShowPreference. + * + * Temporary variable during development and will be removed + * @since 1.32 + */ +$wgStructuredChangeFiltersShowWatchlistPreference = false; + /** * Whether to enable RCFilters app on Special:Watchlist * @@ -7877,10 +7884,16 @@ $wgActionFilteredLogs = [ ]; /** - * Maintain a log of newusers at Log/newusers? + * Maintain a log of newusers at Special:Log/newusers? */ $wgNewUserLog = true; +/** + * Maintain a log of page creations at Special:Log/create? + * @since 1.32 + */ +$wgPageCreationLog = false; + /** @} */ # end logging } /*************************************************************************//** @@ -8883,6 +8896,17 @@ $wgInterwikiPrefixDisplayTypes = []; */ $wgCommentTableSchemaMigrationStage = MIGRATION_OLD; +/** + * RevisionStore table schema migration stage (content, slots, content_models & slot_roles tables) + * + * @see Task: https://phabricator.wikimedia.org/T174028 + * @see Commit: https://gerrit.wikimedia.org/r/#/c/378724/ + * + * @since 1.32 + * @var int One of the MIGRATION_* constants + */ +$wgMultiContentRevisionSchemaMigrationStage = MIGRATION_OLD; + /** * Actor table schema migration stage. * @since 1.31 @@ -8899,6 +8923,20 @@ $wgActorTableSchemaMigrationStage = MIGRATION_OLD; */ $wgExpiryWidgetNoDatePicker = false; +/** + * change_tag table schema migration stage. + * + * - MIGRATION_OLD: Do not use change_tag_def table or ct_tag_id. + * - MIGRATION_WRITE_BOTH: Write to the change_tag_def table and ct_tag_id, but read from + * the old schema. This is different from the formal definition of the constants + * - MIGRATION_WRITE_NEW: Behaves the same as MIGRATION_WRITE_BOTH + * - MIGRATION_NEW: Use the change_tag_def table and ct_tag_id, do not read/write ct_tag + * + * @since 1.32 + * @var int One of the MIGRATION_* constants + */ +$wgChangeTagsSchemaMigrationStage = MIGRATION_OLD; + /** * For really cool vim folding this needs to be at the end: * vim: foldmarker=@{,@} foldmethod=marker diff --git a/includes/Defines.php b/includes/Defines.php index 087af39db4..e5261e7931 100644 --- a/includes/Defines.php +++ b/includes/Defines.php @@ -22,7 +22,6 @@ require_once __DIR__ . '/libs/mime/defines.php'; require_once __DIR__ . '/libs/rdbms/defines.php'; -require_once __DIR__ . '/compat/normal/UtfNormalDefines.php'; use Wikimedia\Rdbms\IDatabase; diff --git a/includes/DummyLinker.php b/includes/DummyLinker.php index 9aa6aeb056..2f5455ef5a 100644 --- a/includes/DummyLinker.php +++ b/includes/DummyLinker.php @@ -5,14 +5,6 @@ */ class DummyLinker { - /** - * @deprecated since 1.28, use LinkRenderer::getLinkClasses() instead - */ - public function getLinkColour( $t, $threshold ) { - wfDeprecated( __METHOD__, '1.28' ); - return Linker::getLinkColour( $t, $threshold ); - } - public function link( $target, $html = null, @@ -107,7 +99,7 @@ class DummyLinker { Title $title, $file, $label = '', - $alt, + $alt = '', $align = 'right', $params = [], $framed = false, diff --git a/includes/EditPage.php b/includes/EditPage.php index 87fb711138..9a8a4a6a09 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -235,7 +235,10 @@ class EditPage { /** @var string */ public $action = 'submit'; - /** @var bool */ + /** @var bool Whether an edit conflict needs to be resolved. Detected based on whether + * $editRevId is different from the current revision. When a conflict has successfully + * been resolved by a 3-way-merge, this field is set to false. + */ public $isConflict = false; /** @var bool New page or new section */ @@ -301,7 +304,7 @@ class EditPage { /** @var bool Has a summary been preset using GET parameter &summary= ? */ public $hasPresetSummary = false; - /** @var Revision|bool|null */ + /** @var Revision|bool|null A revision object corresponding to $this->editRevId. */ public $mBaseRevision = false; /** @var bool */ @@ -342,7 +345,16 @@ class EditPage { /** @var string */ public $edittime = ''; - /** @var int */ + /** @var int ID of the current revision at the time editing was initiated on the client. + * This is used to detect and resolve edit conflicts. + * + * @note 0 if the page did not exist at that time. + * @note When starting an edit from an old revision, this still records the current + * revision at the time , not the one the edit is based on. + * + * @see $oldid + * @see getBaseRevision() + */ private $editRevId = null; /** @var string */ @@ -354,10 +366,16 @@ class EditPage { /** @var string */ public $starttime = ''; - /** @var int */ + /** @var int Revision ID the edit is based on, or 0 if it's the current revision. + * @see $editRevId + */ public $oldid = 0; - /** @var int */ + /** @var int Revision ID the edit is based on, adjusted when an edit conflict is resolved. + * @see $editRevId + * @see $oldid + * @see getparentRevId() + */ public $parentRevId = 0; /** @var string */ @@ -486,17 +504,15 @@ class EditPage { /** * Get the context title object. - * If not set, $wgTitle will be returned. This behavior might change in - * the future to return $this->mTitle instead. + * + * If not set, $wgTitle will be returned, but this is deprecated. This will + * throw an exception. * * @return Title */ public function getContextTitle() { if ( is_null( $this->mContextTitle ) ) { - wfDebugLog( - 'GlobalTitleFail', - __METHOD__ . ' called by ' . wfGetAllCallers( 5 ) . ' with no title set.' - ); + wfDeprecated( __METHOD__ . ' called with no title set', '1.32' ); global $wgTitle; return $wgTitle; } else { @@ -587,6 +603,10 @@ class EditPage { $permErrors = $this->getEditPermissionErrors( $this->save ? 'secure' : 'full' ); if ( $permErrors ) { wfDebug( __METHOD__ . ": User can't edit\n" ); + + // track block with a cookie if it doesn't exists already + $this->context->getUser()->trackBlockWithCookie(); + // Auto-block user's IP if the account was "hard" blocked if ( !wfReadOnly() ) { DeferredUpdates::addCallableUpdate( function () { @@ -1182,6 +1202,7 @@ class EditPage { if ( $undo > 0 && $undoafter > 0 ) { $undorev = Revision::newFromId( $undo ); $oldrev = Revision::newFromId( $undoafter ); + $undoMsg = null; # Sanity check, make sure it's the right page, # the revisions exist and they were not deleted. @@ -1190,12 +1211,19 @@ class EditPage { !$undorev->isDeleted( Revision::DELETED_TEXT ) && !$oldrev->isDeleted( Revision::DELETED_TEXT ) ) { - $content = $this->page->getUndoContent( $undorev, $oldrev ); - - if ( $content === false ) { - # Warn the user that something went wrong - $undoMsg = 'failure'; + if ( WikiPage::hasDifferencesOutsideMainSlot( $undorev, $oldrev ) ) { + // Cannot yet undo edits that involve anything other the main slot. + $undoMsg = 'main-slot-only'; } else { + $content = $this->page->getUndoContent( $undorev, $oldrev ); + + if ( $content === false ) { + # Warn the user that something went wrong + $undoMsg = 'failure'; + } + } + + if ( $undoMsg === null ) { $oldContent = $this->page->getContent( Revision::RAW ); $popts = ParserOptions::newFromUserAndLang( $user, $wgContLang ); $newContent = $content->preSaveTransform( $this->mTitle, $user, $popts ); @@ -1252,7 +1280,8 @@ class EditPage { } $out = $this->context->getOutput(); - // Messages: undo-success, undo-failure, undo-norev, undo-nochange + // Messages: undo-success, undo-failure, undo-main-slot-only, undo-norev, + // undo-nochange. $class = ( $undoMsg == 'success' ? '' : 'error ' ) . "mw-undo-{$undoMsg}"; $this->editFormPageTop .= $out->parse( "
    " . $this->context->msg( 'undo-' . $undoMsg )->plain() . '
    ', true, /* interface */true ); @@ -1491,7 +1520,11 @@ class EditPage { * @return Status The resulting status object. */ public function attemptSave( &$resultDetails = false ) { - # Allow bots to exempt some edits from bot flagging + // TODO: MCR: treat $this->minoredit like $this->bot and check isAllowed( 'minoredit' )! + // Also, add $this->autopatrol like $this->bot and check isAllowed( 'autopatrol' )! + // This is needed since PageUpdater no longer checks these rights! + + // Allow bots to exempt some edits from bot flagging $bot = $this->context->getUser()->isAllowed( 'bot' ) && $this->bot; $status = $this->internalAttemptSave( $resultDetails, $bot ); @@ -1574,7 +1607,7 @@ class EditPage { $query = $query . '&' . $extraQueryRedirect; } } - $anchor = isset( $resultDetails['sectionanchor'] ) ? $resultDetails['sectionanchor'] : ''; + $anchor = $resultDetails['sectionanchor'] ?? ''; $out->redirect( $this->mTitle->getFullURL( $query ) . $anchor ); return false; @@ -2015,7 +2048,10 @@ ERROR; wfDebug( "timestamp: {$timestamp}, edittime: {$this->edittime}\n" ); - // Check editRevId if set, which handles same-second timestamp collisions + // An edit conflict is detected if the current revision is different from the + // revision that was current when editing was initiated on the client. + // This is checked based on the timestamp and revision ID. + // TODO: the timestamp based check can probably go away now. if ( $timestamp != $this->edittime || ( $this->editRevId !== null && $this->editRevId != $latest ) ) { @@ -2295,7 +2331,8 @@ ERROR; private function mergeChangesIntoContent( &$editContent ) { $db = wfGetDB( DB_MASTER ); - // This is the revision the editor started from + // This is the revision that was current at the time editing was initiated on the client, + // even if the edit was based on an old revision. $baseRevision = $this->getBaseRevision(); $baseContent = $baseRevision ? $baseRevision->getContent() : null; @@ -2326,9 +2363,16 @@ ERROR; } /** - * @note: this method is very poorly named. If the user opened the form with ?oldid=X, - * one might think of X as the "base revision", which is NOT what this returns. - * @return Revision|null Current version when the edit was started + * Returns the revision that was current at the time editing was initiated on the client, + * even if the edit was based on an old revision. + * + * @warning: this method is very poorly named. If the user opened the form with ?oldid=X, + * one might think of X as the "base revision", which is NOT what this returns, + * see oldid for that. One might further assume that this corresponds to the $baseRevId + * parameter of WikiPage::doEditContent, which is not the case either. + * getExpectedParentRevision() would perhaps be a better name. + * + * @return Revision|null Current version when editing was initiated on the client */ public function getBaseRevision() { if ( !$this->mBaseRevision ) { @@ -2808,7 +2852,7 @@ ERROR; $this->autoSumm = md5( '' ); } - $autosumm = $this->autoSumm ? $this->autoSumm : md5( $this->summary ); + $autosumm = $this->autoSumm ?: md5( $this->summary ); $out->addHTML( Html::hidden( 'wpAutoSummary', $autosumm ) ); $out->addHTML( Html::hidden( 'oldid', $this->oldid ) ); @@ -3537,7 +3581,7 @@ ERROR; // Allow for site and per-namespace customization of contribution/copyright notice. Hooks::run( 'EditPageCopyrightWarning', [ $title, &$copywarnMsg ] ); - $msg = call_user_func_array( 'wfMessage', $copywarnMsg )->title( $title ); + $msg = wfMessage( ...$copywarnMsg )->title( $title ); if ( $langcode ) { $msg->inLanguage( $langcode ); } @@ -4191,7 +4235,7 @@ ERROR; $checkboxesDef = $this->getCheckboxesDefinition( $checked ); foreach ( $checkboxesDef as $name => $options ) { - $legacyName = isset( $options['legacy-name'] ) ? $options['legacy-name'] : $name; + $legacyName = $options['legacy-name'] ?? $name; $title = null; $accesskey = null; @@ -4217,33 +4261,11 @@ ERROR; 'align' => 'inline', 'label' => new OOUI\HtmlSnippet( $this->context->msg( $options['label-message'] )->parse() ), 'title' => $title, - 'id' => isset( $options['label-id'] ) ? $options['label-id'] : null, + 'id' => $options['label-id'] ?? null, ] ); } - // Backwards-compatibility hack to run the EditPageBeforeEditChecks hook. It's important, - // people have used it for the weirdest things completely unrelated to checkboxes... - // And if we're gonna run it, might as well allow its legacy checkboxes to be shown. - $legacyCheckboxes = []; - if ( !$this->isNew ) { - $legacyCheckboxes['minor'] = ''; - } - $legacyCheckboxes['watch'] = ''; - // Copy new-style checkboxes into an old-style structure - foreach ( $checkboxes as $name => $oouiLayout ) { - $legacyCheckboxes[$name] = (string)$oouiLayout; - } - // Avoid PHP 7.1 warning of passing $this by reference - $ep = $this; - Hooks::run( 'EditPageBeforeEditChecks', [ &$ep, &$legacyCheckboxes, &$tabindex ], '1.29' ); - // Copy back any additional old-style checkboxes into the new-style structure - foreach ( $legacyCheckboxes as $name => $html ) { - if ( $html && !isset( $checkboxes[$name] ) ) { - $checkboxes[$name] = new OOUI\Widget( [ 'content' => new OOUI\HtmlSnippet( $html ) ] ); - } - } - return $checkboxes; } diff --git a/includes/FauxRequest.php b/includes/FauxRequest.php index 2f7f75b4d7..ecbc6e3373 100644 --- a/includes/FauxRequest.php +++ b/includes/FauxRequest.php @@ -121,7 +121,7 @@ class FauxRequest extends WebRequest { $prefix = $wgCookiePrefix; } $name = $prefix . $key; - return isset( $this->cookies[$name] ) ? $this->cookies[$name] : $default; + return $this->cookies[$name] ?? $default; } /** diff --git a/includes/GitInfo.php b/includes/GitInfo.php index 6270b27fdd..363d7b8050 100644 --- a/includes/GitInfo.php +++ b/includes/GitInfo.php @@ -227,6 +227,7 @@ class GitInfo { $date = false; if ( is_file( $wgGitBin ) && is_executable( $wgGitBin ) && + !Shell::isDisabled() && $this->getHead() !== false ) { $cmd = [ diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index 6f49a141e1..d9996f426f 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -121,7 +121,7 @@ function wfArrayDiff2_cmp( $a, $b ) { if ( is_string( $a ) && is_string( $b ) ) { return strcmp( $a, $b ); } elseif ( count( $a ) !== count( $b ) ) { - return count( $a ) < count( $b ) ? -1 : 1; + return count( $a ) <=> count( $b ); } else { reset( $a ); reset( $b ); @@ -1336,21 +1336,19 @@ function wfGetLangObj( $langcode = false ) { * This function replaces all old wfMsg* functions. * * @param string|string[]|MessageSpecifier $key Message key, or array of keys, or a MessageSpecifier - * @param mixed $params,... Normal message parameters + * @param string|string[] ...$params Normal message parameters * @return Message * * @since 1.17 * * @see Message::__construct */ -function wfMessage( $key /*...*/ ) { +function wfMessage( $key, ...$params ) { $message = new Message( $key ); // We call Message::params() to reduce code duplication - $params = func_get_args(); - array_shift( $params ); if ( $params ) { - call_user_func_array( [ $message, 'params' ], $params ); + $message->params( ...$params ); } return $message; @@ -1361,16 +1359,15 @@ function wfMessage( $key /*...*/ ) { * for the first message which is non-empty. If all messages are empty then an * instance of the first message key is returned. * - * @param string|string[] $keys,... Message keys + * @param string ...$keys Message keys * @return Message * * @since 1.18 * * @see Message::newFallbackSequence */ -function wfMessageFallback( /*...*/ ) { - $args = func_get_args(); - return call_user_func_array( 'Message::newFallbackSequence', $args ); +function wfMessageFallback( ...$keys ) { + return Message::newFallbackSequence( ...$keys ); } /** @@ -1516,7 +1513,7 @@ function wfBacktrace( $raw = null ) { $frames = array_map( function ( $frame ) use ( $frameFormat ) { $file = !empty( $frame['file'] ) ? basename( $frame['file'] ) : '-'; - $line = isset( $frame['line'] ) ? $frame['line'] : '-'; + $line = $frame['line'] ?? '-'; $call = $frame['function']; if ( !empty( $frame['class'] ) ) { $call = $frame['class'] . $frame['type'] . $call; @@ -2199,9 +2196,7 @@ function wfStringToBool( $val ) { * @deprecated since 1.30 use MediaWiki\Shell::escape() */ function wfEscapeShellArg( /*...*/ ) { - $args = func_get_args(); - - return call_user_func_array( Shell::class . '::escape', $args ); + return Shell::escape( ...func_get_args() ); } /** @@ -2241,7 +2236,7 @@ function wfShellExec( $cmd, &$retval = null, $environ = [], } $includeStderr = isset( $options['duplicateStderr'] ) && $options['duplicateStderr']; - $profileMethod = isset( $options['profileMethod'] ) ? $options['profileMethod'] : wfGetCaller(); + $profileMethod = $options['profileMethod'] ?? wfGetCaller(); try { $result = Shell::command( [] ) @@ -2304,7 +2299,7 @@ function wfShellWikiCmd( $script, array $parameters = [], array $options = [] ) // Give site config file a chance to run the script in a wrapper. // The caller may likely want to call wfBasename() on $script. Hooks::run( 'wfShellWikiCmd', [ &$script, &$parameters, &$options ] ); - $cmd = isset( $options['php'] ) ? [ $options['php'] ] : [ $wgPhpCli ]; + $cmd = [ $options['php'] ?? $wgPhpCli ]; if ( isset( $options['wrapper'] ) ) { $cmd[] = $options['wrapper']; } @@ -2700,10 +2695,7 @@ function wfMakeStaticArrayFile( array $data, $header = 'Automatically generated' * @return string */ function wfMemcKey( /*...*/ ) { - return call_user_func_array( - [ ObjectCache::getLocalClusterInstance(), 'makeKey' ], - func_get_args() - ); + return ObjectCache::getLocalClusterInstance()->makeKey( ...func_get_args() ); } /** @@ -2719,10 +2711,7 @@ function wfMemcKey( /*...*/ ) { function wfForeignMemcKey( $db, $prefix /*...*/ ) { $args = array_slice( func_get_args(), 2 ); $keyspace = $prefix ? "$db-$prefix" : $db; - return call_user_func_array( - [ ObjectCache::getLocalClusterInstance(), 'makeKeyInternal' ], - [ $keyspace, $args ] - ); + return ObjectCache::getLocalClusterInstance()->makeKeyInternal( $keyspace, $args ); } /** @@ -2738,10 +2727,7 @@ function wfForeignMemcKey( $db, $prefix /*...*/ ) { * @return string */ function wfGlobalCacheKey( /*...*/ ) { - return call_user_func_array( - [ ObjectCache::getLocalClusterInstance(), 'makeGlobalKey' ], - func_get_args() - ); + return ObjectCache::getLocalClusterInstance()->makeGlobalKey( ...func_get_args() ); } /** @@ -3150,17 +3136,6 @@ function wfGetMessageCacheStorage() { return ObjectCache::getInstance( $wgMessageCacheType ); } -/** - * Get the cache object used by the parser cache - * - * @deprecated since 1.30, use MediaWikiServices::getParserCache()->getCacheStorage() - * @return BagOStuff - */ -function wfGetParserCacheStorage() { - global $wgParserCacheType; - return ObjectCache::getInstance( $wgParserCacheType ); -} - /** * Call hook functions defined in $wgHooks * diff --git a/includes/Hooks.php b/includes/Hooks.php index c22dc97f46..d434120012 100644 --- a/includes/Hooks.php +++ b/includes/Hooks.php @@ -47,10 +47,6 @@ class Hooks { * @since 1.18 */ public static function register( $name, $callback ) { - if ( !isset( self::$handlers[$name] ) ) { - self::$handlers[$name] = []; - } - self::$handlers[$name][] = $callback; } @@ -62,6 +58,7 @@ class Hooks { * * @since 1.21 * @throws MWException If not in testing mode. + * @codeCoverageIgnore */ public static function clear( $name ) { if ( !defined( 'MW_PHPUNIT_TEST' ) && !defined( 'MW_PARSER_TEST' ) ) { diff --git a/includes/Html.php b/includes/Html.php index 019e0785f9..0016426f54 100644 --- a/includes/Html.php +++ b/includes/Html.php @@ -391,8 +391,8 @@ class Html { unset( $attribs['type'] ); } if ( $element === 'input' ) { - $type = isset( $attribs['type'] ) ? $attribs['type'] : null; - $value = isset( $attribs['value'] ) ? $attribs['value'] : null; + $type = $attribs['type'] ?? null; + $value = $attribs['value'] ?? null; if ( $type === 'checkbox' || $type === 'radio' ) { // The default value for checkboxes and radio buttons is 'on' // not ''. By stripping value="" we break radio boxes that @@ -925,9 +925,9 @@ class Html { if ( isset( $params['label'] ) ) { $ret .= self::element( 'label', [ - 'for' => isset( $selectAttribs['id'] ) ? $selectAttribs['id'] : null, + 'for' => $selectAttribs['id'] ?? null, ], $params['label'] - ) . ' '; + ) . "\u{00A0}"; } // Wrap options in a and on the