source 'https://rubygems.org'
-gem 'mediawiki_selenium', '~> 1.7', '>= 1.7.4'
+gem 'mediawiki_selenium', '~> 1.8'
gem 'rake', '~> 11.1', '>= 11.1.1'
gem 'rubocop', '~> 0.32.1', require: false
ast (2.0.0)
astrolabe (1.3.0)
parser (>= 2.2.0.pre.3, < 3.0)
- builder (3.2.2)
- childprocess (0.5.9)
+ builder (3.2.3)
+ childprocess (0.6.2)
ffi (~> 1.0, >= 1.0.11)
cucumber (1.3.20)
builder (>= 2.1.2)
data_magic (1.0)
faker (>= 1.1.2)
yml_reader (>= 0.6)
- diff-lcs (1.2.5)
- domain_name (0.5.20161129)
+ diff-lcs (1.3)
+ domain_name (0.5.20170223)
unf (>= 0.0.5, < 1.0.0)
- faker (1.7.1)
+ faker (1.7.3)
i18n (~> 0.5)
- faraday (0.10.0)
+ faraday (0.11.0)
multipart-post (>= 1.2, < 3)
faraday-cookie_jar (0.0.6)
faraday (>= 0.7.4)
http-cookie (~> 1.0.0)
- faraday_middleware (0.10.1)
+ faraday_middleware (0.11.0.1)
faraday (>= 0.7.4, < 1.0)
- ffi (1.9.14)
+ ffi (1.9.17)
gherkin (2.12.2)
multi_json (~> 1.3)
headless (2.3.1)
http-cookie (1.0.3)
domain_name (~> 0.5)
- i18n (0.7.0)
- json (2.0.2)
- mediawiki_api (0.7.0)
+ i18n (0.8.1)
+ json (2.0.3)
+ mediawiki_api (0.7.1)
faraday (~> 0.9, >= 0.9.0)
faraday-cookie_jar (~> 0.0, >= 0.0.6)
faraday_middleware (~> 0.10, >= 0.10.0)
- mediawiki_selenium (1.7.4)
+ mediawiki_selenium (1.8.0)
cucumber (~> 1.3, >= 1.3.20)
headless (~> 2.0, >= 2.1.0)
json (~> 2.0, >= 2.0.2)
mediawiki_api (~> 0.7, >= 0.7.0)
- page-object (~> 1.0)
+ page-object (~> 2.0)
rest-client (~> 1.6, >= 1.6.7)
rspec-core (~> 2.14, >= 2.14.4)
rspec-expectations (~> 2.14, >= 2.14.4)
- selenium-webdriver (< 3)
+ selenium-webdriver (~> 3.1.0)
syntax (~> 1.2, >= 1.2.0)
thor (~> 0.19, >= 0.19.1)
mime-types (2.99.3)
multipart-post (2.0.0)
net-http-persistent (2.9.4)
netrc (0.11.0)
- page-object (1.2.2)
+ page-object (2.0.0)
net-http-persistent (~> 2.9.4)
page_navigation (>= 0.9)
- selenium-webdriver (>= 2.53.0)
- watir-webdriver (>= 0.6.11, < 0.9.9)
+ selenium-webdriver (~> 3.0)
+ watir (~> 6.0)
page_navigation (0.10)
data_magic (>= 0.22)
parser (2.2.2.6)
rainbow (>= 1.99.1, < 3.0)
ruby-progressbar (~> 1.4)
ruby-progressbar (1.7.5)
- rubyzip (1.2.0)
- selenium-webdriver (2.53.4)
+ rubyzip (1.2.1)
+ selenium-webdriver (3.1.0)
childprocess (~> 0.5)
rubyzip (~> 1.0)
websocket (~> 1.0)
unf (0.1.4)
unf_ext
unf_ext (0.0.7.2)
- watir-webdriver (0.9.3)
- selenium-webdriver (>= 2.46.2)
- websocket (1.2.3)
+ watir (6.2.0)
+ selenium-webdriver (~> 3.0)
+ websocket (1.2.4)
yml_reader (0.7)
PLATFORMS
ruby
DEPENDENCIES
- mediawiki_selenium (~> 1.7, >= 1.7.4)
+ mediawiki_selenium (~> 1.8)
rake (~> 11.1, >= 11.1.1)
rubocop (~> 0.32.1)
BUNDLED WITH
- 1.13.7
+ 1.14.5
'FindHooks' => __DIR__ . '/maintenance/findHooks.php',
'FindMissingFiles' => __DIR__ . '/maintenance/findMissingFiles.php',
'FindOrphanedFiles' => __DIR__ . '/maintenance/findOrphanedFiles.php',
- 'FixBug20757' => __DIR__ . '/maintenance/storage/fixBug20757.php',
'FixDefaultJsonContentPages' => __DIR__ . '/maintenance/fixDefaultJsonContentPages.php',
'FixDoubleRedirects' => __DIR__ . '/maintenance/fixDoubleRedirects.php',
'FixExtLinksProtocolRelative' => __DIR__ . '/maintenance/fixExtLinksProtocolRelative.php',
+ 'FixT22757' => __DIR__ . '/maintenance/storage/fixT22757.php',
'FixTimestamps' => __DIR__ . '/maintenance/fixTimestamps.php',
'FixUserRegistration' => __DIR__ . '/maintenance/fixUserRegistration.php',
'ForeignAPIFile' => __DIR__ . '/includes/filerepo/file/ForeignAPIFile.php',
/** second table. Try to emulate child selector */
table.childemu th,
- table.childemu td {
+ table.childemu td {
border: 1px red solid;
background-color:white;
padding:1em;
$path = "/" . $path;
}
- // Check for bug 28235: QUERY_STRING overriding the correct extension
+ // Check for T30235: QUERY_STRING overriding the correct extension
$whitelist = [];
$extension = FileBackend::extensionFromPath( $path, 'rawcase' );
if ( $extension != '' ) {
}
# Be aware that the != '' check is explicit, since empty values will be
- # passed by some callers (bug 29116)
+ # passed by some callers (T31116)
if ( $vagueTarget != '' ) {
list( $target, $type ) = self::parseTarget( $vagueTarget );
switch ( $type ) {
if ( $end === null ) {
$end = $start;
}
- # Per bug 14634, we want to include relevant active rangeblocks; for
+ # Per T16634, we want to include relevant active rangeblocks; for
# rangeblocks, we want to include larger ranges which enclose the given
# range. We know that all blocks must be smaller than $wgBlockCIDRLimit,
# so we can improve performance by filtering on a LIKE clause
$affected = $dbw->affectedRows();
if ( $this->isAutoblocking() ) {
- // update corresponding autoblock(s) (bug 48813)
+ // update corresponding autoblock(s) (T50813)
$dbw->update(
'ipblocks',
$this->getAutoblockUpdateArray(),
} elseif ( $target === null && $vagueTarget == '' ) {
# We're not going to find anything useful here
# Be aware that the == '' check is explicit, since empty values will be
- # passed by some callers (bug 29116)
+ # passed by some callers (T31116)
return null;
} elseif ( in_array(
* Get all blocks that match any IP from an array of IP addresses
*
* @param array $ipChain List of IPs (strings), usually retrieved from the
- * X-Forwarded-For header of the request
+ * X-Forwarded-For header of the request
* @param bool $isAnon Exclude anonymous-only blocks if false
* @param bool $fromMaster Whether to query the master or replica DB
* @return array Array of Blocks
*
* @param array $blocks Array of Block objects
* @param array $ipChain List of IPs (strings). This is used to determine how "close"
- * a block is to the server, and if a block matches exactly, or is in a range.
- * The order is furthest from the server to nearest e.g., (Browser, proxy1, proxy2,
- * local-squid, ...)
+ * a block is to the server, and if a block matches exactly, or is in a range.
+ * The order is furthest from the server to nearest e.g., (Browser, proxy1, proxy2,
+ * local-squid, ...)
* @throws MWException
* @return Block|null The "best" block from the list
*/
$this->mSubcats = $row->cat_subcats;
$this->mFiles = $row->cat_files;
- # (bug 13683) If the count is negative, then 1) it's obviously wrong
+ # (T15683) If the count is negative, then 1) it's obviously wrong
# and should not be kept, and 2) we *probably* don't have to scan many
# rows to obtain the correct figure, so let's risk a one-time recount.
if ( $this->mPages < 0 || $this->mSubcats < 0 || $this->mFiles < 0 ) {
* to reduce disk usage, limits can only be selected from a list.
* The user preference is saved as an array offset in the database, by default
* the offset is set with $wgDefaultUserOptions['imagesize']. Make sure you
- * change it if you alter the array (see bug 8858).
+ * change it if you alter the array (see T10858).
* This is the list of settings the user can choose from:
*/
$wgImageLimits = [
* Default parameters for the "<gallery>" tag
*/
$wgGalleryOptions = [
- 'imagesPerRow' => 0, // Default number of images per-row in the gallery. 0 -> Adapt to screensize
- 'imageWidth' => 120, // Width of the cells containing images in galleries (in "px")
- 'imageHeight' => 120, // Height of the cells containing images in galleries (in "px")
- 'captionLength' => true, // Deprecated @since 1.28
- // Length to truncate filename to in caption when using "showfilename".
- // A value of 'true' will truncate the filename to one line using CSS
- // and will be the behaviour after deprecation.
- 'showBytes' => true, // Show the filesize in bytes in categories
+ // Default number of images per-row in the gallery. 0 -> Adapt to screensize
+ 'imagesPerRow' => 0,
+ // Width of the cells containing images in galleries (in "px")
+ 'imageWidth' => 120,
+ // Height of the cells containing images in galleries (in "px")
+ 'imageHeight' => 120,
+ // Length to truncate filename to in caption when using "showfilename".
+ // A value of 'true' will truncate the filename to one line using CSS
+ // and will be the behaviour after deprecation.
+ // @deprecated since 1.28
+ 'captionLength' => true,
+ // Show the filesize in bytes in categories
+ 'showBytes' => true,
'mode' => 'traditional',
];
*
* Currently this appears to work fine in all browsers, but it's disabled by
* default because it normalizes id's a bit too aggressively, breaking preexisting
- * content (particularly Cite). See bug 27733, bug 27694, bug 27474.
+ * content (particularly Cite). See T29733, T29694, T29474.
*/
$wgExperimentalHtmlIds = false;
* Attempting to create a redirect to any of the pages in this array
* will make the redirect fail.
* Userlogout is hard-coded, so it does not need to be listed here.
- * (bug 10569) Disallow Mypage and Mytalk as well.
+ * (T12569) Disallow Mypage and Mytalk as well.
*
* As of now, this only checks special pages. Redirects to pages in
* other namespaces cannot be invalidated by this variable.
],
// Linking during login is experimental, enable at your own risk - T134952
// MediaWiki\Auth\ConfirmLinkSecondaryAuthenticationProvider::class => [
- // 'class' => MediaWiki\Auth\ConfirmLinkSecondaryAuthenticationProvider::class,
- // 'sort' => 100,
+ // 'class' => MediaWiki\Auth\ConfirmLinkSecondaryAuthenticationProvider::class,
+ // 'sort' => 100,
// ],
MediaWiki\Auth\EmailNotificationSecondaryAuthenticationProvider::class => [
'class' => MediaWiki\Auth\EmailNotificationSecondaryAuthenticationProvider::class,
/**
* Port where you have HTTPS running
* Supports HTTPS on non-standard ports
- * @see bug 65184
+ * @see T67184
* @since 1.24
*/
$wgHttpsPort = 443;
$this->recreate = false;
// When creating a new section, we can preload a section title by passing it as the
- // preloadtitle parameter in the URL (Bug 13100)
+ // preloadtitle parameter in the URL (T15100)
if ( $this->section == 'new' && $request->getVal( 'preloadtitle' ) ) {
$this->sectiontitle = $request->getVal( 'preloadtitle' );
// Once wpSummary isn't being use for setting section titles, we should delete this.
// Don't save a new page if it's blank or if it's a MediaWiki:
// message with content equivalent to default (allow empty pages
- // in this case to disable messages, see bug 50124)
+ // in this case to disable messages, see T52124)
$defaultMessageText = $this->mTitle->getDefaultMessageText();
if ( $this->mTitle->getNamespace() === NS_MEDIAWIKI && $defaultMessageText !== false ) {
$defaultText = $defaultMessageText;
return;
}
- $this->showHeader();
+ $this->showHeader();
$wgOut->addHTML( $this->editFormPageTop );
if ( $this->hasPresetSummary ) {
// If a summary has been preset using &summary= we don't want to prompt for
// a different summary. Only prompt for a summary if the summary is blanked.
- // (Bug 17416)
+ // (T19416)
$this->autoSumm = md5( '' );
}
}
}
- private function incrementConflictStats() {
+ protected function incrementConflictStats() {
$stats = MediaWikiServices::getInstance()->getStatsdDataFactory();
$stats->increment( 'edit.failures.conflict' );
// Only include 'standard' namespaces to avoid creating unknown numbers of statsd metrics
if ( $html === null ) {
- // Omit large new page diffs, bug 29110
+ // Omit large new page diffs, T31110
// Also use diff link for non-textual content
$diffText = self::getDiffLink( $title, $newid );
} else {
/**
* Merge arrays in the style of getUserPermissionsErrors, with duplicate removal
* e.g.
- * wfMergeErrorArrays(
- * [ [ 'x' ] ],
- * [ [ 'x', '2' ] ],
- * [ [ 'x' ] ],
- * [ [ 'y' ] ]
- * );
+ * wfMergeErrorArrays(
+ * [ [ 'x' ] ],
+ * [ [ 'x', '2' ] ],
+ * [ [ 'x' ] ],
+ * [ [ 'y' ] ]
+ * );
* returns:
- * [
- * [ 'x', '2' ],
- * [ 'x' ],
- * [ 'y' ]
- * ]
+ * [
+ * [ 'x', '2' ],
+ * [ 'x' ],
+ * [ 'y' ]
+ * ]
*
* @param array $array1,...
* @return array
* @param string $script MediaWiki cli script path
* @param array $parameters Arguments and options to the script
* @param array $options Associative array of options:
- * 'php': The path to the php executable
- * 'wrapper': Path to a PHP wrapper to handle the maintenance script
+ * 'php': The path to the php executable
+ * 'wrapper': Path to a PHP wrapper to handle the maintenance script
* @return string
*/
function wfShellWikiCmd( $script, array $parameters = [], array $options = [] ) {
/**
* Compute a binary "Adler-32" checksum as defined by LibXDiff, i.e. with
- * the bytes backwards and initialised with 0 instead of 1. See bug 34428.
+ * the bytes backwards and initialised with 0 instead of 1. See T36428.
*
* @param string $s
* @return string|bool False if the hash extension is not available
$attribs['name'] = $name;
if ( substr( $value, 0, 1 ) == "\n" ) {
- // Workaround for bug 12130: browsers eat the initial newline
+ // Workaround for T14130: browsers eat the initial newline
// assuming that it's just for show, but they do keep the later
// newlines, which we may want to preserve during editing.
// Prepending a single newline
# ThumbnailImage::toHtml() already adds page= onto the end of DjVu URLs
# So we don't need to pass it here in $query. However, the URL for the
- # zoom icon still needs it, so we make a unique query for it. See bug 14771
+ # zoom icon still needs it, so we make a unique query for it. See T16771
$url = $title->getLocalURL( $query );
if ( $page ) {
$url = wfAppendQuery( $url, [ 'page' => $page ] );
if ( $altUserName === false ) {
$altUserName = IP::prettifyIP( $userName );
}
- $classes .= ' mw-anonuserlink'; // Separate link class for anons (bug 43179)
+ $classes .= ' mw-anonuserlink'; // Separate link class for anons (T45179)
} else {
$page = Title::makeTitle( NS_USER, $userName );
}
) {
# Sanitize text a bit:
$comment = str_replace( "\n", " ", $comment );
- # Allow HTML entities (for bug 13815)
+ # Allow HTML entities (for T15815)
$comment = Sanitizer::escapeHtmlAllowEntities( $comment );
# Render autocomments and make links:
$section = str_replace( '[[', '', $section );
$section = str_replace( ']]', '', $section );
- $section = Sanitizer::normalizeSectionNameWhitespace( $section ); # bug 22784
+ $section = Sanitizer::normalizeSectionNameWhitespace( $section ); # T24784
if ( $local ) {
$sectionTitle = Title::newFromText( '#' . $section );
} else {
} else {
$suffix = '';
}
- # bug 7425
+ # T9425
$target = trim( $target );
# Look at the first character
if ( $target != '' && $target[0] === '/' ) {
if ( $context->getRequest()->getBool( 'bot' ) ) {
$query['bot'] = '1';
- $query['hidediff'] = '1'; // bug 15999
+ $query['hidediff'] = '1'; // T17999
}
$disableRollbackEditCount = false;
* $magicWords = [];
*
* $magicWords['en'] = [
- * 'magicwordkey' => [ 0, 'case_insensitive_magic_word' ],
- * 'magicwordkey2' => [ 1, 'CASE_sensitive_magic_word2' ],
+ * 'magicwordkey' => [ 0, 'case_insensitive_magic_word' ],
+ * 'magicwordkey2' => [ 1, 'CASE_sensitive_magic_word2' ],
* ];
* @endcode
*
# multiple matched parts (variable match); some will be empty because of
# synonyms. The variable will be the second non-empty one so remove any
# blank elements and re-sort the indices.
- # See also bug 6526
+ # See also T8526
$matches = array_values( array_filter( $matches ) );
if ( $request->getCheck( 'search' ) ) {
// Compatibility with old search URLs which didn't use Special:Search
// Just check for presence here, so blank requests still
- // show the search page when using ugly URLs (bug 8054).
+ // show the search page when using ugly URLs (T10054).
$ret = SpecialPage::getTitleFor( 'Search' );
} elseif ( $curid ) {
// URLs like this are generated by RC, because rc_title isn't always accurate
$unused = null; // To pass it by reference
Hooks::run( 'BeforeInitialize', [ &$title, &$unused, &$output, &$user, $request, $this ] );
- // Invalid titles. Bug 21776: The interwikis must redirect even if the page name is empty.
+ // Invalid titles. T23776: The interwikis must redirect even if the page name is empty.
if ( is_null( $title ) || ( $title->getDBkey() == '' && !$title->isExternal() )
|| $title->isSpecial( 'Badtitle' )
) {
? [] // relies on HMAC key signature alone
: $title->getUserPermissionsErrors( 'read', $user );
if ( count( $permErrors ) ) {
- // Bug 32276: allowing the skin to generate output with $wgTitle or
+ // T34276: allowing the skin to generate output with $wgTitle or
// $this->context->title set to the input title would allow anonymous users to
// determine whether a page exists, potentially leaking private data. In fact, the
// curid and oldid request parameters would allow page titles to be enumerated even
try {
$this->main();
} catch ( ErrorPageError $e ) {
- // Bug 62091: while exceptions are convenient to bubble up GUI errors,
+ // T64091: while exceptions are convenient to bubble up GUI errors,
// they are not internal application faults. As with normal requests, this
// should commit, print the output, do deferred updates, jobs, and profiling.
$this->doPreOutputCommit();
$defaultContentModelChanging = ( $oldDefault !== $newDefault
&& $oldDefault === $contentModel );
- // bug 57084: log_page should be the ID of the *moved* page
+ // T59084: log_page should be the ID of the *moved* page
$oldid = $this->oldTitle->getArticleID();
$logTitle = clone $this->oldTitle;
);
if ( !$redirectContent ) {
- // Clean up the old title *before* reset article id - bug 45348
+ // Clean up the old title *before* reset article id - T47348
WikiPage::onArticleDelete( $this->oldTitle );
}
$this->oldTitle->resetArticleID( 0 ); // 0 == non existing
$nt->resetArticleID( $oldid );
- $newpage->loadPageData( WikiPage::READ_LOCKING ); // bug 46397
+ $newpage->loadPageData( WikiPage::READ_LOCKING ); // T48397
$newpage->updateRevisionOn( $dbw, $nullRevision );
# Recreate the redirect, this time in the other direction.
if ( $redirectContent ) {
$redirectArticle = WikiPage::factory( $this->oldTitle );
- $redirectArticle->loadFromRow( false, WikiPage::READ_LOCKING ); // bug 46397
+ $redirectArticle->loadFromRow( false, WikiPage::READ_LOCKING ); // T48397
$newid = $redirectArticle->insertOn( $dbw );
if ( $newid ) { // sanity
$this->oldTitle->resetArticleID( $newid );
* @file
*/
-# bug 30219 : can not use pathinfo() on URLs since slashes do not match
+# T32219 : can not use pathinfo() on URLs since slashes do not match
$matches = [];
$ext = 'php';
$path = '/';
'epoch' => $config->get( 'CacheEpoch' )
];
if ( $config->get( 'UseSquid' ) ) {
- // bug 44570: the core page itself may not change, but resources might
+ // T46570: the core page itself may not change, but resources might
$modifiedTimes['sepoch'] = wfTimestamp( TS_MW, time() - $config->get( 'SquidMaxage' ) );
}
Hooks::run( 'OutputPageCheckLastModified', [ &$modifiedTimes, $this ] );
ResourceLoaderModule::ORIGIN_CORE_INDIVIDUAL
);
- // Site-wide styles are controlled by a config setting, see bug 71621
+ // Site-wide styles are controlled by a config setting, see T73621
// for background on why. User styles are never allowed.
if ( $this->getConfig()->get( 'AllowSiteCSSOnRestrictedPages' ) ) {
$styleOrigin = ResourceLoaderModule::ORIGIN_USER_SITEWIDE;
) {
$displayReturnto = null;
- # Due to bug 32276, if a user does not have read permissions,
+ # Due to T34276, if a user does not have read permissions,
# $this->getTitle() will just give Special:Badtitle, which is
# not especially useful as a returnto parameter. Use the title
# from the request instead, if there was one.
$curRevisionId = 0;
$articleId = 0;
- $canonicalSpecialPageName = false; # bug 21115
+ $canonicalSpecialPageName = false; # T23115
$title = $this->getTitle();
$ns = $title->getNamespace();
$sk = $this->getSkin();
// Get the relevant title so that AJAX features can use the correct page name
- // when making API requests from certain special pages (bug 34972).
+ // when making API requests from certain special pages (T36972).
$relevantTitle = $sk->getRelevantTitle();
$relevantUser = $sk->getRelevantUser();
* $wgOut->addWikiText( "<div class='error'>\n"
* . wfMessage( 'some-error' )->plain() . "\n</div>" );
*
- * The newline after the opening div is needed in some wikitext. See bug 19226.
+ * The newline after the opening div is needed in some wikitext. See T21226.
*
* @param string $wrap
*/
* @return $this
*/
function checkRequiredPHPVersion() {
- if ( !function_exists( 'version_compare' )
- || version_compare( $this->getPHPImplVersion(), $this->minimumVersionPHP ) < 0
+ if (
+ !function_exists( 'version_compare' )
+ || version_compare( $this->getPHPImplVersion(), $this->minimumVersionPHP ) < 0
) {
$shortText = "MediaWiki $this->mwVersion requires at least PHP version"
- . " $this->minimumVersionPHP, you are using PHP {$this->getPHPImplVersion()}.";
+ . " $this->minimumVersionPHP, you are using PHP {$this->getPHPImplVersion()}.";
$longText = "Error: You might be using on older PHP version. \n"
- . "MediaWiki $this->mwVersion needs PHP $this->minimumVersionPHP or higher.\n\n"
- . "Check if you have a newer php executable with a different name, "
- . "such as php5.\n\n";
+ . "MediaWiki $this->mwVersion needs PHP $this->minimumVersionPHP or higher.\n\n"
+ . "Check if you have a newer php executable with a different name, "
+ . "such as php5.\n\n";
$longHtml = <<<HTML
Please consider <a href="http://www.php.net/downloads.php">upgrading your copy of PHP</a>.
$shortText = "Installing some external dependencies (e.g. via composer) is required.";
$longText = "Error: You are missing some external dependencies. \n"
- . "MediaWiki now also has some external dependencies that need to be installed\n"
- . "via composer or from a separate git repo. Please see\n"
- . "https://www.mediawiki.org/wiki/Download_from_Git#Fetch_external_libraries\n"
- . "for help on installing the required components.";
+ . "MediaWiki now also has some external dependencies that need to be installed\n"
+ . "via composer or from a separate git repo. Please see\n"
+ . "https://www.mediawiki.org/wiki/Download_from_Git#Fetch_external_libraries\n"
+ . "for help on installing the required components.";
$longHtml = <<<HTML
MediaWiki now also has some external dependencies that need to be installed via
foreach ( $missingExtensions as $ext ) {
$missingExtText .= " * $ext <$baseUrl/$ext>\n";
$missingExtHtml .= "<li><b>$ext</b> "
- . "(<a href=\"$baseUrl/$ext\">more information</a>)</li>";
+ . "(<a href=\"$baseUrl/$ext\">more information</a>)</li>";
}
$cliText = "Error: Missing one or more required components of PHP.\n"
- . "You are missing a required extension to PHP that MediaWiki needs.\n"
- . "Please install:\n" . $missingExtText;
+ . "You are missing a required extension to PHP that MediaWiki needs.\n"
+ . "Please install:\n" . $missingExtText;
$longHtml = <<<HTML
You are missing a required extension to PHP that MediaWiki
}
$encLogo =
htmlspecialchars( str_replace( '//', '/', $dirname . '/' ) .
- 'resources/assets/mediawiki.png' );
+ 'resources/assets/mediawiki.png' );
$shortHtml = htmlspecialchars( $shortText );
header( 'Content-type: text/html; charset=UTF-8' );
}
}
- # # Make sure that form fields have their parent set. See bug 41337.
+ # # Make sure that form fields have their parent set. See T43337.
$dummyForm = new HTMLForm( [], $context );
$disable = !$user->isAllowed( 'editmyoptions' );
if ( $dateopts ) {
if ( !in_array( 'default', $dateopts ) ) {
- $dateopts[] = 'default'; // Make sure default is always valid
- // Bug 19237
+ $dateopts[] = 'default'; // Make sure default is always valid T21237
}
// FIXME KLUGE: site default might not be valid for user language
}
}
- # normalize searchKey, so aliases with spaces can be found - bug 25675
+ # normalize searchKey, so aliases with spaces can be found - T27675
$searchKey = str_replace( ' ', '_', $searchKey );
$searchKey = $wgContLang->caseFold( $searchKey );
}
foreach ( $wgContLang->getSpecialPageAliases() as $page => $aliases ) {
- if ( !in_array( $page, SpecialPageFactory::getNames() ) ) {# bug 20885
+ if ( !in_array( $page, SpecialPageFactory::getNames() ) ) {# T22885
continue;
}
$matches = [];
foreach ( $keys as $pageKey => $page ) {
if ( $searchKey === '' || strpos( $pageKey, $searchKey ) === 0 ) {
- // bug 27671: Don't use SpecialPage::getTitleFor() here because it
+ // T29671: Don't use SpecialPage::getTitleFor() here because it
// localizes its input leading to searches for e.g. Special:All
// returning Spezial:MediaWiki-Systemnachrichten and returning
// Spezial:Alle_Seiten twice when $wgLanguageCode == 'de'
// Pre-1.5 ar_text row
$attribs['text'] = self::getRevisionText( $row, 'ar_' );
if ( $attribs['text'] === false ) {
- throw new MWException( 'Unable to load text from archive row (possibly bug 22624)' );
+ throw new MWException( 'Unable to load text from archive row (possibly T24624)' );
}
}
return new self( $attribs );
$space = '[\x09\x0a\x0c\x0d\x20]';
self::$attribsRegex =
"/(?:^|$space)({$attribFirst}{$attrib}*)
- ($space*=$space*
+ ($space*=$space*
(?:
- # The attribute value: quoted or alone
- \"([^\"]*)(?:\"|\$)
- | '([^']*)(?:'|\$)
- | (((?!$space|>).)*)
+ # The attribute value: quoted or alone
+ \"([^\"]*)(?:\"|\$)
+ | '([^']*)(?:'|\$)
+ | (((?!$space|>).)*)
)
)?(?=$space|\$)/sx";
}
$badtag = true;
} elseif ( in_array( $t, $tagstack ) && !isset( $htmlnest[$t] ) ) {
$badtag = true;
- # Is it a self closed htmlpair ? (bug 5487)
+ # Is it a self closed htmlpair ? (T7487)
} elseif ( $brace == '/>' && isset( $htmlpairs[$t] ) ) {
// Eventually we'll just remove the self-closing
// slash, in order to be consistent with HTML5
// Normalize Halfwidth and Fullwidth Unicode block that IE6 might treat as ascii
$value = preg_replace_callback(
- '/[!-[]-z]/u', // U+FF01 to U+FF5A, excluding U+FF3C (bug 58088)
+ '/[!-[]-z]/u', // U+FF01 to U+FF5A, excluding U+FF3C (T60088)
function ( $matches ) {
$cp = UtfNormal\Utils::utf8ToCodepoint( $matches[0] );
if ( $cp === false ) {
/**
* Decode any character references, numeric or named entities,
- * in the next and normalize the resulting string. (bug 14952)
+ * in the next and normalize the resulting string. (T16952)
*
* This is useful for page titles, not for text to be displayed,
* MediaWiki allows HTML entities to escape normalization as a feature.
* 3.5.
*
* This function is an implementation of the specification as requested in
- * bug 22449.
+ * T24449.
*
* Client-side forms will use the same standard validation rules via JS or
* HTML 5 validation; additional restrictions can be enforced server-side
// Please note strings below are enclosed in brackets [], this make the
// hyphen "-" a range indicator. Hence it is double backslashed below.
- // See bug 26948
+ // See T28948
$rfc5322_atext = "a-z0-9!#$%&'*+\\-\/=?^_`{|}~";
$rfc1034_ldh_str = "a-z0-9\\-";
$wgUseEnotif = $wgEnotifUserTalk || $wgEnotifWatchlist;
} else {
// Disable all other email settings automatically if $wgEnableEmail
- // is set to false. - bug 63678
+ // is set to false. - T65678
$wgAllowHTMLEmail = false;
$wgEmailAuthentication = false; // do not require auth if you're not sending email anyway
$wgEnableUserEmail = false;
/**
* @var int Namespace index when there is no namespace. Don't change the
- * following default, NS_MAIN is hardcoded in several places. See bug 696.
+ * following default, NS_MAIN is hardcoded in several places. See T2696.
* Zero except in {{transclusion}} tags.
*/
public $mDefaultNamespace = NS_MAIN;
}
}
- // Convert things like é ā or 〗 into normalized (bug 14952) text
+ // Convert things like é ā or 〗 into normalized (T16952) text
$filteredText = Sanitizer::decodeCharReferencesAndNormalize( $text );
$t = new Title();
}
$newPageName = preg_replace(
'#^' . preg_quote( $this->getDBkey(), '#' ) . '#',
- StringUtils::escapeRegexReplacement( $nt->getDBkey() ), # bug 21234
+ StringUtils::escapeRegexReplacement( $nt->getDBkey() ), # T23234
$oldSubpage->getDBkey() );
if ( $oldSubpage->isTalkPage() ) {
$newNs = $nt->getTalkPage()->getNamespace();
} else {
$newNs = $nt->getSubjectPage()->getNamespace();
}
- # Bug 14385: we need makeTitleSafe because the new page names may
+ # T16385: we need makeTitleSafe because the new page names may
# be longer than 255 characters.
$newSubpage = Title::makeTitleSafe( $newNs, $newPageName );
* categories' names.
*
* @return array Array of parents in the form:
- * $parent => $currentarticle
+ * $parent => $currentarticle
*/
public function getParentCategories() {
global $wgContLang;
$conds[] = 'rc_user_text != ' . $db->addQuotes( $options['notByUser'] );
}
- // Avoid brute force searches (bug 17342)
+ // Avoid brute force searches (T19342)
$bitmask = 0;
if ( !$user->isAllowed( 'deletedhistory' ) ) {
$bitmask = Revision::DELETED_USER;
$host = $parts[0];
if ( $wgAssumeProxiesUseDefaultProtocolPorts && isset( $_SERVER['HTTP_X_FORWARDED_PROTO'] ) ) {
- // Bug 70021: Assume that upstream proxy is running on the default
+ // T72021: Assume that upstream proxy is running on the default
// port based on the protocol. We have no reliable way to determine
// the actual port in use upstream.
$port = $stdPort;
* available variant URLs.
*/
public function interpolateTitle() {
- // bug 16019: title interpolation on API queries is useless and sometimes harmful
+ // T18019: title interpolation on API queries is useless and sometimes harmful
if ( defined( 'MW_API' ) ) {
return;
}
if (
IP::isPublic( $ipchain[$i + 1] ) ||
$wgUsePrivateIPs ||
- $proxyLookup->isConfiguredProxy( $curIP ) // bug 48919; treat IP as sane
+ $proxyLookup->isConfiguredProxy( $curIP ) // T50919; treat IP as sane
) {
// Follow the next IP according to the proxy
$nextIP = IP::canonicalize( $ipchain[$i + 1] );
die( 'MediaWiki does not support installations where mbstring.func_overload is non-zero.' );
}
-# bug 15461: Make IE8 turn off content sniffing. Everybody else should ignore this
+# T17461: Make IE8 turn off content sniffing. Everybody else should ignore this
# We're adding it here so that it's *always* set, even for alternate entry
# points and when $wgOut gets disabled or overridden.
header( 'X-Content-Type-Options: nosniff' );
* @return array
*/
public function extractRequestParams( $parseLimit = true ) {
- // Cache parameters, for performance and to avoid bug 24564.
+ // Cache parameters, for performance and to avoid T26564.
if ( !isset( $this->mParamCache[$parseLimit] ) ) {
$params = $this->getFinalParams();
$results = [];
}
if ( !$allowMultiple && count( $valuesList ) != 1 ) {
- // Bug 33482 - Allow entries with | in them for non-multiple values
+ // T35482 - Allow entries with | in them for non-multiple values
if ( in_array( $value, $allowedValues, true ) ) {
return $value;
}
$this->requireOnlyOneParameter( $params, 'user', 'userid' );
- # bug 15810: blocked admins should have limited access here
+ # T17810: blocked admins should have limited access here
if ( $user->isBlocked() ) {
$status = SpecialBlock::checkUnblockSelf( $params['user'], $user );
if ( $status !== true ) {
} else {
$target = User::newFromName( $params['user'] );
- // Bug 38633 - if the target is a user (not an IP address), but it
+ // T40633 - if the target is a user (not an IP address), but it
// doesn't exist or is unusable, error.
if ( $target instanceof User &&
( $target->isAnon() /* doesn't exist */ || !User::isUsableName( $target->getName() ) )
$this->getMain()->setCacheMode( 'public' );
if ( !$this->getMain()->getParameter( 'smaxage' ) ) {
- // bug 63249: This page gets hit a lot, cache at least 15 seconds.
+ // T65249: This page gets hit a lot, cache at least 15 seconds.
$this->getMain()->setCacheMaxAge( 15 );
}
$this->getMain()->getRequest()->response()->header( "Content-Type: $mime; charset=utf-8" );
- // Set X-Frame-Options API results (bug 39180)
+ // Set X-Frame-Options API results (T41180)
$apiFrameOptions = $this->getConfig()->get( 'ApiFrameOptions' );
if ( $apiFrameOptions ) {
$this->getMain()->getRequest()->response()->header( "X-Frame-Options: $apiFrameOptions" );
false, FormatJson::ALL_OK
);
- // Bug 66776: wfMangleFlashPolicy() is needed to avoid a nasty bug in
+ // T68776: wfMangleFlashPolicy() is needed to avoid a nasty bug in
// Flash, but what it does isn't friendly for the API, so we need to
// work around it.
if ( preg_match( '/\<\s*cross-domain-policy\s*\>/i', $json ) ) {
$data = $this->getResult()->getResultData( null, $transform );
$json = FormatJson::encode( $data, $this->getIsHtml(), $opt );
- // Bug 66776: wfMangleFlashPolicy() is needed to avoid a nasty bug in
+ // T68776: wfMangleFlashPolicy() is needed to avoid a nasty bug in
// Flash, but what it does isn't friendly for the API, so we need to
// work around it.
if ( preg_match( '/\<\s*cross-domain-policy(?=\s|\>)/i', $json ) ) {
if ( isset( $params['callback'] ) ) {
$callback = preg_replace( "/[^][.\\'\\\"_A-Za-z0-9]/", '', $params['callback'] );
# Prepend a comment to try to avoid attacks against content
- # sniffers, such as bug 68187.
+ # sniffers, such as T70187.
$this->printText( "/**/$callback($json)" );
} else {
$this->printText( $json );
}
$text = serialize( $this->getResult()->getResultData( null, $transforms ) );
- // Bug 66776: wfMangleFlashPolicy() is needed to avoid a nasty bug in
+ // T68776: wfMangleFlashPolicy() is needed to avoid a nasty bug in
// Flash, but what it does isn't friendly for the API. There's nothing
// we can do here that isn't actively broken in some manner, so let's
// just be broken in a useful manner.
case 'Aborted':
$result['reason'] = 'Authentication requires user interaction, ' .
- 'which is not supported by action=login.';
+ 'which is not supported by action=login.';
if ( $this->getConfig()->get( 'EnableBotPasswords' ) ) {
$result['reason'] .= ' To be able to login with action=login, see [[Special:BotPasswords]].';
$result['reason'] .= ' To continue using main-account login, see action=clientlogin.';
* @param Exception $e
*/
protected function handleException( Exception $e ) {
- // Bug 63145: Rollback any open database transactions
+ // T65145: Rollback any open database transactions
if ( !( $e instanceof ApiUsageException || $e instanceof UsageException ) ) {
// UsageExceptions are intentional, so don't rollback if that's the case
try {
$ret = $this->getRequest()->getVal( $name );
if ( $ret === null ) {
if ( $this->getRequest()->getArray( $name ) !== null ) {
- // See bug 10262 for why we don't just implode( '|', ... ) the
+ // See T12262 for why we don't just implode( '|', ... ) the
// array.
$this->addWarning( [ 'apiwarn-unsupportedarray', $name ] );
}
// a redirect to the new title. This is not safe, but what we did before was
// even worse: we just determined whether a redirect should have been created,
// and reported that it was created if it should have, without any checks.
- // Also note that isRedirect() is unreliable because of bug 37209.
+ // Also note that isRedirect() is unreliable because of T39209.
$r['redirectcreated'] = $fromTitle->exists();
$r['moveoverredirect'] = $toTitleExists;
* @return array
*/
private static function getPositiveIntegers( $array ) {
- // bug 25734 API: possible issue with revids validation
+ // T27734 API: possible issue with revids validation
// It seems with a load of revision rows, MySQL gets upset
// Remove any < 0 integers, as they can't be valid
foreach ( $array as $i => $int ) {
}
if ( !is_null( $params['user'] ) || !is_null( $params['excludeuser'] ) ) {
- // Paranoia: avoid brute force searches (bug 17342)
+ // Paranoia: avoid brute force searches (T19342)
// (shouldn't be able to get here without 'deletedhistory', but
// check it again just in case)
if ( !$user->isAllowed( 'deletedhistory' ) ) {
}
if ( $params['user'] !== null || $params['excludeuser'] !== null ) {
- // Paranoia: avoid brute force searches (bug 17342)
+ // Paranoia: avoid brute force searches (T19342)
if ( !$this->getUser()->isAllowed( 'deletedhistory' ) ) {
$bitmask = Revision::DELETED_USER;
} elseif ( !$this->getUser()->isAllowedAny( 'suppressrevision', 'viewsuppressed' ) ) {
],
] ] );
- // Actually count the actions using a subquery (bug 64505 and bug 64507)
+ // Actually count the actions using a subquery (T66505 and T66507)
$timestamp = $db->timestamp( wfTimestamp( TS_UNIX ) - $activeUserSeconds );
$this->addFields( [
'recentactions' => '(' . $db->selectSQLText(
if ( $this->params['filterredir'] == 'redirects' ) {
$this->addWhereFld( 'page_is_redirect', 1 );
} elseif ( $this->params['filterredir'] == 'nonredirects' && !$this->redirect ) {
- // bug 22245 - Check for !redirect, as filtering nonredirects, when
+ // T24245 - Check for !redirect, as filtering nonredirects, when
// getting what links to them is contradictory
$this->addWhereFld( 'page_is_redirect', 0 );
}
}
if ( !is_null( $params['user'] ) || !is_null( $params['excludeuser'] ) ) {
- // Paranoia: avoid brute force searches (bug 17342)
+ // Paranoia: avoid brute force searches (T19342)
// (shouldn't be able to get here without 'deletedhistory', but
// check it again just in case)
if ( !$user->isAllowed( 'deletedhistory' ) ) {
}
if ( !is_null( $params['user'] ) || !is_null( $params['excludeuser'] ) ) {
- // Paranoia: avoid brute force searches (bug 17342)
+ // Paranoia: avoid brute force searches (T19342)
// (shouldn't be able to get here without 'deletedhistory', but
// check it again just in case)
if ( !$user->isAllowed( 'deletedhistory' ) ) {
if ( $mto && !$mto->isError() ) {
$vals['thumburl'] = wfExpandUrl( $mto->getUrl(), PROTO_CURRENT );
- // bug 23834 - If the URL's are the same, we haven't resized it, so shouldn't give the wanted
+ // T25834 - If the URLs are the same, we haven't resized it, so shouldn't give the wanted
// thumbnail sizes for the thumbnail actual size
if ( $mto->getUrl() !== $file->getUrl() ) {
$vals['thumbwidth'] = intval( $mto->getWidth() );
$this->addWhere( 'log_title ' . $db->buildLike( $title->getDBkey(), $db->anyString() ) );
}
- // Paranoia: avoid brute force searches (bug 17342)
+ // Paranoia: avoid brute force searches (T19342)
if ( $params['namespace'] !== null || !is_null( $title ) || !is_null( $user ) ) {
if ( !$this->getUser()->isAllowed( 'deletedhistory' ) ) {
$titleBits = LogPage::DELETED_ACTION;
/* Build our basic query. Namely, something along the lines of:
* SELECT * FROM recentchanges WHERE rc_timestamp > $start
- * AND rc_timestamp < $end AND rc_namespace = $namespace
+ * AND rc_timestamp < $end AND rc_namespace = $namespace
*/
$this->addTables( 'recentchanges' );
$this->addTimestampWhereRange( 'rc_timestamp', $params['dir'], $params['start'], $params['end'] );
$this->addWhereFld( 'ct_tag', $params['tag'] );
}
- // Paranoia: avoid brute force searches (bug 17342)
+ // Paranoia: avoid brute force searches (T19342)
if ( !is_null( $params['user'] ) || !is_null( $params['excludeuser'] ) ) {
if ( !$user->isAllowed( 'deletedhistory' ) ) {
$bitmask = Revision::DELETED_USER;
}
}
if ( $params['user'] !== null || $params['excludeuser'] !== null ) {
- // Paranoia: avoid brute force searches (bug 17342)
+ // Paranoia: avoid brute force searches (T19342)
if ( !$this->getUser()->isAllowed( 'deletedhistory' ) ) {
$bitmask = Revision::DELETED_USER;
} elseif ( !$this->getUser()->isAllowedAny( 'suppressrevision', 'viewsuppressed' ) ) {
}
public function appendProtocols( $property ) {
- // Make a copy of the global so we don't try to set the _element key of it - bug 45130
+ // Make a copy of the global so we don't try to set the _element key of it - T47130
$protocols = array_values( $this->getConfig()->get( 'UrlProtocols' ) );
ApiResult::setArrayType( $protocols, 'BCarray' );
ApiResult::setIndexedTagName( $protocols, 'p' );
}
}
if ( is_array( $value ) ) {
- // Work around PHP bug 45959 by copying to a temporary
+ // Work around https://bugs.php.net/bug.php?id=45959 by copying to a temporary
// (in this case, foreach gets $k === "1" but $tmp[$k] assigns as if $k === 1)
$tmp = [];
foreach ( $value as $k => $v ) {
if ( !$user->isAllowed( 'block' ) ) {
$this->dieWithError( 'apierror-permissiondenied-unblock', 'permissiondenied' );
}
- # bug 15810: blocked admins should have limited access here
+ # T17810: blocked admins should have limited access here
if ( $user->isBlocked() ) {
$status = SpecialBlock::checkUnblockSelf( $params['user'], $user );
if ( $status !== true ) {
// 4) ... finally fetch from the slow database :(
$cacheEntry = [ 'numRows' => 0, 'batches' => [] ]; // final result
- // Do the selects in batches to avoid client-side OOMs (bug 43452).
+ // Do the selects in batches to avoid client-side OOMs (T45452).
// Use a LIMIT that plays well with $batchSize to keep equal sized partitions.
$selectSize = max( $batchSize, 200000 - ( 200000 % $batchSize ) );
$start = false;
if ( $feedAge < $wgFeedCacheTimeout || $feedLastmodUnix > $lastmodUnix ) {
wfDebug( "RC: loading feed from cache ($key; $feedLastmod; $lastmod)...\n" );
if ( $feedLastmodUnix < $lastmodUnix ) {
- $wgOut->setLastModified( $feedLastmod ); // bug 21916
+ $wgOut->setLastModified( $feedLastmod ); // T23916
}
return $cache->get( $key );
} else {
&& $block[0]->mAttribs['rc_timestamp'] >= $block[0]->watched
) {
$tableClasses[] = 'mw-changeslist-line-watched';
- $tableClasses = array_merge( $tableClasses, $this->getHTMLClassesForFilters( $block[0] ) );
} else {
$tableClasses[] = 'mw-changeslist-line-not-watched';
}
if ( $rcObj->watched
&& $rcObj->mAttribs['rc_timestamp'] >= $rcObj->watched
) {
- $classes[] = [ 'mw-enhanced-watched' ];
+ $classes[] = 'mw-enhanced-watched';
}
$classes = array_merge( $classes, $this->getHTMLClassesForFilters( $rcObj ) );
public function recentChangesLine( &$rc, $watched = false, $linenumber = null ) {
$classes = $this->getHTMLClasses( $rc, $watched );
- // use mw-line-even/mw-line-odd class only if linenumber is given (feature from bug 14468)
+ // use mw-line-even/mw-line-odd class only if linenumber is given (feature from T16468)
if ( $linenumber ) {
if ( $linenumber & 1 ) {
$classes[] = 'mw-line-odd';
*/
/**
- * Workaround for incorrect collation of Estonian language ('et') in ICU (bug 54168).
+ * Workaround for incorrect collation of Estonian language ('et') in ICU (T56168).
*
* 'W' and 'V' should not be considered the same letter for the purposes of collation in modern
* Estonian. We work around this by replacing 'W' and 'w' with 'ᴡ' U+1D21 'LATIN LETTER SMALL
* can't be determined.
*
* The constant INTL_ICU_VERSION this function refers to isn't really
- * documented. It is available since PHP 5.3.7 (see PHP bug 54561).
- * This function will return false on older PHPs.
+ * documented. It is available since PHP 5.3.7 (see PHP 54561
+ * https://bugs.php.net/bug.php?id=54561). This function will return
+ * false on older PHPs.
+ *
+ * TODO: Remove the backwards-compatibility as MediaWiki now requires
+ * higher levels of PHP.
*
* @since 1.21
* @return string|bool
$onlyAuthor = $row->rev_user_text;
// Try to find a second contributor
foreach ( $res as $row ) {
- if ( $row->rev_user_text != $onlyAuthor ) { // Bug 22999
+ if ( $row->rev_user_text != $onlyAuthor ) { // T24999
$onlyAuthor = false;
break;
}
* @return array Map of name=>value for fields
* @since 1.28
*/
- public function getDataForSearchIndex( WikiPage $page, ParserOutput $output,
- SearchEngine $engine ) {
+ public function getDataForSearchIndex(
+ WikiPage $page,
+ ParserOutput $output,
+ SearchEngine $engine
+ ) {
$fieldData = [];
$content = $page->getContent();
return $fields;
}
- public function getDataForSearchIndex( WikiPage $page, ParserOutput $parserOutput,
- SearchEngine $engine ) {
+ public function getDataForSearchIndex(
+ WikiPage $page,
+ ParserOutput $parserOutput,
+ SearchEngine $engine
+ ) {
$fields = [];
$title = $page->getTitle();
*/
class TextContentHandler extends ContentHandler {
- // @codingStandardsIgnoreStart bug 57585
+ // @codingStandardsIgnoreStart T59585
public function __construct( $modelId = CONTENT_MODEL_TEXT, $formats = [ CONTENT_FORMAT_TEXT ] ) {
parent::__construct( $modelId, $formats );
}
return $fields;
}
- public function getDataForSearchIndex( WikiPage $page, ParserOutput $output,
- SearchEngine $engine ) {
+ public function getDataForSearchIndex(
+ WikiPage $page,
+ ParserOutput $output,
+ SearchEngine $engine
+ ) {
$fields = parent::getDataForSearchIndex( $page, $output, $engine );
$fields['language'] =
$this->getPageLanguage( $page->getTitle(), $page->getContent() )->getCode();
* @var string[] selectors to elements that are excluded entirely from search
*/
private $excludedElementSelectors = [
- 'audio', 'video', // "it looks like you don't have javascript enabled..."
- // do not need to index
- 'sup.reference', // The [1] for references
- '.mw-cite-backlink', // The ↑ next to references in the references section
- 'h1', 'h2', 'h3', // Headings are already indexed in their own field.
- 'h5', 'h6', 'h4',
- '.autocollapse', // Collapsed fields are hidden by default so we don't want them
- // showing up.
+ // "it looks like you don't have javascript enabled..." – do not need to index
+ 'audio', 'video',
+ // The [1] for references
+ 'sup.reference',
+ // The ↑ next to references in the references section
+ '.mw-cite-backlink',
+ // Headings are already indexed in their own field.
+ 'h1', 'h2', 'h3', 'h4', 'h5', 'h6',
+ // Collapsed fields are hidden by default so we don't want them showing up.
+ '.autocollapse',
];
/**
* @var string[] selectors to elements that are considered auxiliary to article text for search
*/
private $auxiliaryElementSelectors = [
- '.thumbcaption', // Thumbnail captions aren't really part of the text proper
- 'table', // Neither are tables
- '.rellink', // Common style for "See also:".
- '.dablink', // Common style for calling out helpful links at the top
- // of the article.
- '.searchaux', // New class users can use to mark stuff as auxiliary to searches.
+ // Thumbnail captions aren't really part of the text proper
+ '.thumbcaption',
+ // Neither are tables
+ 'table',
+ // Common style for "See also:".
+ '.rellink',
+ // Common style for calling out helpful links at the top of the article.
+ '.dablink',
+ // New class users can use to mark stuff as auxiliary to searches.
+ '.searchaux',
];
/**
$fields['opening_text'] =
$engine->makeSearchFieldMapping( 'opening_text', SearchIndexField::INDEX_TYPE_TEXT );
- $fields['opening_text']->setFlag( SearchIndexField::FLAG_SCORING |
- SearchIndexField::FLAG_NO_HIGHLIGHT );
+ $fields['opening_text']->setFlag(
+ SearchIndexField::FLAG_SCORING | SearchIndexField::FLAG_NO_HIGHLIGHT
+ );
// Until we have full first-class content handler for files, we invoke it explicitly here
$fields = array_merge( $fields, $this->getFileHandler()->getFieldsForSearchIndex( $engine ) );
return $fields;
}
- public function getDataForSearchIndex( WikiPage $page, ParserOutput $parserOutput,
- SearchEngine $engine ) {
+ public function getDataForSearchIndex(
+ WikiPage $page,
+ ParserOutput $parserOutput,
+ SearchEngine $engine
+ ) {
$fields = parent::getDataForSearchIndex( $page, $parserOutput, $engine );
$structure = new WikiTextStructure( $parserOutput );
}
// Normalize the key in case the user is passing gibberish
- // or has old preferences (bug 69566).
+ // or has old preferences (T71566).
$normalized = Skin::normalizeKey( $userSkin );
// Skin::normalizeKey will also validate it, so
foreach ( $this->tablesToClone as $tbl ) {
if ( $wgSharedDB && in_array( $tbl, $wgSharedTables, true ) ) {
// Shared tables don't work properly when cloning due to
- // how prefixes are handled (bug 65654)
+ // how prefixes are handled (T67654)
throw new RuntimeException( "Cannot clone shared table $tbl." );
}
# Clean up from previous aborted run. So that table escaping
| [\xF0-\xF4](?![\x80-\xBF]{3}) # Invalid UTF-8 Sequence Start
| (?<=[\x0-\x7F\xF5-\xFF])[\x80-\xBF] # Invalid UTF-8 Sequence Middle
| (?<![\xC2-\xDF]|[\xE0-\xEF]|[\xE0-\xEF][\x80-\xBF]|[\xF0-\xF4]
- |[\xF0-\xF4][\x80-\xBF]|[\xF0-\xF4][\x80-\xBF]{2})[\x80-\xBF] # Overlong Sequence
+ | [\xF0-\xF4][\x80-\xBF]|[\xF0-\xF4][\x80-\xBF]{2})[\x80-\xBF] # Overlong Sequence
| (?<=[\xE0-\xEF])[\x80-\xBF](?![\x80-\xBF]) # Short 3 byte sequence
| (?<=[\xF0-\xF4])[\x80-\xBF](?![\x80-\xBF]{2}) # Short 4 byte sequence
| (?<=[\xF0-\xF4][\x80-\xBF])[\x80-\xBF](?![\x80-\xBF]) # Short 4 byte sequence (2)
*
* Constructor options array arguments:
* * alias: map from monolog channel to kafka topic name. When no
- * alias exists the topic "monolog_$channel" will be used.
+ * alias exists the topic "monolog_$channel" will be used.
* * swallowExceptions: Swallow exceptions that occur while talking to
- * kafka. Defaults to false.
+ * kafka. Defaults to false.
* * logExceptions: Log exceptions talking to kafka here. Either null,
- * the name of a channel to log to, or an object implementing
- * FormatterInterface. Defaults to null.
+ * the name of a channel to log to, or an object implementing
+ * FormatterInterface. Defaults to null.
*
* Requires the nmred/kafka-php library, version >= 1.3.0
*
# If the sortkey is longer then 255 bytes,
# it truncated by DB, and then doesn't get
# matched when comparing existing vs current
- # categories, causing bug 25254.
+ # categories, causing T27254.
# Also. substr behaves weird when given "".
if ( $sortkey !== '' ) {
$sortkey = substr( $sortkey, 0, 255 );
/**
* Set this to true to add debug info to the HTML output.
* Warning: this may cause RSS readers to spuriously mark articles as "new"
- * (bug 20601)
+ * (T22601)
*/
public $enableDebugComment = false;
private function flushGroup( $new_tag ) {
if ( $this->group !== '' ) {
if ( $this->tag == 'ins' ) {
- $this->line .= "<ins{$this->insClass}>" .
- htmlspecialchars( $this->group ) . '</ins>';
+ $this->line .= "<ins{$this->insClass}>" . htmlspecialchars( $this->group ) . '</ins>';
} elseif ( $this->tag == 'del' ) {
- $this->line .= "<del{$this->delClass}>" .
- htmlspecialchars( $this->group ) . '</del>';
+ $this->line .= "<del{$this->delClass}>" . htmlspecialchars( $this->group ) . '</del>';
} else {
$this->line .= htmlspecialchars( $this->group );
}
$this->msg = $msg;
$this->params = $params;
- // Bug 44111: Messages in the log files should be in English and not
+ // T46111: Messages in the log files should be in English and not
// customized by the local wiki. So get the default English version for
// passing to the parent constructor. Our overridden report() below
// makes sure that the page shown to the user is not forced to English.
$text .= "{$pad}#{$level} {$frame['file']}({$frame['line']}): ";
} else {
// 'file' and 'line' are unset for calls via call_user_func
- // (bug 55634) This matches behaviour of
+ // (T57634) This matches behaviour of
// Exception::getTraceAsString to instead display "[internal
// function]".
$text .= "{$pad}#{$level} [internal function]: ";
* @par Example:
* @code
* if( $user->isAnon() ) {
- * throw new UserNotLoggedIn();
+ * throw new UserNotLoggedIn();
* }
* @endcode
*
* @par Example:
* @code
* if( $user->isAnon() ) {
- * throw new UserNotLoggedIn( 'action-require-loggedin' );
+ * throw new UserNotLoggedIn( 'action-require-loggedin' );
* }
* @endcode
*
- * @see bug 37627
+ * @see T39627
* @since 1.20
* @ingroup Exception
*/
# query optimization for history stub dumps
if ( $this->text == WikiExporter::STUB && $orderRevs ) {
$tables = [ 'revision', 'page' ];
- $opts[] = 'STRAIGHT_JOIN';
+ $opts[] = 'STRAIGHT_JOIN';
$opts['ORDER BY'] = [ 'rev_page ASC', 'rev_id ASC' ];
$opts['USE INDEX']['revision'] = 'rev_page_id';
$join['page'] = [ 'INNER JOIN', 'rev_page=page_id' ];
'dst' => $archivePath,
// We may have 2+ identical files being deleted,
// all of which will map to the same destination file
- 'overwriteSame' => true // also see bug 31792
+ 'overwriteSame' => true // also see T33792
];
}
return $this->iconThumb();
}
$hp['width'] = $width;
- // be sure to ignore any height specification as well (bug 62258)
+ // be sure to ignore any height specification as well (T64258)
unset( $hp['height'] );
return $this->transform( $hp );
break; // not a bitmap or renderable image, don't try
}
- // Get the descriptionUrl to embed it as comment into the thumbnail. Bug 19791.
+ // Get the descriptionUrl to embed it as comment into the thumbnail. T21791.
$descriptionUrl = $this->getDescriptionUrl();
if ( $descriptionUrl ) {
$params['descriptionUrl'] = wfExpandUrl( $descriptionUrl, PROTO_CANONICAL );
$files[] = $file;
}
} catch ( FileBackendError $e ) {
- } // suppress (bug 54674)
+ } // suppress (T56674)
return $files;
}
}
}
- # (bug 34993) Note: $oldver can be empty here, if the previous
+ # (T36993) Note: $oldver can be empty here, if the previous
# version of the file was broken. Allow registration of the new
# version to continue anyway, because that's better than having
# an image that's not fixable by user operations.
$dbw = $this->repo->getMasterDB();
$makesTransaction = !$dbw->trxLevel();
$dbw->startAtomic( self::ATOMIC_SECTION_LOCK );
- // Bug 54736: use simple lock to handle when the file does not exist.
+ // T56736: use simple lock to handle when the file does not exist.
// SELECT FOR UPDATE prevents changes, not other SELECTs with FOR UPDATE.
// Also, that would cause contention on INSERT of similarly named rows.
$status = $this->acquireFileLock(); // represents all versions of the file
$status->failCount++;
}
$status->successCount += $oldRowCount;
- // Bug 34934: oldCount is based on files that actually exist.
+ // T36934: oldCount is based on files that actually exist.
// There may be more DB rows than such files, in which case $affected
// can be greater than $total. We use max() to avoid negatives here.
$status->failCount += max( 0, $this->oldCount - $oldRowCount );
*
* @param string|array|Status $elements The set of errors/warnings to process.
* @param string $elementsType Should warnings or errors be returned. This is meant
- * for Status objects, all other valid types are always considered as errors.
+ * for Status objects, all other valid types are always considered as errors.
* @return string
*/
public function getErrorsOrWarnings( $elements, $elementsType ) {
* - caInfo Provide CA information
* - maxRedirects Maximum number of redirects to follow (defaults to 5)
* - followRedirects Whether to follow redirects (defaults to false).
- * Note: this should only be used when the target URL is trusted,
- * to avoid attacks on intranet services accessible by HTTP.
+ * Note: this should only be used when the target URL is trusted,
+ * to avoid attacks on intranet services accessible by HTTP.
* - userAgent A user agent, if you want to override the default
* MediaWiki/$wgVersion
* - logger A \Psr\Logger\LoggerInterface instance for debug logging
foreach ( $members as $o ) {
if ( isset( $options[$o] ) ) {
// ensure that MWHttpRequest::method is always
- // uppercased. Bug 36137
+ // uppercased. T38137
if ( $o == 'method' ) {
$options[$o] = strtoupper( $options[$o] );
}
*
* Note that the multiple Location: headers are an artifact of
* CURL -- they shouldn't actually get returned this way. Rewrite
- * this when bug 29232 is taken care of (high-level redirect
+ * this when T31232 is taken care of (high-level redirect
* handling rewrite).
*
* @return string
public function doImport() {
// Calls to reader->read need to be wrapped in calls to
// libxml_disable_entity_loader() to avoid local file
- // inclusion attacks (bug 46932).
+ // inclusion attacks (T48932).
$oldDisable = libxml_disable_entity_loader( true );
$this->reader->read();
public function updateRowExists( $key ) {
$row = $this->db->selectRow(
'updatelog',
- # Bug 65813
+ # T67813
'1 AS X',
[ 'ul_key' => $key ],
__METHOD__
'_UpgradeKeySupplied' => false,
'_ExistingDBSettings' => false,
- // $wgLogo is probably wrong (bug 48084); set something that will work.
+ // $wgLogo is probably wrong (T50084); set something that will work.
// Single quotes work fine here, as LocalSettingsGenerator outputs this unescaped.
'wgLogo' => '$wgResourceBasePath/resources/assets/wiki.png',
'wgAuthenticationTokenVersion' => 1,
);
}
// Unset everyone else's hooks. Lord knows what someone might be doing
- // in ParserFirstCallInit (see bug 27171)
+ // in ParserFirstCallInit (see T29171)
$GLOBALS['wgHooks'] = [ 'LoadExtensionSchemaUpdates' => $hooksWeWant ];
return Status::newGood();
/**
* Set page_random field to a random value where it is equals to 0.
*
- * @see bug 3946
+ * @see T5946
*/
protected function doPageRandomUpdate() {
$page = $this->db->tableName( 'page' );
$q = <<<END
SELECT attname, attnum FROM pg_namespace, pg_class, pg_attribute
WHERE pg_class.relnamespace = pg_namespace.oid
- AND attrelid=pg_class.oid AND attnum > 0
- AND relname=%s AND nspname=%s
+ AND attrelid=pg_class.oid AND attnum > 0
+ AND relname=%s AND nspname=%s
END;
$res = $this->db->query( sprintf( $q,
$this->db->addQuotes( $table ),
$q = <<<END
SELECT indkey, indrelid FROM pg_namespace, pg_class, pg_index
WHERE nspname=%s
- AND pg_class.relnamespace = pg_namespace.oid
- AND relname=%s
- AND indexrelid=pg_class.oid
+ AND pg_class.relnamespace = pg_namespace.oid
+ AND relname=%s
+ AND indexrelid=pg_class.oid
END;
$res = $this->db->query(
sprintf(
$query = <<<END
SELECT attname FROM pg_class, pg_attribute
WHERE attrelid=$relid
- AND attnum=%d
- AND attrelid=pg_class.oid
+ AND attnum=%d
+ AND attrelid=pg_class.oid
END;
$r2 = $this->db->query( sprintf( $query, $rid ) );
if ( !$r2 ) {
$q = <<<END
SELECT confdeltype FROM pg_constraint, pg_namespace
WHERE connamespace=pg_namespace.oid
- AND nspname=%s
- AND conname=%s;
+ AND nspname=%s
+ AND conname=%s;
END;
$r = $this->db->query(
sprintf(
$q = <<<END
SELECT definition FROM pg_rules
WHERE schemaname = %s
- AND tablename = %s
- AND rulename = %s
+ AND tablename = %s
+ AND rulename = %s
END;
$r = $this->db->query(
sprintf(
protected function rebuildTextSearch() {
if ( $this->updateRowExists( 'patch-textsearch_bug66650.sql' ) ) {
- $this->output( "...bug 66650 already fixed or not applicable.\n" );
+ $this->output( "...T68650 already fixed or not applicable.\n" );
return;
};
$this->applyPatch( 'patch-textsearch_bug66650.sql', false,
- 'Rebuilding text search for bug 66650' );
+ 'Rebuilding text search for T68650' );
}
}
$sql =
<<<EOT
CREATE TABLE IF NOT EXISTS objectcache (
- keyname BLOB NOT NULL default '' PRIMARY KEY,
- value BLOB,
- exptime TEXT
+ keyname BLOB NOT NULL default '' PRIMARY KEY,
+ value BLOB,
+ exptime TEXT
)
EOT;
$conn->query( $sql );
foreach ( $varNames as $name ) {
$value = $this->request->getVal( $prefix . $name );
- // bug 30524, do not trim passwords
+ // T32524, do not trim passwords
if ( stripos( $name, 'password' ) === false ) {
$value = trim( $value );
}
$retVal = false;
}
// If they asked to subscribe to mediawiki-announce but didn't give
- // an e-mail, show an error. Bug 29332
+ // an e-mail, show an error. T31332
if ( !$email && $this->getVar( '_Subscribe' ) ) {
$this->parent->showError( 'config-subscribe-noemail' );
$retVal = false;
<div id="mw-panel">
<div class="portal" id="p-logo">
- <a style="background-image: url(images/installer-logo.png);"
- href="https://www.mediawiki.org/"
- title="Main Page"></a>
+ <a style="background-image: url(images/installer-logo.png);"
+ href="https://www.mediawiki.org/"
+ title="Main Page"></a>
</div>
<?php
$message = wfMessage( 'config-sidebar' )->plain();
}
if ( $continue ) {
- // Fake submit button for enter keypress (bug 26267)
+ // Fake submit button for enter keypress (T28267)
// Messages: config-continue, config-restart, config-regenerate
$s .= Xml::submitButton(
wfMessage( "config-$continue" )->text(),
if ( $result ) {
// If they're going to possibly regenerate LocalSettings, we
- // need to create the upgrade/secret keys. Bug 26481
+ // need to create the upgrade/secret keys. T28481
if ( !$this->getVar( '_ExistingDBSettings' ) ) {
$this->parent->generateKeys();
}
continue; // try the other direction
}
} else { // table *may* have >= MAX_OFFSET rows
- // Bug 42614: "ORDER BY job_random" with a job_random inequality causes high CPU
+ // T44614: "ORDER BY job_random" with a job_random inequality causes high CPU
// in MySQL if there are many rows for some reason. This uses a small OFFSET
// instead of job_random for reducing excess claim retries.
$row = $dbw->selectRow( 'job', self::selectFields(), // find a random job
private function getGlobalKey( $name ) {
$parts = [ 'global', 'jobqueue', $name ];
foreach ( $parts as $part ) {
- if ( !preg_match( '/[a-zA-Z0-9_-]+/', $part ) ) {
- throw new InvalidArgumentException( "Key part characters are out of range." );
- }
+ if ( !preg_match( '/[a-zA-Z0-9_-]+/', $part ) ) {
+ throw new InvalidArgumentException( "Key part characters are out of range." );
+ }
}
return implode( ':', $parts );
wfDebug( __METHOD__ . " : skipping, already good\n" );
}
- // Preserve fragment (bug 14904)
+ // Preserve fragment (T16904)
$newTitle = Title::makeTitle( $newTitle->getNamespace(), $newTitle->getDBkey(),
$currentDest->getFragment(), $newTitle->getInterwiki() );
$seenTitles[$titleText] = true;
if ( $title->isExternal() ) {
- // If the target is interwiki, we have to break early (bug 40352).
+ // If the target is interwiki, we have to break early (T42352).
// Otherwise it will look up a row in the local page table
// with the namespace/page of the interwiki target which can cause
// unexpected results (e.g. X -> foo:Bar -> Bar -> .. )
);
$this->setLastError( get_class( $e ) . ": " . $e->getMessage() );
// To prevent potential database referential integrity issues.
- // See bug 32551.
+ // See T34551.
MWExceptionHandler::rollbackMasterChangesAndLog( $e );
return false;
* - a) Recursive jobs to update links for backlink pages for a given title.
* These jobs have (recursive:true,table:<table>) set.
* - b) Jobs to update links for a set of pages (the job title is ignored).
- * These jobs have (pages:(<page ID>:(<namespace>,<title>),...) set.
+ * These jobs have (pages:(<page ID>:(<namespace>,<title>),...) set.
* - c) Jobs to update links for a single page (the job title)
* These jobs need no extra fields set.
*
* For example, if templates A and B are edited (at the same time) the queue will have:
* (A base, B base)
* When these jobs run, the queue will have per-title and remnant partition jobs:
- * (titleX,titleY,titleZ,...,A remnant,titleM,titleN,titleO,...,B remnant)
+ * (titleX,titleY,titleZ,...,A remnant,titleM,titleN,titleO,...,B remnant)
*
* This works best when the queue is FIFO, for several reasons:
* - a) Since the remnant jobs are enqueued after the leaf jobs, the slower leaf jobs have to
'table' => $params['table'],
'range' => [
'start' => $ranges[1][0],
- 'end' => $ranges[count( $ranges ) - 1][1],
+ 'end' => $ranges[count( $ranges ) - 1][1],
'batchSize' => $realBSize,
'subranges' => array_slice( $ranges, 1 )
],
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed
* under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
// * Otherwise remap the URL to work in generated stylesheets
// Guard against trailing slashes, because "some/remote/../foo.png"
- // resolves to "some/remote/foo.png" on (some?) clients (bug 27052).
+ // resolves to "some/remote/foo.png" on (some?) clients (T29052).
if ( substr( $remote, -1 ) == '/' ) {
$remote = substr( $remote, 0, -1 );
}
* From http://eprint.iacr.org/2010/264.pdf:
*
* The scheme HKDF is specifed as:
- * HKDF(XTS, SKM, CTXinfo, L) = K(1) || K(2) || ... || K(t)
+ * HKDF(XTS, SKM, CTXinfo, L) = K(1) || K(2) || ... || K(t)
* where the values K(i) are defined as follows:
- * PRK = HMAC(XTS, SKM)
- * K(1) = HMAC(PRK, CTXinfo || 0);
- * K(i+1) = HMAC(PRK, K(i) || CTXinfo || i), 1 <= i < t;
+ * PRK = HMAC(XTS, SKM)
+ * K(1) = HMAC(PRK, CTXinfo || 0);
+ * K(i+1) = HMAC(PRK, K(i) || CTXinfo || i), 1 <= i < t;
* where t = [L/k] and the value K(t) is truncated to its first d = L mod k bits;
* the counter i is non-wrapping and of a given fixed size, e.g., a single byte.
* Note that the length of the HMAC output is the same as its key length and therefore
* @return string|null Valid dotted quad IPv4 address or null
*/
public static function canonicalize( $addr ) {
- // remove zone info (bug 35738)
+ // remove zone info (T37738)
$addr = preg_replace( '/\%.*/', '', $addr );
if ( self::isValid( $addr ) ) {
* defined as:
* [
* 0 => object(StatusValue) # the StatusValue with error messages, only
- * 1 => object(StatusValue) # The StatusValue with warning messages, only
+ * 1 => object(StatusValue) # The StatusValue with warning messages, only
* ]
*
* @return StatusValue[]
}
/**
- * Change operation resuklt
+ * Change operation result
*
* @param bool $ok Whether the operation completed
* @param mixed $value
// good
} elseif ( $rcode === 404 ) {
$status->fatal( 'backend-fail-stream', $params['src'] );
- // Per bug 41113, nasty things can happen if bad cache entries get
+ // Per T43113, nasty things can happen if bad cache entries get
// stuck in cache. It's also possible that this error can come up
// with simple race conditions. Clear out the stat cache to be safe.
$this->clearCache( [ $params['src'] ] );
application/x-director [OFFICE]
text/rtf [OFFICE]
-application/vnd.openxmlformats-officedocument.wordprocessingml.document [OFFICE]
+application/vnd.openxmlformats-officedocument.wordprocessingml.document [OFFICE]
application/vnd.openxmlformats-officedocument.wordprocessingml.template [OFFICE]
-application/vnd.ms-word.document.macroEnabled.12 [OFFICE]
+application/vnd.ms-word.document.macroEnabled.12 [OFFICE]
application/vnd.ms-word.template.macroEnabled.12 [OFFICE]
application/vnd.openxmlformats-officedocument.presentationml.template [OFFICE]
application/vnd.openxmlformats-officedocument.presentationml.slideshow [OFFICE]
protected function doGet( $key, $flags = 0 ) {
$req = [
'method' => 'GET',
- 'url' => $this->url . rawurlencode( $key ),
-
+ 'url' => $this->url . rawurlencode( $key ),
];
+
list( $rcode, $rdesc, $rhdrs, $rbody, $rerr ) = $this->client->run( $req );
if ( $rcode === 200 ) {
if ( is_string( $rbody ) ) {
*/
protected function serialize( $data ) {
// Serialize anything but integers so INCR/DECR work
- // Do not store integer-like strings as integers to avoid type confusion (bug 60563)
+ // Do not store integer-like strings as integers to avoid type confusion (T62563)
return is_int( $data ) ? $data : serialize( $data );
}
$result = wincache_ucache_set( $key, serialize( $value ), $expire );
/* wincache_ucache_set returns an empty array on success if $value
- was an array, bool otherwise */
+ * was an array, bool otherwise */
return ( is_array( $result ) && $result === [] ) || $result;
}
}
// Add trace comment to the begin of the sql string, right after the operator.
- // Or, for one-word queries (like "BEGIN" or COMMIT") add it to the end (bug 42598)
+ // Or, for one-word queries (like "BEGIN" or COMMIT") add it to the end (T44598)
$commentedSql = preg_replace( '/\s|$/', " /* $fname {$this->agent} */ ", $sql, 1 );
# Start implicit transactions that wrap the request if DBO_TRX is enabled
private function handleSessionLoss() {
$this->mTrxLevel = 0;
- $this->mTrxIdleCallbacks = []; // bug 65263
- $this->mTrxPreCommitCallbacks = []; // bug 65263
+ $this->mTrxIdleCallbacks = []; // T67263
+ $this->mTrxPreCommitCallbacks = []; // T67263
$this->mSessionTempTables = [];
$this->mNamedLocksHeld = [];
try {
/**
* Prepend our schema (e.g. 'mediawiki') in front
* of the search path
- * Fixes bug 15816
+ * Fixes T17816
*/
$search_path = $this->getSearchPath();
array_unshift( $search_path,
// Normal client
$this->numericVersion = $versionInfo['server'];
} else {
- // Bug 16937: broken pgsql extension from PHP<5.3
+ // T18937: broken pgsql extension from PHP<5.3
$this->numericVersion = pg_parameter_status( $conn, 'server_version' );
}
}
$masterPositions = array_fill( 0, count( $lbs ), false );
foreach ( $lbs as $i => $lb ) {
if ( $lb->getServerCount() <= 1 ) {
- // Bug 27975 - Don't try to wait for replica DBs if there are none
+ // T29975 - Don't try to wait for replica DBs if there are none
// Prevents permission error when getting master position
continue;
} elseif ( $opts['ifWritesSince']
private function endElementNested( $elm ) {
/* cur item must be the same as $elm, unless if in MODE_STRUCT
- in which case it could also be rdf:Description */
+ * in which case it could also be rdf:Description */
if ( $this->curItem[0] !== $elm
&& !( $elm === self::NS_RDF . ' Description'
&& $this->mode[0] === self::MODE_STRUCT )
if ( $elm === self::NS_RDF . ' Seq' ) {
array_unshift( $this->mode, self::MODE_LI );
} elseif ( $elm === self::NS_RDF . ' Bag' ) {
- # bug 27105
+ # T29105
$this->logger->info( __METHOD__ . ' Expected an rdf:Seq, but got an rdf:Bag. Pretending'
. ' it is a Seq, since some buggy software is known to screw this up.' );
array_unshift( $this->mode, self::MODE_LI );
'choices' => [ '1' => true, '2' => true ],
],
/********
- * Disable extracting this property (bug 31944)
+ * Disable extracting this property (T33944)
* Several files have a string instead of a Seq
* for this property. XMPReader doesn't handle
* mismatched types very gracefully (it marks
* the relavent prop). Since this prop
* doesn't communicate all that useful information
* just disable this prop for now, until such
- * XMPReader is more graceful (bug 32172)
+ * XMPReader is more graceful (T34172)
* 'YCbCrSubSampling' => array(
* 'map_group' => 'exif',
* 'mode' => XMPReader::MODE_SEQ,
/**
* Even uglier hack to maintain backwards compatibilty with IRC bots
- * (bug 34508).
+ * (T36508).
* @see getActionText()
* @return string Text
*/
/**
* Even uglier hack to maintain backwards compatibilty with IRC bots
- * (bug 34508).
+ * (T36508).
* @see getActionText()
* @return string Text
*/
} else {
$this->mConds['log_user'] = $userid;
}
- // Paranoia: avoid brute force searches (bug 17342)
+ // Paranoia: avoid brute force searches (T19342)
$user = $this->getUser();
if ( !$user->isAllowed( 'deletedhistory' ) ) {
$this->mConds[] = $this->mDb->bitAnd( 'log_deleted', LogPage::DELETED_USER ) . ' = 0';
} else {
$this->mConds['log_title'] = $title->getDBkey();
}
- // Paranoia: avoid brute force searches (bug 17342)
+ // Paranoia: avoid brute force searches (T19342)
$user = $this->getUser();
if ( !$user->isAllowed( 'deletedhistory' ) ) {
$this->mConds[] = $db->bitAnd( 'log_deleted', LogPage::DELETED_ACTION ) . ' = 0';
$pageTitle = $this->title->getPrefixedText();
if ( $this->oldid ) {
- // Always show a link to the diff which triggered the mail. See bug 32210.
+ // Always show a link to the diff which triggered the mail. See T34210.
$keys['$NEWPAGE'] = "\n\n" . wfMessage( 'enotif_lastdiff',
$this->title->getCanonicalURL( [ 'diff' => 'next', 'oldid' => $this->oldid ] ) )
->inContentLanguage()->text();
Skin::makeInternalOrExternalUrl( wfMessage( 'helppage' )->inContentLanguage()->text() )
);
- # Replace this after transforming the message, bug 35019
+ # Replace this after transforming the message, T37019
$postTransformKeys['$PAGESUMMARY'] = $this->summary == '' ? ' - ' : $this->summary;
// Now build message's subject and body
* @param string $subject Email's subject.
* @param string $body Email's text or Array of two strings to be the text and html bodies
* @param array $options:
- * 'replyTo' MailAddress
- * 'contentType' string default 'text/plain; charset=UTF-8'
- * 'headers' array Extra headers to set
+ * 'replyTo' MailAddress
+ * 'contentType' string default 'text/plain; charset=UTF-8'
+ * 'headers' array Extra headers to set
*
* @throws MWException
* @throws Exception
* @param string $subject Email's subject.
* @param string $body Email's text or Array of two strings to be the text and html bodies
* @param array $options:
- * 'replyTo' MailAddress
- * 'contentType' string default 'text/plain; charset=UTF-8'
- * 'headers' array Extra headers to set
+ * 'replyTo' MailAddress
+ * 'contentType' string default 'text/plain; charset=UTF-8'
+ * 'headers' array Extra headers to set
*
* @throws MWException
* @throws Exception
if ( $params['interlace'] ) {
$animation_post = [ '-interlace', 'JPEG' ];
}
- # Sharpening, see bug 6193
+ # Sharpening, see T8193
if ( ( $params['physicalWidth'] + $params['physicalHeight'] )
/ ( $params['srcWidth'] + $params['srcHeight'] )
< $wgSharpenReductionThreshold
// be a total drag. :P
$scene = 0;
} elseif ( $this->isAnimatedImage( $image ) ) {
- // Coalesce is needed to scale animated GIFs properly (bug 1017).
+ // Coalesce is needed to scale animated GIFs properly (T3017).
$animation_pre = [ '-coalesce' ];
// We optimize the output, but -optimize is broken,
- // use optimizeTransparency instead (bug 11822)
+ // use optimizeTransparency instead (T13822)
if ( version_compare( $this->getMagickVersion(), "6.3.5" ) >= 0 ) {
$animation_post = [ '-fuzz', '5%', '-layers', 'optimizeTransparency' ];
}
&& $xcfMeta['colorType'] === 'greyscale-alpha'
&& version_compare( $this->getMagickVersion(), "6.8.9-3" ) < 0
) {
- // bug 66323 - Greyscale images not rendered properly.
+ // T68323 - Greyscale images not rendered properly.
// So only take the "red" channel.
$channelOnly = [ '-channel', 'R', '-separate' ];
$animation_pre = array_merge( $animation_pre, $channelOnly );
$im->readImage( $params['srcPath'] );
if ( $params['mimeType'] == 'image/jpeg' ) {
- // Sharpening, see bug 6193
+ // Sharpening, see T8193
if ( ( $params['physicalWidth'] + $params['physicalHeight'] )
/ ( $params['srcWidth'] + $params['srcHeight'] )
< $wgSharpenReductionThreshold
// be a total drag. :P
$im->setImageScene( 0 );
} elseif ( $this->isAnimatedImage( $image ) ) {
- // Coalesce is needed to scale animated GIFs properly (bug 1017).
+ // Coalesce is needed to scale animated GIFs properly (T3017).
$im = $im->coalesceImages();
}
// GIF interlacing is only available since 6.3.4
$reg = <<<EOR
/\(page\s[\d-]*\s[\d-]*\s[\d-]*\s[\d-]*\s*"
((?> # Text to match is composed of atoms of either:
- \\\\. # - any escaped character
- | # - any character different from " and \
- [^"\\\\]+
+ \\\\. # - any escaped character
+ | # - any character different from " and \
+ [^"\\\\]+
)*?)
"\s*\)
| # Or page can be empty ; in this case, djvutxt dumps ()
wfDebug( __METHOD__ . ': ' . $e->getMessage() . "\n" );
/* This used to use 0 (ExifBitmapHandler::OLD_BROKEN_FILE) for the cases
- * * No metadata in the file
- * * Something is broken in the file.
+ * * No metadata in the file
+ * * Something is broken in the file.
* However, if the metadata support gets expanded then you can't tell if the 0 is from
* a broken file, or just no props found. A broken file is likely to stay broken, but
* a file which had no props could have props once the metadata support is improved.
* @param string $cmd
*/
protected function logErrorForExternalProcess( $retval, $err, $cmd ) {
- # Keep error output limited (bug 57985)
+ # Keep error output limited (T59985)
$errMessage = trim( substr( $err, 0, self::MAX_ERR_LOG_SIZE ) );
wfDebugLog( 'thumbnail',
}
// Expand entities, since Adobe Illustrator uses them for xmlns
- // attributes (bug 31719). Note that libxml2 has some protection
+ // attributes (T33719). Note that libxml2 has some protection
// against large recursive entity expansions so this is not as
// insecure as it might appear to be. However, it is still extremely
// insecure. It's necessary to wrap any read() calls with
// libxml_disable_entity_loader() to avoid arbitrary local file
// inclusion, or even arbitrary code execution if the expect
- // extension is installed (bug 46859).
+ // extension is installed (T48859).
$oldDisable = libxml_disable_entity_loader( true );
$this->reader->setParserProperty( XMLReader::SUBST_ENTITIES, true );
$exptime = $this->convertExpiry( $exptime );
$encExpiry = $db->timestamp( $exptime );
}
- // (bug 24425) use a replace if the db supports it instead of
+ // (T26425) use a replace if the db supports it instead of
// delete/insert to avoid clashes with conflicting keynames
$db->update(
$tableName,
], __METHOD__, 'IGNORE' );
if ( $db->affectedRows() == 0 ) {
- // Race condition. See bug 28611
+ // Race condition. See T30611
$newValue = null;
}
} catch ( DBError $e ) {
$ns = $this->getTitle()->getNamespace();
- # Don't index user and user talk pages for blocked users (bug 11443)
+ # Don't index user and user talk pages for blocked users (T13443)
if ( ( $ns == NS_USER || $ns == NS_USER_TALK ) && !$this->getTitle()->isSubpage() ) {
$specificTarget = null;
$vagueTarget = null;
}
if ( isset( $wgArticleRobotPolicies[$this->getTitle()->getPrefixedText()] ) ) {
- # (bug 14900) site config can override user-defined __INDEX__ or __NOINDEX__
+ # (T16900) site config can override user-defined __INDEX__ or __NOINDEX__
$policy = array_merge(
$policy,
self::formatRobotPolicy( $wgArticleRobotPolicies[$this->getTitle()->getPrefixedText()] )
}
$out->addModuleStyles( [
- 'filepage', // always show the local local Filepage.css, bug 29277
+ 'filepage', // always show the local local Filepage.css, T31277
'mediawiki.action.view.filepage', // Add MediaWiki styles for a file page
] );
}
// this will get messy.
// The dirmark, however, must not be immediately adjacent
// to the filename, because it can get copied with it.
- // See bug 25277.
+ // See T27277.
// @codingStandardsIgnoreStart Ignore long line
$out->addWikiText( <<<EOT
<div class="fullMedia"><span class="dangerousLink">{$medialink}</span> $dirmark<span class="fileInfo">$longDesc</span></div>
* @return WikiPage|null
*/
public static function newFromID( $id, $from = 'fromdb' ) {
- // page id's are never 0 or negative, see bug 61166
+ // page ids are never 0 or negative, see T63166
if ( $id < 1 ) {
return null;
}
$this->mTimestamp = '';
$this->mIsRedirect = false;
$this->mLatest = false;
- // Bug 57026: do not clear mPreparedEdit since prepareTextForEdit() already checks
+ // T59026: do not clear mPreparedEdit since prepareTextForEdit() already checks
// the requested rev ID and content against the cached one for equality. For most
// content types, the output should not change during the lifetime of this cache.
// Clearing it can cause extra parses on edit for no reason.
$this->mLinksUpdated = wfTimestampOrNull( TS_MW, $data->page_links_updated );
$this->mIsRedirect = intval( $data->page_is_redirect );
$this->mLatest = intval( $data->page_latest );
- // Bug 37225: $latest may no longer match the cached latest Revision object.
+ // T39225: $latest may no longer match the cached latest Revision object.
// Double-check the ID of any cached latest Revision object for consistency.
if ( $this->mLastRevision && $this->mLastRevision->getId() != $this->mLatest ) {
$this->mLastRevision = null;
}
if ( $this->mDataLoadedFrom == self::READ_LOCKING ) {
- // Bug 37225: if session S1 loads the page row FOR UPDATE, the result always
+ // T39225: if session S1 loads the page row FOR UPDATE, the result always
// includes the latest changes committed. This is true even within REPEATABLE-READ
// transactions, where S1 normally only sees changes committed before the first S1
// SELECT. Thus we need S1 to also gets the revision row FOR UPDATE; otherwise, it
$this->getContentHandler()->getModelID() );
}
- // Bug 30711: always use current version when adding a new section
+ // T32711: always use current version when adding a new section
if ( is_null( $baseRevId ) || $sectionId === 'new' ) {
$oldContent = $this->getContent();
} else {
return $status;
} elseif ( !$oldContent ) {
- // Sanity check for bug 37225
+ // Sanity check for T39225
throw new MWException( "Could not find text for current revision {$oldid}." );
}
$dbw->endAtomic( __METHOD__ );
$this->mTimestamp = $now;
} else {
- // Bug 32948: revision ID must be set to page {{REVISIONID}} and
+ // T34948: revision ID must be set to page {{REVISIONID}} and
// related variables correctly. Likewise for {{REVISIONUSER}} (T135261).
$revision->setId( $this->getLatest() );
$revision->setUserIdAndName(
$user = is_null( $user ) ? $wgUser : $user;
// XXX: check $user->getId() here???
- // Use a sane default for $serialFormat, see bug 57026
+ // Use a sane default for $serialFormat, see T59026
if ( $serialFormat === null ) {
$serialFormat = $content->getContentHandler()->getDefaultFormat();
}
// Update the links tables and other secondary data
if ( $content ) {
- $recursive = $options['changed']; // bug 50785
+ $recursive = $options['changed']; // T52785
$updates = $content->getSecondaryDataUpdates(
$this->getTitle(), null, $recursive, $editInfo->output
);
if ( $options['created'] ) {
self::onArticleCreate( $this->mTitle );
- } elseif ( $options['changed'] ) { // bug 50785
+ } elseif ( $options['changed'] ) { // T52785
self::onArticleEdit( $this->mTitle, $revision );
}
$dbw->onTransactionPreCommitOrIdle(
function () use ( $dbw, $logEntry, $logid ) {
- // Bug 56776: avoid deadlocks (especially from FileDeleteForm)
+ // T58776: avoid deadlocks (especially from FileDeleteForm)
$logEntry->publish( $logid );
},
__METHOD__
);
// Set patrolling and bot flag on the edits, which gets rollbacked.
- // This is done even on edit failure to have patrolling in that case (bug 62157).
+ // This is done even on edit failure to have patrolling in that case (T64157).
$set = [];
if ( $bot && $guser->isAllowed( 'markbotedits' ) ) {
// Mark all reverted edits as bot
if ( $openMatch || $closeMatch ) {
$pendingPTag = false;
- # @todo bug 5718: paragraph closed
+ # @todo T7718: paragraph closed
$output .= $this->closeParagraph();
if ( $preOpenMatch && !$preCloseMatch ) {
$this->inPre = true;
}
}
}
- # somewhere above we forget to get out of pre block (bug 785)
+ # somewhere above we forget to get out of pre block (T2785)
if ( $preCloseMatch && $this->inPre ) {
$this->inPre = false;
}
}
/**
- * urlencodes a string according to one of three patterns: (bug 22474)
+ * urlencodes a string according to one of three patterns: (T24474)
*
* By default (for HTTP "query" strings), spaces are encoded as '+'.
* Or to encode a value for the HTTP "path", spaces are encoded as '%20'.
$this->targets[self::ISO2] = '[[y-m-d]]';
# Rules
- # pref source target
+ # pref source target
$this->rules[self::DMY][self::MD] = self::DM;
$this->rules[self::ALL][self::MD] = self::MD;
$this->rules[self::MDY][self::DM] = self::MD;
* Get a DateFormatter object
*
* @param Language|string|null $lang In which language to format the date
- * Defaults to the site content language
+ * Defaults to the site content language
* @return DateFormatter
*/
public static function getInstance( $lang = null ) {
$spdash = "(?:-|$space)"; # a dash or a non-newline space
$spaces = "$space++"; # possessive match of 1 or more spaces
$text = preg_replace_callback(
- '!(?: # Start cases
- (<a[ \t\r\n>].*?</a>) | # m[1]: Skip link text
- (<.*?>) | # m[2]: Skip stuff inside
- # HTML elements' . "
- (\b(?i:$prots)($addr$urlChar*)) | # m[3]: Free external links
- # m[4]: Post-protocol path
- \b(?:RFC|PMID) $spaces # m[5]: RFC or PMID, capture number
+ '!(?: # Start cases
+ (<a[ \t\r\n>].*?</a>) | # m[1]: Skip link text
+ (<.*?>) | # m[2]: Skip stuff inside HTML elements' . "
+ (\b # m[3]: Free external links
+ (?i:$prots)
+ ($addr$urlChar*) # m[4]: Post-protocol path
+ ) |
+ \b(?:RFC|PMID) $spaces # m[5]: RFC or PMID, capture number
([0-9]+)\b |
- \bISBN $spaces ( # m[6]: ISBN, capture number
+ \bISBN $spaces ( # m[6]: ISBN, capture number
(?: 97[89] $spdash? )? # optional 13-digit ISBN prefix
(?: [0-9] $spdash? ){9} # 9 digits with opt. delimiters
[0-9Xx] # check digit
// The edit section preference may not be the appropiate one in
// the ParserOutput, as we are not storing it in the parsercache
- // key. Force it here. See bug 31445.
+ // key. Force it here. See T33445.
$value->setEditSectionTokens( $popts->getEditSection() );
$wikiPage = method_exists( $article, 'getPage' )
* when the page is rendered based on the language of the user.
*
* @note When saving, this will return the default language instead of the user's.
- * {{int: }} uses this which used to produce inconsistent link tables (bug 14404).
+ * {{int: }} uses this which used to produce inconsistent link tables (T16404).
*
* @return Language
* @since 1.19
return false;
}
- // Important to parse with correct title (bug 31469)
+ // Important to parse with correct title (T33469)
$cat = wfMessage( $msg )
->title( $title )
->inContentLanguage()
* is to assume a direct page view.
*
* The generated DOM tree must depend only on the input text and the flags.
- * The DOM tree must be the same in OT_HTML and OT_WIKI mode, to avoid a regression of bug 4899.
+ * The DOM tree must be the same in OT_HTML and OT_WIKI mode, to avoid a regression of T6899.
*
* Any flag added to the $flags parameter here, or any other parameter liable to cause a
* change in the DOM tree for a given text, must be passed through the section identifier
* included. Default is to assume a direct page view.
*
* The generated DOM tree must depend only on the input text and the flags.
- * The DOM tree must be the same in OT_HTML and OT_WIKI mode, to avoid a regression of bug 4899.
+ * The DOM tree must be the same in OT_HTML and OT_WIKI mode, to avoid a regression of T6899.
*
* Any flag added to the $flags parameter here, or any other parameter liable to cause a
* change in the DOM tree for a given text, must be passed through the section identifier
return false;
}
- // Reduce effects of race conditions for slow parses (bug 46014)
+ // Reduce effects of race conditions for slow parses (T48014)
$cacheTime = wfTimestampNow();
$time = - microtime( true );
}
public function canUse() {
- # Do not log anything if database is readonly (bug 5375)
+ # Do not log anything if database is readonly (T7375)
return !wfReadOnly();
}
/**
* @return array With following keys:
- * 'globals' - variables to be set to $GLOBALS
- * 'defines' - constants to define
- * 'callbacks' - functions to be executed by the registry
- * 'credits' - metadata to be stored by registry
- * 'attributes' - registration info which isn't a global variable
+ * 'globals' - variables to be set to $GLOBALS
+ * 'defines' - constants to define
+ * 'callbacks' - functions to be executed by the registry
+ * 'credits' - metadata to be stored by registry
+ * 'attributes' - registration info which isn't a global variable
*/
public function getExtractedInfo();
* installed extensions in the $credits array.
*
* Example $extDependencies:
- * {
- * 'FooBar' => {
- * 'MediaWiki' => '>= 1.25.0',
- * 'extensions' => {
- * 'FooBaz' => '>= 1.25.0'
- * },
- * 'skins' => {
- * 'BazBar' => '>= 1.0.0'
- * }
- * }
- * }
+ * {
+ * 'FooBar' => {
+ * 'MediaWiki' => '>= 1.25.0',
+ * 'extensions' => {
+ * 'FooBaz' => '>= 1.25.0'
+ * },
+ * 'skins' => {
+ * 'BazBar' => '>= 1.0.0'
+ * }
+ * }
+ * }
*
* @param array $extDependencies All extensions that depend on other ones
* @return array
$module = $this->getModule( $name );
if ( $module ) {
// Do not allow private modules to be loaded from the web.
- // This is a security issue, see bug 34907.
+ // This is a security issue, see T36907.
if ( $module->getGroup() === 'private' ) {
$this->logger->debug( "Request for private module '$name' denied" );
$this->errors[] = "Cannot show private module \"$name\"";
$styles = (array)$styles;
foreach ( $styles as $style ) {
$style = trim( $style );
- // Don't output an empty "@media print { }" block (bug 40498)
+ // Don't output an empty "@media print { }" block (T42498)
if ( $style !== '' ) {
// Transform the media type based on request params and config
// The way that this relies on $wgRequest to propagate request params is slightly evil
*/
public function getLessCompiler( $extraVars = [] ) {
// When called from the installer, it is possible that a required PHP extension
- // is missing (at least for now; see bug 47564). If this is the case, throw an
+ // is missing (at least for now; see T49564). If this is the case, throw an
// exception (caught by the installer) to prevent a fatal error later on.
if ( !class_exists( 'Less_Parser' ) ) {
throw new MWException( 'MediaWiki requires the less.php parser' );
// Special handling for the user group; because users might change their stuff
// on-wiki like user pages, or user preferences; we need to find the highest
// timestamp of these user-changeable modules so we can ensure cache misses on change
- // This should NOT be done for the site group (bug 27564) because anons get that too
+ // This should NOT be done for the site group (T29564) because anons get that too
// and we shouldn't be putting timestamps in CDN-cached HTML
if ( $group === 'user' ) {
// Must setModules() before makeVersionQuery()
if ( $this->direction === null ) {
$this->direction = $this->getRequest()->getRawVal( 'dir' );
if ( !$this->direction ) {
- // Determine directionality based on user language (bug 6100)
+ // Determine directionality based on user language (T8100)
$this->direction = Language::factory( $this->getLanguage() )->getDir();
}
}
&& substr( rtrim( $scripts ), -1 ) !== ';'
) {
// Append semicolon to prevent weird bugs caused by files not
- // terminating their statements right (bug 27054)
+ // terminating their statements right (T29054)
$scripts .= ";\n";
}
}
if ( $context->shouldIncludeStyles() ) {
$styles = [];
// Don't create empty stylesheets like [ '' => '' ] for modules
- // that don't *have* any stylesheets (bug 38024).
+ // that don't *have* any stylesheets (T40024).
$stylePairs = $this->getStyles( $context );
if ( count( $stylePairs ) ) {
// If we are in debug mode without &only= set, we'll want to return an array of URLs
'wgSearchType' => $conf->get( 'SearchType' ),
'wgVariantArticlePath' => $conf->get( 'VariantArticlePath' ),
// Force object to avoid "empty" associative array from
- // becoming [] instead of {} in JS (bug 34604)
+ // becoming [] instead of {} in JS (T36604)
'wgActionPaths' => (object)$conf->get( 'ActionPaths' ),
'wgServer' => $conf->get( 'Server' ),
'wgServerName' => $conf->get( 'ServerName' ),
return true;
}
- // Bug 68488: For other modules (i.e. ones that are called in cached html output) only check
+ // T70488: For other modules (i.e. ones that are called in cached html output) only check
// page existance. This ensures that, if some pages in a module are temporarily blanked,
// we don't end omit the module's script or link tag on some pages.
return count( $revisions ) === 0;
public function merge( SearchIndexField $that ) {
// TODO: which definitions may be compatible?
if ( ( $that instanceof self ) && $this->type === $that->type &&
- $this->flags === $that->flags && $this->type !== self::INDEX_TYPE_NESTED
+ $this->flags === $that->flags && $this->type !== self::INDEX_TYPE_NESTED
) {
return $that;
}
*
* The return value is such that someone could theoretically do this:
* @code
- * foreach ( $provider->getVaryHeaders() as $header => $options ) {
- * $outputPage->addVaryHeader( $header, $options );
- * }
+ * foreach ( $provider->getVaryHeaders() as $header => $options ) {
+ * $outputPage->addVaryHeader( $header, $options );
+ * }
* @endcode
*
* @return array
*
* The return value is such that someone could theoretically do this:
* @code
- * foreach ( $provider->getVaryHeaders() as $header => $options ) {
- * $outputPage->addVaryHeader( $header, $options );
- * }
+ * foreach ( $provider->getVaryHeaders() as $header => $options ) {
+ * $outputPage->addVaryHeader( $header, $options );
+ * }
* @endcode
*
* @protected For use by \MediaWiki\Session\SessionManager only
*
* If a "data" key is present, it must be an array, where the keys represent
* the data-xxx properties with their provided values. For example,
- * $item['data'] = [
- * 'foo' => 1,
- * 'bar' => 'baz',
- * ];
+ * $item['data'] = [
+ * 'foo' => 1,
+ * 'bar' => 'baz',
+ * ];
* will render as element properties:
- * data-foo='1' data-bar='baz'
+ * data-foo='1' data-bar='baz'
*
* @param array $options Can be used to affect the output of a link.
* Possible options are:
if ( $title->isSpecialPage() ) {
$type = 'ns-special';
- // bug 23315: provide a class based on the canonical special page name without subpages
+ // T25315: provide a class based on the canonical special page name without subpages
list( $canonicalName ) = SpecialPageFactory::resolveAlias( $title->getDBkey() );
if ( $canonicalName ) {
$type .= ' ' . Sanitizer::escapeClass( "mw-special-$canonicalName" );
$line = array_map( 'trim', explode( '|', $line, 2 ) );
if ( count( $line ) !== 2 ) {
// Second sanity check, could be hit by people doing
- // funky stuff with parserfuncs... (bug 33321)
+ // funky stuff with parserfuncs... (T35321)
continue;
}
$attribs = [];
if ( !is_null( $tooltip ) ) {
- # Bug 25462: undo double-escaping.
+ # T27462: undo double-escaping.
$tooltip = Sanitizer::decodeCharReferences( $tooltip );
$attribs['title'] = wfMessage( 'editsectionhint' )->rawParams( $tooltip )
->inLanguage( $lang )->text();
/* set up the default links for the personal toolbar */
$personal_urls = [];
- # Due to bug 32276, if a user does not have read permissions,
+ # Due to T34276, if a user does not have read permissions,
# $this->getTitle() will just give Special:Badtitle, which is
# not especially useful as a returnto parameter. Use the title
# from the request instead, if there was one.
'text' => $this->msg( 'pt-userlogout' )->text(),
'href' => self::makeSpecialUrl( 'Userlogout',
// userlogout link must always contain an & character, otherwise we might not be able
- // to detect a buggy precaching proxy (bug 17790)
+ // to detect a buggy precaching proxy (T19790)
$title->isSpecial( 'Preferences' ) ? 'noreturnto' : $returnto ),
'active' => false
];
$content_navigation['namespaces']['special'] = [
'class' => 'selected',
'text' => $this->msg( 'nstab-special' )->text(),
- 'href' => $request->getRequestURL(), // @see: bug 2457, bug 2510
+ 'href' => $request->getRequestURL(), // @see: T4457, T4510
'context' => 'subject'
];
$operator = $opts['invert'] ? '!=' : '=';
$boolean = $opts['invert'] ? 'AND' : 'OR';
- // Namespace association (bug 2429)
+ // Namespace association (T4429)
if ( !$opts['associated'] ) {
$condition = "rc_namespace $operator $selectedNS";
} else {
# 1. When switching accounts, it sucks to get automatically logged out
# 2. Do not return to PasswordReset after a successful password change
- # but goto Wiki start page (Main_Page) instead ( bug 33997 )
+ # but goto Wiki start page (Main_Page) instead ( T35997 )
$returnToTitle = Title::newFromText( $this->mReturnTo );
if ( is_object( $returnToTitle )
&& ( $returnToTitle->isSpecial( 'Userlogout' )
*/
protected function getFakeTemplate( $msg, $msgType ) {
global $wgAuth, $wgEnableEmail, $wgHiddenPrefs, $wgEmailConfirmToEdit, $wgEnableUserEmail,
- $wgSecureLogin, $wgPasswordResetRoutes;
+ $wgSecureLogin, $wgPasswordResetRoutes;
// make a best effort to get the value of fields which used to be fixed in the old login
// template but now might or might not exist depending on what providers are used
$user = $this->getUser();
$template = new FakeAuthTemplate();
- // Pre-fill username (if not creating an account, bug 44775).
+ // Pre-fill username (if not creating an account, T46775).
if ( $data->mUsername == '' && $this->isSignup() ) {
if ( $user->isLoggedIn() ) {
$data->mUsername = $user->getName();
$resetLink = $this->isSignup()
? null
: is_array( $wgPasswordResetRoutes )
- && in_array( true, array_values( $wgPasswordResetRoutes ), true );
+ && in_array( true, array_values( $wgPasswordResetRoutes ), true );
$template->set( 'header', '' );
$template->set( 'formheader', '' );
$value = wfTimestamp( TS_UNIX,
$row->value );
} else {
- $value = intval( $row->value ); // @bug 14414
+ $value = intval( $row->value ); // T16414
}
} else {
$value = 0;
return [ null, null ];
}
- if ( !isset( $bits[1] ) ) { // bug 2087
+ if ( !isset( $bits[1] ) ) { // T4087
$par = null;
} else {
$par = $bits[1];
// @todo FIXME: Redirects broken due to this call
$bits = explode( '/', $title->getDBkey(), 2 );
$name = $bits[0];
- if ( !isset( $bits[1] ) ) { // bug 2087
+ if ( !isset( $bits[1] ) ) { // T4087
$par = null;
} else {
$par = $bits[1];
protected function checkExecutePermissions( User $user ) {
parent::checkExecutePermissions( $user );
- # bug 15810: blocked admins should have limited access here
+ # T17810: blocked admins should have limited access here
$status = self::checkUnblockSelf( $this->target, $user );
if ( $status !== true ) {
throw new ErrorPageError( 'badaccess', $status );
}
// If the username was hidden (ipb_deleted == 1), don't show the reason
- // unless this user also has rights to hideuser: Bug 35839
+ // unless this user also has rights to hideuser: T37839
if ( !$block->mHideName || $this->getUser()->isAllowed( 'hideuser' ) ) {
$fields['Reason']['default'] = $block->mReason;
} else {
$blockNotConfirmed = !$data['Confirm'] || ( array_key_exists( 'PreviousTarget', $data )
&& $data['PreviousTarget'] !== $target );
- # Special case for API - bug 32434
+ # Special case for API - T34434
$reblockNotAllowed = ( array_key_exists( 'Reblock', $data ) && !$data['Reblock'] );
# Show form unless the user is already aware of this...
$logEntry->setComment( $data['Reason'][0] );
$logEntry->setPerformer( $performer );
$logEntry->setParameters( $logParams );
- # Relate log ID to block IDs (bug 25763)
+ # Relate log ID to block IDs (T27763)
$blockIds = array_merge( [ $status['id'] ], $status['autoIds'] );
$logEntry->setRelations( [ 'ipb_id' => $blockIds ] );
$logId = $logEntry->insert();
}
/**
- * bug 15810: blocked admins should not be able to block/unblock
+ * T17810: blocked admins should not be able to block/unblock
* others, and probably shouldn't be able to unblock themselves
* either.
* @param User|int|string $user
[ 'page' => $userpage->getPrefixedText() ]
);
- # Suppression log link (bug 59120)
+ # Suppression log link (T61120)
if ( $sp->getUser()->isAllowed( 'suppressionlog' ) ) {
$tools['log-suppression'] = $linkRenderer->makeKnownLink(
SpecialPage::getTitleFor( 'Log', 'suppress' ),
'conds' => [
'ra.rd_from = pa.page_id',
- // Filter out redirects where the target goes interwiki (bug 40353).
+ // Filter out redirects where the target goes interwiki (T42353).
// This isn't an optimization, it is required for correct results,
// otherwise a non-double redirect like Bar -> w:Foo will show up
// like "Bar -> Foo -> w:Foo".
* HTMLMultiSelectField throws validation errors if we get input data
* that doesn't match the data set in the form setup. This causes
* problems if something gets removed from the watchlist while the
- * form is open (bug 32126), but we know that invalid items will
+ * form is open (T34126), but we know that invalid items will
* be harmless so we can override it here.
*
* @param string $value The value the field was submitted with
$user = $this->getUser();
// To prevent cross-site scripting attacks, don't show the preview if raw HTML is
- // allowed and a valid edit token is not provided (bug 71111). However, MediaWiki
+ // allowed and a valid edit token is not provided (T73111). However, MediaWiki
// does not currently provide logged-out users with CSRF protection; in that case,
// do not show the preview unless anonymous editing is allowed.
if ( $user->isAnon() && !$user->isAllowed( 'edit' ) ) {
$pages = array_keys( $pageSet );
- // Normalize titles to the same format and remove dupes, see bug 17374
+ // Normalize titles to the same format and remove dupes, see T19374
foreach ( $pages as $k => $v ) {
$pages[$k] = str_replace( " ", "_", $v );
}
$exporter->allPages();
} else {
foreach ( $pages as $page ) {
- # Bug 8824: Only export pages the user can read
+ # T10824: Only export pages the user can read
$title = Title::newFromText( $page );
if ( is_null( $title ) ) {
// @todo Perhaps output an <error> tag or something.
# Some log types are only for a 'User:' title but we might have been given
# only the username instead of the full title 'User:username'. This part try
- # to lookup for a user by that name and eventually fix user input. See bug 1697.
+ # to lookup for a user by that name and eventually fix user input. See T3697.
if ( in_array( $opts->getValue( 'type' ), self::getLogTypesOnUser() ) ) {
# ok we have a type of log which expect a user title.
$target = Title::newFromText( $opts->getValue( 'page' ) );
$request = $this->getRequest();
$target = !is_null( $par ) ? $par : $request->getVal( 'target' );
- // Yes, the use of getVal() and getText() is wanted, see bug 20365
+ // Yes, the use of getVal() and getText() is wanted, see T22365
$oldTitleText = $request->getVal( 'wpOldTitle', $target );
$this->oldTitle = Title::newFromText( $oldTitleText );
// a redirect to the new title. This is not safe, but what we did before was
// even worse: we just determined whether a redirect should have been created,
// and reported that it was created if it should have, without any checks.
- // Also note that isRedirect() is unreliable because of bug 37209.
+ // Also note that isRedirect() is unreliable because of T39209.
$msgName = 'movepage-moved-redirect';
} else {
$msgName = 'movepage-moved-noredirect';
$newPageName = preg_replace(
'#^' . preg_quote( $ot->getDBkey(), '#' ) . '#',
- StringUtils::escapeRegexReplacement( $nt->getDBkey() ), # bug 21234
+ StringUtils::escapeRegexReplacement( $nt->getDBkey() ), # T23234
$oldSubpage->getDBkey()
);
$newNs = $nt->getSubjectPage()->getNamespace();
}
- # Bug 14385: we need makeTitleSafe because the new page names may
+ # T16385: we need makeTitleSafe because the new page names may
# be longer than 255 characters.
$newSubpage = Title::makeTitleSafe( $newNs, $newPageName );
if ( !$newSubpage ) {
$showme = $from;
}
- // Bug 27864: if transcluded, show all pages instead of the form.
+ // T29864: if transcluded, show all pages instead of the form.
if ( $this->including() || $showme != '' || $ns !== null ) {
$this->showPrefixChunk( $namespace, $showme, $from );
} else {
function makeOptionsLink( $title, $override, $options, $active = false ) {
$params = $override + $options;
- // Bug 36524: false values have be converted to "0" otherwise
+ // T38524: false values have be converted to "0" otherwise
// wfArrayToCgi() will omit it them.
foreach ( $params as &$value ) {
if ( $value === false ) {
function filterOnUserExperienceLevel( &$tables, &$conds, &$join_conds, $opts ) {
global $wgLearnerEdits,
- $wgExperiencedUserEdits,
- $wgLearnerMemberSince,
- $wgExperiencedUserMemberSince;
+ $wgExperiencedUserEdits,
+ $wgLearnerMemberSince,
+ $wgExperiencedUserMemberSince;
$selectedExpLevels = explode( ',', strtolower( $opts['userExpLevel'] ) );
// remove values that are not recognized
if ( !$msg->isDisabled() ) {
$descriptionHtml = $this->msg( 'parentheses' )->rawParams( $msg->parse() )
->escaped();
- $text .= "<br />" .
- Html::rawElement( 'small', [ 'class' => 'mw-statistic-desc' ],
- " $descriptionHtml" );
+ $text .= "<br />" . Html::rawElement(
+ 'small',
+ [ 'class' => 'mw-statistic-desc' ],
+ " $descriptionHtml"
+ );
}
}
return [ [ 'ipb_cant_unblock', $target ] ];
}
- # bug 15810: blocked admins should have limited access here. This
+ # T17810: blocked admins should have limited access here. This
# won't allow sysops to remove autoblocks on themselves, but they
# should have ipblock-exempt anyway
$status = SpecialBlock::checkUnblockSelf( $target, $performer );
# Does this page already exist? We'll have to update it...
$article = WikiPage::factory( $this->title );
- # Load latest data for the current page (bug 31179)
+ # Load latest data for the current page (T33179)
$article->loadPageData( 'fromdbmaster' );
$oldcountable = $article->isCountable();
}
/**
- * A should come before Z (bug 30907)
+ * A should come before Z (T32907)
* @return bool
*/
function sortDescending() {
header( "Content-Type: $contentType", true );
header( 'Content-Transfer-Encoding: binary', true );
header( 'Expires: Sun, 17-Jan-2038 19:14:07 GMT', true );
- // Bug 53032 - It shouldn't be a problem here, but let's be safe and not cache
+ // T55032 - It shouldn't be a problem here, but let's be safe and not cache
header( 'Cache-Control: private' );
header( "Content-Length: $size", true );
}
function execute( $par ) {
/**
* Some satellite ISPs use broken precaching schemes that log people out straight after
- * they're logged in (bug 17790). Luckily, there's a way to detect such requests.
+ * they're logged in (T19790). Luckily, there's a way to detect such requests.
*/
if ( isset( $_SERVER['REQUEST_URI'] ) && strpos( $_SERVER['REQUEST_URI'], '&' ) !== false ) {
wfDebug( "Special:UserLogout request {$_SERVER['REQUEST_URI']} looks suspicious, denying.\n" );
}
$targetUser = $this->mFetchedUser;
- if ( $targetUser instanceof User ) { // UserRightsProxy doesn't have this method (bug 61252)
- $targetUser->clearInstanceCache(); // bug 38989
+ if ( $targetUser instanceof User ) { // UserRightsProxy doesn't have this method (T63252)
+ $targetUser->clearInstanceCache(); // T40989
}
if ( $request->getVal( 'conflictcheck-originalgroups' )
* KLUGE: The results may contain false positives for files
* that exist e.g. in a shared repo. Setting this at least
* keeps them from showing up as redlinks in the output, even
- * if it doesn't fix the real problem (bug 6220).
+ * if it doesn't fix the real problem (T8220).
*
* @note could also have existing links here from broken file
* redirects.
$user = $this->getUser();
$conds = array_merge( $userCond, $this->getNamespaceCond() );
- // Paranoia: avoid brute force searches (bug 17342)
+ // Paranoia: avoid brute force searches (T19342)
if ( !$user->isAllowed( 'deletedhistory' ) ) {
$conds[] = $this->mDb->bitAnd( 'rev_deleted', Revision::DELETED_USER ) . ' = 0';
} elseif ( !$user->isAllowedAny( 'suppressrevision', 'viewsuppressed' ) ) {
if ( $row->rev_parent_id === null ) {
// For some reason rev_parent_id isn't populated for this row.
- // Its rumoured this is true on wikipedia for some revisions (bug 34922).
+ // Its rumoured this is true on wikipedia for some revisions (T36922).
// Next best thing is to have the total number of bytes.
$chardiff = ' <span class="mw-changeslist-separator">. .</span> ';
$chardiff .= Linker::formatRevisionSize( $row->rev_len );
list( $index, $userCond ) = $this->getUserCond();
$conds = array_merge( $userCond, $this->getNamespaceCond() );
$user = $this->getUser();
- // Paranoia: avoid brute force searches (bug 17792)
+ // Paranoia: avoid brute force searches (T19792)
if ( !$user->isAllowed( 'deletedhistory' ) ) {
$conds[] = $this->mDb->bitAnd( 'ar_deleted', Revision::DELETED_USER ) . ' = 0';
} elseif ( !$user->isAllowedAny( 'suppressrevision', 'viewsuppressed' ) ) {
$imgfile = $this->msg( 'imgfile' )->text();
}
- // Weird files can maybe exist? Bug 22227
+ // Weird files can maybe exist? T24227
$filePage = Title::makeTitleSafe( NS_FILE, $value );
if ( $filePage ) {
$link = $linkRenderer->makeKnownLink(
* @return string
*/
function formatRow( $row ) {
- if ( $row->user_id == 0 ) { # Bug 16487
+ if ( $row->user_id == 0 ) { # T18487
return '';
}
* Regex borrowed from Tim Starling's "remex-html" project.
*/
const VALID_COMMENT_REGEX = "~ !--
- ( # 1. Comment match detector
+ ( # 1. Comment match detector
> | -> | # Invalid short close
( # 2. Comment contents
(?:
( # 3. Comment close
--> | # Normal close
--!> | # Comment end bang
- ( # 4. Indicate matches requiring EOF
- --! | # EOF in comment end bang state
- -- | # EOF in comment end state
- - | # EOF in comment end dash state
- # EOF in comment state
+ ( # 4. Indicate matches requiring EOF
+ --! | # EOF in comment end bang state
+ -- | # EOF in comment end state
+ - | # EOF in comment end dash state
+ (?#nothing) # EOF in comment state
)
)
)
- ([^<]*) \z # 5. Non-tag text after the comment
+ ([^<]*) \z # 5. Non-tag text after the comment
~xs";
/**
* @param string $srcPath The source path
* @return string|bool The real path if it was a virtual URL Returns false on failure
*/
- function getRealPath( $srcPath ) {
+ public function getRealPath( $srcPath ) {
$repo = RepoGroup::singleton()->getLocalRepo();
if ( $repo->isVirtualUrl( $srcPath ) ) {
/** @todo Just make uploads work with storage paths UploadFromStash
*
* @param array $entry
*/
- function zipEntryCallback( $entry ) {
+ public function zipEntryCallback( $entry ) {
$names = [ $entry['name'] ];
// If there is a null character, cut off the name at it, because JDK's
return $this->mTitle;
}
- // Windows may be broken with special characters, see bug 1780
+ // Windows may be broken with special characters, see T3780
if ( !preg_match( '/^[\x0-\x7f]*$/', $nt->getText() )
&& !RepoGroup::singleton()->getLocalRepo()->backendSupportsUnicodePaths()
) {
}
// Some browsers will interpret obscure xml encodings as UTF-8, while
- // PHP/expat will interpret the given encoding in the xml declaration (bug 47304)
+ // PHP/expat will interpret the given encoding in the xml declaration (T49304)
if ( $extension == 'svg' || strpos( $mime, 'image/svg' ) === 0 ) {
if ( self::checkXMLEncodingMissmatch( $file ) ) {
return true;
[ 'processing_instruction_handler' => 'UploadBase::checkSvgPICallback' ]
);
if ( $check->wellFormed !== true ) {
- // Invalid xml (bug 58553)
- // But only when non-partial (bug 65724)
+ // Invalid xml (T60553)
+ // But only when non-partial (T67724)
return $partial ? false : [ 'uploadinvalidxml' ];
} elseif ( $check->filterMatch ) {
if ( $this->mSVGNSError ) {
* @return bool (true if the filter identified something bad)
*/
public static function checkSvgPICallback( $target, $data ) {
- // Don't allow external stylesheets (bug 57550)
+ // Don't allow external stylesheets (T59550)
if ( preg_match( '/xml-stylesheet/i', $target ) ) {
return [ 'upload-scripted-pi-callback' ];
}
list( $namespace, $strippedElement ) = $this->splitXmlNamespace( $element );
// We specifically don't include:
- // http://www.w3.org/1999/xhtml (bug 60771)
+ // http://www.w3.org/1999/xhtml (T62771)
static $validNamespaces = [
'',
'adobe:ns:meta/',
$firstUser = $users[0];
if ( !$firstUser instanceof User || !$firstUser->getId() ) {
- // Don't parse username as wikitext (bug 65501)
+ // Don't parse username as wikitext (T67501)
return StatusValue::newFatal( wfMessage( 'nosuchuser', wfEscapeWikiText( $username ) ) );
}
wfEscapeWikiText( $firstUser->getName() ) ) );
}
- // We need to have a valid IP address for the hook, but per bug 18347, we should
+ // We need to have a valid IP address for the hook, but per T20347, we should
// send the user's name if they're logged in.
$ip = $performingUser->getRequest()->getIP();
if ( !$ip ) {
// Ensure that the username isn't longer than 235 bytes, so that
// (at least for the builtin skins) user javascript and css files
- // will work. (bug 23080)
+ // will work. (T25080)
if ( strlen( $name ) > 235 ) {
wfDebugLog( 'username', __METHOD__ .
": '$name' invalid due to length" );
}
// Clean up name according to title rules,
- // but only when validation is requested (bug 12654)
+ // but only when validation is requested (T14654)
$t = ( $validate !== false ) ?
Title::newFromText( $name, NS_USER ) : Title::makeTitle( NS_USER, $name );
// Check for invalid titles
}
}
- // (bug 23343) Apply IP blocks to the contents of XFF headers, if enabled
+ // (T25343) Apply IP blocks to the contents of XFF headers, if enabled
if ( !$block instanceof Block
&& $wgApplyIpBlocksToXff
&& $ip !== null
$found = false;
// @todo FIXME: IPv6 ??? (https://bugs.php.net/bug.php?id=33170)
if ( IP::isIPv4( $ip ) ) {
- // Reverse IP, bug 21255
+ // Reverse IP, T23255
$ipReversed = implode( '.', array_reverse( explode( '.', $ip ) ) );
foreach ( (array)$bases as $base ) {
*/
public function getExperienceLevel() {
global $wgLearnerEdits,
- $wgExperiencedUserEdits,
- $wgLearnerMemberSince,
- $wgExperiencedUserMemberSince;
+ $wgExperiencedUserEdits,
+ $wgLearnerMemberSince,
+ $wgExperiencedUserMemberSince;
if ( $this->isAnon() ) {
return false;
* }
* // do something with $user...
*
- * However, this was vulnerable to a race condition (bug 16020). By
+ * However, this was vulnerable to a race condition (T18020). By
* initialising the user object if the user exists, we aim to support this
* calling sequence as far as possible.
*
return $this->mBlock;
}
- # bug 13611: if the IP address the user is trying to create an account from is
+ # T15611: if the IP address the user is trying to create an account from is
# blocked with createaccount disabled, prevent new account creation there even
# when the user is logged in
if ( $this->mBlockedFromCreateAccount === false && !$this->isAllowed( 'ipblock-exempt' ) ) {
* @note Since these URLs get dropped directly into emails, using the
* short English names avoids insanely long URL-encoded links, which
* also sometimes can get corrupted in some browsers/mailers
- * (bug 6957 with Gmail and Internet Explorer).
+ * (T8957 with Gmail and Internet Explorer).
*
* @param string $page Special page
* @param string $token Token
# Note that the pattern requirement will always be satisfied if the
# input is empty, so we need required in all cases.
- # @todo FIXME: Bug 23769: This needs to not claim the password is required
+ # @todo FIXME: T25769: This needs to not claim the password is required
# if e-mail confirmation is being used. Since HTML5 input validation
# is b0rked anyway in some browsers, just return nothing. When it's
# re-enabled, fix this code to not output required for e-mail
* `=` conditions while the final key uses a `>` condition
*
* Example output:
- * [ '( foo = 42 AND bar > 7 ) OR ( foo > 42 )' ]
+ * [ '( foo = 42 AND bar > 7 ) OR ( foo > 42 )' ]
*
* @return array The SQL conditions necessary to select the next set
* of rows in the batched query
* From http://eprint.iacr.org/2010/264.pdf:
*
* The scheme HKDF is specifed as:
- * HKDF(XTS, SKM, CTXinfo, L) = K(1) || K(2) || ... || K(t)
+ * HKDF(XTS, SKM, CTXinfo, L) = K(1) || K(2) || ... || K(t)
* where the values K(i) are defined as follows:
- * PRK = HMAC(XTS, SKM)
- * K(1) = HMAC(PRK, CTXinfo || 0);
- * K(i+1) = HMAC(PRK, K(i) || CTXinfo || i), 1 <= i < t;
+ * PRK = HMAC(XTS, SKM)
+ * K(1) = HMAC(PRK, CTXinfo || 0);
+ * K(i+1) = HMAC(PRK, K(i) || CTXinfo || i), 1 <= i < t;
* where t = [L/k] and the value K(t) is truncated to its first d = L mod k bits;
* the counter i is non-wrapping and of a given fixed size, e.g., a single byte.
* Note that the length of the HMAC output is the same as its key length and therefore
* the date preference they're supposed to use, it should be used in
* all children.
*
- *<code>
- * function timeanddate([...], $format = true) {
- * $datePreference = $this->dateFormat($format);
- * [...]
- * }
- *</code>
+ * function timeanddate([...], $format = true) {
+ * $datePreference = $this->dateFormat($format);
+ * [...]
+ * }
*
* @param int|string|bool $usePrefs If true, the user's preference is used
* if false, the site/language default is used
public function parseFormattedNumber( $number ) {
$s = $this->digitTransformTable();
if ( $s ) {
- // eliminate empty array values such as ''. (bug 64347)
+ // eliminate empty array values such as ''. (T66347)
$s = array_filter( $s );
$number = strtr( $number, array_flip( $s ) );
}
$s = $this->separatorTransformTable();
if ( $s ) {
- // eliminate empty array values such as ''. (bug 64347)
+ // eliminate empty array values such as ''. (T66347)
$s = array_filter( $s );
$number = strtr( $number, array_flip( $s ) );
}
$string = $ellipsis . $string;
}
}
- # Do not truncate if the ellipsis makes the string longer/equal (bug 22181).
+ # Do not truncate if the ellipsis makes the string longer/equal (T24181).
# This check is *not* redundant if $adjustLength, due to the single case where
# LEN($ellipsis) > ABS($limit arg); $stringOriginal could be shorter than $string.
if ( strlen( $string ) < strlen( $stringOriginal ) ) {
// '+' add rules for alltext
// 'E' the gave flags is error
// these flags above are reserved for program
- 'A' => 'A', // add rule for convert code (all text convert)
- 'T' => 'T', // title convert
- 'R' => 'R', // raw content
- 'D' => 'D', // convert description (subclass implement)
- '-' => '-', // remove convert (not implement)
- 'H' => 'H', // add rule for convert code (but no display in placed code)
- 'N' => 'N' // current variant name
+ 'A' => 'A', // add rule for convert code (all text convert)
+ 'T' => 'T', // title convert
+ 'R' => 'R', // raw content
+ 'D' => 'D', // convert description (subclass implement)
+ '-' => '-', // remove convert (not implement)
+ 'H' => 'H', // add rule for convert code (but no display in placed code)
+ 'N' => 'N', // current variant name
];
$this->mFlags = array_merge( $defaultflags, $flags );
foreach ( $this->mVariants as $v ) {
}
/* we convert everything except:
- 1. HTML markups (anything between < and >)
- 2. HTML entities
- 3. placeholders created by the parser
- */
+ * 1. HTML markups (anything between < and >)
+ * 2. HTML entities
+ * 3. placeholders created by the parser
+ */
$marker = '|' . Parser::MARKER_PREFIX . '[\-a-zA-Z0-9]+';
// this one is needed when the text is inside an HTML markup
protected function applyManualConv( $convRule ) {
// Use syntax -{T|zh-cn:TitleCN; zh-tw:TitleTw}- to custom
// title conversion.
- // Bug 24072: $mConvRuleTitle was overwritten by other manual
+ // T26072: $mConvRuleTitle was overwritten by other manual
// rule(s) not for title, this breaks the title conversion.
$newConvRuleTitle = $convRule->getTitle();
if ( $newConvRuleTitle ) {
// text should be splited by ";" only if a valid variant
// name exist after the markup, for example:
// -{zh-hans:<span style="font-size:120%;">xxx</span>;zh-hant:\
- // <span style="font-size:120%;">yyy</span>;}-
+ // <span style="font-size:120%;">yyy</span>;}-
// we should split it as:
// [
- // [0] => 'zh-hans:<span style="font-size:120%;">xxx</span>'
- // [1] => 'zh-hant:<span style="font-size:120%;">yyy</span>'
- // [2] => ''
+ // [0] => 'zh-hans:<span style="font-size:120%;">xxx</span>'
+ // [1] => 'zh-hant:<span style="font-size:120%;">yyy</span>'
+ // [2] => ''
// ]
$pat = '/;\s*(?=';
foreach ( $this->mVariants as $variant ) {
class LanguageAr extends Language {
/**
- * Temporary hack for bug 9413: replace Arabic presentation forms with their
+ * Temporary hack for T11413: replace Arabic presentation forms with their
* standard equivalents.
*
* @todo FIXME: This is language-specific for now only to avoid the negative
*
* Possible values for the type of genitive are:
* Sing, Iehr prepositioned genitive = possessive dative
- * Vun, Fon, -omitted- postpositioned genitive
- * = preposition "vun" with dative
+ * Vun, Fon, -omitted- postpositioned genitive = preposition "vun" with dative
*
* Values of case overrides & prepositions, in the order of preceedence:
* Sing, Iehr possessive dative = prepositioned genitive
- * Vun, Fon preposition "vun" with dative
- * = postpositioned genitive
+ * Vun, Fon preposition "vun" with dative = postpositioned genitive
* En, em preposition "en" with dative
*
* Values for object gender specifiers of the possessive dative, or
case 'genitive':
// only a few declensions, and even for those mostly the singular only
$in = [
- '/u[ms]$/', # 2nd declension singular
- '/ommunia$/', # 3rd declension neuter plural (partly)
- '/a$/', # 1st declension singular
+ '/u[ms]$/', # 2nd declension singular
+ '/ommunia$/', # 3rd declension neuter plural (partly)
+ '/a$/', # 1st declension singular
'/libri$/', '/nuntii$/', '/datae$/', # 2nd declension plural (partly)
- '/tio$/', '/ns$/', '/as$/', # 3rd declension singular (partly)
- '/es$/' # 5th declension singular
+ '/tio$/', '/ns$/', '/as$/', # 3rd declension singular (partly)
+ '/es$/' # 5th declension singular
];
$out = [
'i',
case 'accusative':
// only a few declensions, and even for those mostly the singular only
$in = [
- '/u[ms]$/', # 2nd declension singular
- '/a$/', # 1st declension singular
- '/ommuniam$/', # 3rd declension neuter plural (partly)
+ '/u[ms]$/', # 2nd declension singular
+ '/a$/', # 1st declension singular
+ '/ommuniam$/', # 3rd declension neuter plural (partly)
'/libri$/', '/nuntii$/', '/datam$/', # 2nd declension plural (partly)
- '/tio$/', '/ns$/', '/as$/', # 3rd declension singular (partly)
- '/es$/' # 5th declension singular
+ '/tio$/', '/ns$/', '/as$/', # 3rd declension singular (partly)
+ '/es$/' # 5th declension singular
];
$out = [
'um',
case 'ablative':
// only a few declensions, and even for those mostly the singular only
$in = [
- '/u[ms]$/', # 2nd declension singular
- '/ommunia$/', # 3rd declension neuter plural (partly)
- '/a$/', # 1st declension singular
- '/libri$/', '/nuntii$/', '/data$/', # 2nd declension plural (partly)
- '/tio$/', '/ns$/', '/as$/', # 3rd declension singular (partly)
- '/es$/' # 5th declension singular
+ '/u[ms]$/', # 2nd declension singular
+ '/ommunia$/', # 3rd declension neuter plural (partly)
+ '/a$/', # 1st declension singular
+ '/libri$/', '/nuntii$/', '/data$/', # 2nd declension plural (partly)
+ '/tio$/', '/ns$/', '/as$/', # 3rd declension singular (partly)
+ '/es$/' # 5th declension singular
];
$out = [
'o',
* Temporary hack for the issue described at
* http://permalink.gmane.org/gmane.science.linguistics.wikipedia.technical/46396
* Convert Unicode 5.0 style Malayalam input to Unicode 5.1. Similar to
- * bug 9413. Also fixes miscellaneous problems due to mishandling of ZWJ,
- * e.g. bug 11162.
+ * T11413. Also fixes miscellaneous problems due to mishandling of ZWJ,
+ * e.g. T13162.
*
* @todo FIXME: This is language-specific for now only to avoid the negative
* performance impact of enabling it for all languages.
* Turkish has two different i, one with a dot and another without a dot. They
* are totally different letters in this language, so we have to override the
* ucfirst and lcfirst methods.
- * See https://en.wikipedia.org/wiki/Dotted_and_dotless_I
- * and @bug 28040
+ * See https://en.wikipedia.org/wiki/Dotted_and_dotless_I and T30040
* @ingroup Language
*/
class LanguageTr extends Language {
'als' => 'Alemannisch', # Alemannic -- not a valid code, for compatibility. See gsw.
'am' => 'አማርኛ', # Amharic
'an' => 'aragonés', # Aragonese
- 'ang' => 'Ænglisc', # Old English, bug 23283
+ 'ang' => 'Ænglisc', # Old English, T25283
'anp' => 'अङ्गिका', # Angika
'ar' => 'العربية', # Arabic
'arc' => 'ܐܪܡܝܐ', # Aramaic
'lus' => 'Mizo ţawng', # Mizo/Lushai
'luz' => 'لئری دوٙمینی', # Southern Luri
'lv' => 'latviešu', # Latvian
- 'lzh' => '文言', # Literary Chinese, bug 8217
+ 'lzh' => '文言', # Literary Chinese, T10217
'lzz' => 'Lazuri', # Laz
'mai' => 'मैथिली', # Maithili
'map-bms' => 'Basa Banyumasan', # Banyumasan
'mzn' => 'مازِرونی', # Mazanderani
'na' => 'Dorerin Naoero', # Nauruan
'nah' => 'Nāhuatl', # Nahuatl (not in ISO 639-3)
- 'nan' => 'Bân-lâm-gú', # Min-nan, bug 8217
- 'nap' => 'Napulitano', # Neapolitan, bug 43793
+ 'nan' => 'Bân-lâm-gú', # Min-nan, T10217
+ 'nap' => 'Napulitano', # Neapolitan, T45793
'nb' => 'norsk bokmål', # Norwegian (Bokmal)
'nds' => 'Plattdüütsch', # Low German ''or'' Low Saxon
'nds-nl' => 'Nedersaksies', # aka Nedersaksisch: Dutch Low Saxon
'olo' => 'Livvinkarjala', # Livvi-Karelian
'om' => 'Oromoo', # Oromo
'or' => 'ଓଡ଼ିଆ', # Oriya
- 'os' => 'Ирон', # Ossetic, bug 29091
+ 'os' => 'Ирон', # Ossetic, T31091
'pa' => 'ਪੰਜਾਬੀ', # Eastern Punjabi (Gurmukhi script) (pan)
'pag' => 'Pangasinan', # Pangasinan
'pam' => 'Kapampangan', # Pampanga
'za' => 'Vahcuengh', # Zhuang
'zea' => 'Zeêuws', # Zeeuws/Zeaws
'zh' => '中文', # (Zhōng Wén) - Chinese
- 'zh-classical' => '文言', # Classical Chinese/Literary Chinese -- (see bug 8217)
+ 'zh-classical' => '文言', # Classical Chinese/Literary Chinese -- (see T10217)
'zh-cn' => "中文(中国大陆)\xE2\x80\x8E", # Chinese (PRC)
'zh-hans' => "中文(简体)\xE2\x80\x8E", # Mandarin Chinese (Simplified Chinese script) (cmn-hans)
'zh-hant' => "中文(繁體)\xE2\x80\x8E", # Mandarin Chinese (Traditional Chinese script) (cmn-hant)
'zh-hk' => "中文(香港)\xE2\x80\x8E", # Chinese (Hong Kong)
- 'zh-min-nan' => 'Bân-lâm-gú', # Min-nan -- (see bug 8217)
+ 'zh-min-nan' => 'Bân-lâm-gú', # Min-nan -- (see T10217)
'zh-mo' => "中文(澳門)\xE2\x80\x8E", # Chinese (Macau)
'zh-my' => "中文(马来西亚)\xE2\x80\x8E", # Chinese (Malaysia)
'zh-sg' => "中文(新加坡)\xE2\x80\x8E", # Chinese (Singapore)
'zh-tw' => "中文(台灣)\xE2\x80\x8E", # Chinese (Taiwan)
- 'zh-yue' => '粵語', # Cantonese -- (see bug 8217)
+ 'zh-yue' => '粵語', # Cantonese -- (see T10217)
'zu' => 'isiZulu' # Zulu
];
}
'pagesincategory_files' => [ '0', 'فايلات', 'ملفات', 'files' ],
];
-// (bug 16469) Override Eastern Arabic numberals, use Western
+// (T18469) Override Eastern Arabic numberals, use Western
$digitTransformTable = [
'0' => '0',
'1' => '1',
* Example:
* @code
* $namespaceGenderAliases = [
- * NS_USER => [ 'male' => 'Male_user', 'female' => 'Female_user' ],
+ * NS_USER => [ 'male' => 'Male_user', 'female' => 'Female_user' ],
* ];
* @endcode
*/
'img_center' => [ '1', 'erdian', 'center', 'centre' ],
];
-$separatorTransformTable = [ ',' => '.', '.' => ',' ]; /* Bug 15717 */
+$separatorTransformTable = [ ',' => '.', '.' => ',' ]; /* T17717 */
NS_CATEGORY_TALK => 'Ñemohenda_myangekõi',
];
-// Remove Spanish gender aliases (bug 37090)
+// Remove Spanish gender aliases (T39090)
$namespaceGenderAliases = [];
*
*/
-# $fallback = 'ru'; // bug 27785
+# $fallback = 'ru'; // T29785
$namespaceNames = [
NS_MEDIA => 'Медиа',
'Diskusyón_de_Katēggoría' => NS_CATEGORY_TALK,
];
-// Remove Spanish gender aliases (bug 37090)
+// Remove Spanish gender aliases (T39090)
$namespaceGenderAliases = [];
$specialPageAliases = [
$linkPrefixExtension = true;
-# Same as the French (bug 8485)
+# Same as the French (T10485)
$separatorTransformTable = [ ',' => "\xc2\xa0", '.' => ',' ];
NS_CATEGORY_TALK => 'Neneuhcāyōtl_tēixnāmiquiliztli',
];
-// Remove Spanish gender aliases (bug 37090)
+// Remove Spanish gender aliases (T39090)
$namespaceGenderAliases = [];
$namespaceAliases = [
$fallback8bitEncoding = 'iso-8859-2';
$separatorTransformTable = [
- ',' => "\xc2\xa0", // @bug 2749
+ ',' => "\xc2\xa0", // T4749
'.' => ','
];
];
$separatorTransformTable = [ ',' => "\xc2\xa0", '.' => ',' ];
-$linkTrail = '/^([áâãàéêẽçíòóôõq̃úüűũa-z]+)(.*)$/sDu'; # Bug 21168, 27633
+$linkTrail = '/^([áâãàéêẽçíòóôõq̃úüűũa-z]+)(.*)$/sDu'; # T23168, T29633
$specialPageAliases = [
'Activeusers' => [ 'Utilizadores_activos' ],
NS_CATEGORY_TALK => 'Katiguriya_rimanakuy',
];
-// Remove Spanish gender aliases (bug 37090)
+// Remove Spanish gender aliases (T39090)
$namespaceGenderAliases = [];
$specialPageAliases = [
NS_CATEGORY_TALK => 'Samiyachiy_rimanakuy',
];
-// Remove Spanish gender aliases (bug 37090)
+// Remove Spanish gender aliases (T39090)
$namespaceGenderAliases = [];
$linkTrail = '/^([a-zåäöéÅÄÖÉ]+)(.*)$/sDu';
$separatorTransformTable = [
- ',' => "\xc2\xa0", // @bug 2749
+ ',' => "\xc2\xa0", // T4749
'.' => ','
];
];
$namespaceAliases = [
- // Aliases for Polish namespaces (bug 34988).
+ // Aliases for Polish namespaces (T36988).
'Specjalna' => NS_SPECIAL,
'Dyskusja' => NS_TALK,
'Użytkownik' => NS_USER,
$namespaceAliases = [
'సభ్యులు' => NS_USER,
'సభ్యులపై_చర్చ' => NS_USER_TALK,
- 'సభ్యుడు' => NS_USER, # set for bug 11615
+ 'సభ్యుడు' => NS_USER, # set for T13615
'సభ్యునిపై_చర్చ' => NS_USER_TALK,
'బొమ్మ' => NS_FILE,
'బొమ్మపై_చర్చ' => NS_FILE_TALK,
/**
* Namespace names
- * (bug 8708)
+ * (T10708)
*/
$namespaceNames = [
NS_MEDIA => 'Media',
--
-- patch-archive-ar_id.sql
--
--- Bug 39675. Add archive.ar_id.
+-- T41675. Add archive.ar_id.
ALTER TABLE /*$wgDBprefix*/archive
ADD COLUMN ar_id int unsigned NOT NULL AUTO_INCREMENT FIRST,
--
-- patch-categorylinks-better-collation.sql
--
--- Bugs 164, 1211, 23682. This is the second version of this patch; the
+-- T2164, T3211, T25682. This is the second version of this patch; the
-- changes are also incorporated into patch-categorylinks-better-collation2.sql,
-- for the benefit of trunk users who applied the original.
--
--- Due to bug 25254, the length limit of 255 bytes for cl_sortkey_prefix
+-- Due to T27254, the length limit of 255 bytes for cl_sortkey_prefix
-- is also enforced in php. If you change the length of that field, make
-- sure to also change the check in LinksUpdate.php.
ALTER TABLE /*$wgDBprefix*/categorylinks
--
-- patch-extenallinks-el_id.sql
--
--- Bug 15441. Add externallinks.el_id.
+-- T17441. Add externallinks.el_id.
ALTER TABLE /*$wgDBprefix*/externallinks
ADD COLUMN el_id int unsigned NOT NULL AUTO_INCREMENT FIRST,
--- Increase the length of up_property from 32 -> 255 bytes. Bug 19408
+-- Increase the length of up_property from 32 -> 255 bytes. T21408
ALTER TABLE /*_*/user_properties
MODIFY up_property varbinary(255);
"United States of America", // 7bit ASCII
"S%C3%A9rie%20t%C3%A9l%C3%A9vis%C3%A9e",
"Acteur%7CAlbert%20Robbins%7CAnglais%7CAnn%20Donahue%7CAnthony%20E.%20Zuiker%7CCarol%20Mendelsohn",
- // This comes from bug 36839
+ // This comes from T38839
"Acteur%7CAlbert%20Robbins%7CAnglais%7CAnn%20Donahue%7CAnthony%20E.%20Zuiker%7CCarol%20Mendelsohn%7C"
. "Catherine%20Willows%7CDavid%20Hodges%7CDavid%20Phillips%7CGil%20Grissom%7CGreg%20Sanders%7CHodges%7C"
. "Internet%20Movie%20Database%7CJim%20Brass%7CLady%20Heather%7C"
* if the target title exists in the image table, or if both the
* original and target titles exist in the page table, append
* increasing version numbers until the target title exists in
- * neither. (See also bug 16916.)
+ * neither. (See also T18916.)
*/
$version = 0;
$final = $new;
$prior = $title->getDBkey();
}
- # Old cleanupTitles could move articles there. See bug 23147.
+ # Old cleanupTitles could move articles there. See T25147.
$ns = $row->page_namespace;
if ( $ns < 0 ) {
$ns = 0;
}
# Namespace which no longer exists. Put the page in the main namespace
- # since we don't have any idea of the old namespace name. See bug 68501.
+ # since we don't have any idea of the old namespace name. See T70501.
if ( !MWNamespace::exists( $ns ) ) {
$ns = 0;
}
'rd_from = pa.page_id',
'rd_namespace = pb.page_namespace',
'rd_title = pb.page_title',
- 'rd_interwiki IS NULL OR rd_interwiki = ' . $dbr->addQuotes( '' ), // bug 40352
+ 'rd_interwiki IS NULL OR rd_interwiki = ' . $dbr->addQuotes( '' ), // T42352
'pb.page_is_redirect' => 1,
];
function fileEntry( $url, $date, $priority ) {
return
"\t<url>\n" .
- // bug 34666: $url may contain bad characters such as ampersands.
+ // T36666: $url may contain bad characters such as ampersands.
"\t\t<loc>" . htmlspecialchars( $url ) . "</loc>\n" .
"\t\t<lastmod>$date</lastmod>\n" .
"\t\t<priority>$priority</priority>\n" .
* @param int $namespace
*/
function generateLimit( $namespace ) {
- // bug 17961: make a title with the longest possible URL in this namespace
+ // T19961: make a title with the longest possible URL in this namespace
$title = Title::makeTitle( $namespace, str_repeat( "\xf0\xa8\xae\x81", 63 ) . "\xe5\x96\x83" );
$this->limit = [
$cmd = wfEscapeShellArg(
$hhvm,
'--hphp',
- '--target', 'hhbc',
+ '--target', 'hhbc',
'--format', 'binary',
'--force', '1',
'--keep-tempdir', '1',
# (preferably batching files too).
private function getFileCommentFromSourceWiki( $wiki_host, $file ) {
$url = $wiki_host . '/api.php?action=query&format=xml&titles=File:'
- . rawurlencode( $file ) . '&prop=imageinfo&&iiprop=comment';
+ . rawurlencode( $file ) . '&prop=imageinfo&&iiprop=comment';
$body = Http::get( $url, [], __METHOD__ );
if ( preg_match( '#<ii comment="([^"]*)" />#', $body, $matches ) == 0 ) {
return false;
private function getFileUserFromSourceWiki( $wiki_host, $file ) {
$url = $wiki_host . '/api.php?action=query&format=xml&titles=File:'
- . rawurlencode( $file ) . '&prop=imageinfo&&iiprop=user';
+ . rawurlencode( $file ) . '&prop=imageinfo&&iiprop=user';
$body = Http::get( $url, [], __METHOD__ );
if ( preg_match( '#<ii user="([^"]*)" />#', $body, $matches ) == 0 ) {
return false;
$affected += $dbw->affectedRows();
$this->commitTransaction( $dbw, __METHOD__ );
- // Clear cache for the affected users (bug 40340)
+ // Clear cache for the affected users (T42340)
if ( $affected > 0 ) {
// XXX: This also invalidates cache of unaffected users that
// were in the new group and not in the group.
-- conversion algorithm is run. We store this so that we can update
-- collations without reparsing all pages.
-- Note: If you change the length of this field, you also need to change
- -- code in LinksUpdate.php. See bug 25254.
+ -- code in LinksUpdate.php. See T27254.
cl_sortkey_prefix varbinary(255) NOT NULL default 0x,
-- This isn't really used at present. Provided for an optional
-- Size chosen to allow IPv6
-- FIXME: these fields were originally blank for single-IP blocks,
-- but now they are populated. No migration was ever done. They
- -- should be fixed to be blank again for such blocks (bug 49504).
+ -- should be fixed to be blank again for such blocks (T51504).
ipb_range_start varchar(255) NOT NULL,
ipb_range_end varchar(255) NOT NULL,
$content = $rev->getContent();
if ( !$content ) {
- # This should not happen, but sometimes does (bug 20757)
+ # This should not happen, but sometimes does (T22757)
$id = $row->$idCol;
$this->output( "Content of $table $id unavailable!\n" );
} catch ( Exception $e ) {
$this->output( "Data of revision with {$idCol}={$row->$idCol} unavailable!\n" );
- return false; // bug 22624?
+ return false; // T24624?
}
if ( !is_string( $text ) ) {
- # This should not happen, but sometimes does (bug 20757)
+ # This should not happen, but sometimes does (T22757)
$this->output( "Data of revision with {$idCol}={$row->$idCol} unavailable!\n" );
return false;
} catch ( Exception $e ) {
$this->output( "Text of revision with timestamp {$row->ar_timestamp} unavailable!\n" );
- return false; // bug 22624?
+ return false; // T24624?
}
$text = $rev->getSerializedData();
if ( !is_string( $text ) ) {
- # This should not happen, but sometimes does (bug 20757)
+ # This should not happen, but sometimes does (T22757)
$this->output( "Data of revision with timestamp {$row->ar_timestamp} unavailable!\n" );
return false;
MediaWiki\suppressWarnings(); // header notices
// Cache ?action=view
- $wgRequestTime = microtime( true ); # bug 22852
+ $wgRequestTime = microtime( true ); # T24852
ob_start();
$article->view();
$context->getOutput()->output();
$viewHtml = ob_get_clean();
$viewCache->saveToFileCache( $viewHtml );
// Cache ?action=history
- $wgRequestTime = microtime( true ); # bug 22852
+ $wgRequestTime = microtime( true ); # T24852
ob_start();
Action::factory( 'history', $article, $context )->show();
$context->getOutput()->output();
}
if ( $historyFile ) {
# Delimiter is eated by streamStatementEnd, we add it
- # up in the history (bug 37020)
+ # up in the history (T39020)
readline_add_history( $wholeLine . ';' );
readline_write_history( $historyFile );
}
-- Unique indexes need to be handled with INSERT SELECT since just running
-- the CREATE INDEX statement will fail if there are duplicate values.
--
--- Ignore duplicates, several tables will have them (e.g. bug 16966) but in
+-- Ignore duplicates, several tables will have them (e.g. T18966) but in
-- most cases it's harmless to discard them.
--------------------------------------------------------------------------------
+++ /dev/null
-<?php
-/**
- * Script to fix bug 20757.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- * http://www.gnu.org/copyleft/gpl.html
- *
- * @file
- * @ingroup Maintenance ExternalStorage
- */
-
-require_once __DIR__ . '/../Maintenance.php';
-
-/**
- * Maintenance script to fix bug 20757.
- *
- * @ingroup Maintenance ExternalStorage
- */
-class FixBug20757 extends Maintenance {
- public $batchSize = 10000;
- public $mapCache = [];
- public $mapCacheSize = 0;
- public $maxMapCacheSize = 1000000;
-
- function __construct() {
- parent::__construct();
- $this->addDescription( 'Script to fix bug 20757 assuming that blob_tracking is intact' );
- $this->addOption( 'dry-run', 'Report only' );
- $this->addOption( 'start', 'old_id to start at', false, true );
- }
-
- function execute() {
- $dbr = $this->getDB( DB_REPLICA );
- $dbw = $this->getDB( DB_MASTER );
-
- $dryRun = $this->getOption( 'dry-run' );
- if ( $dryRun ) {
- print "Dry run only.\n";
- }
-
- $startId = $this->getOption( 'start', 0 );
- $numGood = 0;
- $numFixed = 0;
- $numBad = 0;
-
- $totalRevs = $dbr->selectField( 'text', 'MAX(old_id)', false, __METHOD__ );
-
- // In MySQL 4.1+, the binary field old_text has a non-working LOWER() function
- $lowerLeft = 'LOWER(CONVERT(LEFT(old_text,22) USING latin1))';
-
- while ( true ) {
- print "ID: $startId / $totalRevs\r";
-
- $res = $dbr->select(
- 'text',
- [ 'old_id', 'old_flags', 'old_text' ],
- [
- 'old_id > ' . intval( $startId ),
- 'old_flags LIKE \'%object%\' AND old_flags NOT LIKE \'%external%\'',
- "$lowerLeft = 'o:15:\"historyblobstub\"'",
- ],
- __METHOD__,
- [
- 'ORDER BY' => 'old_id',
- 'LIMIT' => $this->batchSize,
- ]
- );
-
- if ( !$res->numRows() ) {
- break;
- }
-
- $secondaryIds = [];
- $stubs = [];
-
- foreach ( $res as $row ) {
- $startId = $row->old_id;
-
- // Basic sanity checks
- $obj = unserialize( $row->old_text );
- if ( $obj === false ) {
- print "{$row->old_id}: unrecoverable: cannot unserialize\n";
- ++$numBad;
- continue;
- }
-
- if ( !is_object( $obj ) ) {
- print "{$row->old_id}: unrecoverable: unserialized to type " .
- gettype( $obj ) . ", possible double-serialization\n";
- ++$numBad;
- continue;
- }
-
- if ( strtolower( get_class( $obj ) ) !== 'historyblobstub' ) {
- print "{$row->old_id}: unrecoverable: unexpected object class " .
- get_class( $obj ) . "\n";
- ++$numBad;
- continue;
- }
-
- // Process flags
- $flags = explode( ',', $row->old_flags );
- if ( in_array( 'utf-8', $flags ) || in_array( 'utf8', $flags ) ) {
- $legacyEncoding = false;
- } else {
- $legacyEncoding = true;
- }
-
- // Queue the stub for future batch processing
- $id = intval( $obj->mOldId );
- $secondaryIds[] = $id;
- $stubs[$row->old_id] = [
- 'legacyEncoding' => $legacyEncoding,
- 'secondaryId' => $id,
- 'hash' => $obj->mHash,
- ];
- }
-
- $secondaryIds = array_unique( $secondaryIds );
-
- if ( !count( $secondaryIds ) ) {
- continue;
- }
-
- // Run the batch query on blob_tracking
- $res = $dbr->select(
- 'blob_tracking',
- '*',
- [
- 'bt_text_id' => $secondaryIds,
- ],
- __METHOD__
- );
- $trackedBlobs = [];
- foreach ( $res as $row ) {
- $trackedBlobs[$row->bt_text_id] = $row;
- }
-
- // Process the stubs
- foreach ( $stubs as $primaryId => $stub ) {
- $secondaryId = $stub['secondaryId'];
- if ( !isset( $trackedBlobs[$secondaryId] ) ) {
- // No tracked blob. Work out what went wrong
- $secondaryRow = $dbr->selectRow(
- 'text',
- [ 'old_flags', 'old_text' ],
- [ 'old_id' => $secondaryId ],
- __METHOD__
- );
- if ( !$secondaryRow ) {
- print "$primaryId: unrecoverable: secondary row is missing\n";
- ++$numBad;
- } elseif ( $this->isUnbrokenStub( $stub, $secondaryRow ) ) {
- // Not broken yet, and not in the tracked clusters so it won't get
- // broken by the current RCT run.
- ++$numGood;
- } elseif ( strpos( $secondaryRow->old_flags, 'external' ) !== false ) {
- print "$primaryId: unrecoverable: secondary gone to {$secondaryRow->old_text}\n";
- ++$numBad;
- } else {
- print "$primaryId: unrecoverable: miscellaneous corruption of secondary row\n";
- ++$numBad;
- }
- unset( $stubs[$primaryId] );
- continue;
- }
- $trackRow = $trackedBlobs[$secondaryId];
-
- // Check that the specified text really is available in the tracked source row
- $url = "DB://{$trackRow->bt_cluster}/{$trackRow->bt_blob_id}/{$stub['hash']}";
- $text = ExternalStore::fetchFromURL( $url );
- if ( $text === false ) {
- print "$primaryId: unrecoverable: source text missing\n";
- ++$numBad;
- unset( $stubs[$primaryId] );
- continue;
- }
- if ( md5( $text ) !== $stub['hash'] ) {
- print "$primaryId: unrecoverable: content hashes do not match\n";
- ++$numBad;
- unset( $stubs[$primaryId] );
- continue;
- }
-
- // Find the page_id and rev_id
- // The page is probably the same as the page of the secondary row
- $pageId = intval( $trackRow->bt_page );
- if ( !$pageId ) {
- $revId = $pageId = 0;
- } else {
- $revId = $this->findTextIdInPage( $pageId, $primaryId );
- if ( !$revId ) {
- // Actually an orphan
- $pageId = $revId = 0;
- }
- }
-
- $newFlags = $stub['legacyEncoding'] ? 'external' : 'external,utf-8';
-
- if ( !$dryRun ) {
- // Reset the text row to point to the original copy
- $this->beginTransaction( $dbw, __METHOD__ );
- $dbw->update(
- 'text',
- // SET
- [
- 'old_flags' => $newFlags,
- 'old_text' => $url
- ],
- // WHERE
- [ 'old_id' => $primaryId ],
- __METHOD__
- );
-
- // Add a blob_tracking row so that the new reference can be recompressed
- // without needing to run trackBlobs.php again
- $dbw->insert( 'blob_tracking',
- [
- 'bt_page' => $pageId,
- 'bt_rev_id' => $revId,
- 'bt_text_id' => $primaryId,
- 'bt_cluster' => $trackRow->bt_cluster,
- 'bt_blob_id' => $trackRow->bt_blob_id,
- 'bt_cgz_hash' => $stub['hash'],
- 'bt_new_url' => null,
- 'bt_moved' => 0,
- ],
- __METHOD__
- );
- $this->commitTransaction( $dbw, __METHOD__ );
- $this->waitForSlaves();
- }
-
- print "$primaryId: resolved to $url\n";
- ++$numFixed;
- }
- }
-
- print "\n";
- print "Fixed: $numFixed\n";
- print "Unrecoverable: $numBad\n";
- print "Good stubs: $numGood\n";
- }
-
- function waitForSlaves() {
- static $iteration = 0;
- ++$iteration;
- if ( ++$iteration > 50 == 0 ) {
- wfWaitForSlaves();
- $iteration = 0;
- }
- }
-
- function findTextIdInPage( $pageId, $textId ) {
- $ids = $this->getRevTextMap( $pageId );
- if ( !isset( $ids[$textId] ) ) {
- return null;
- } else {
- return $ids[$textId];
- }
- }
-
- function getRevTextMap( $pageId ) {
- if ( !isset( $this->mapCache[$pageId] ) ) {
- // Limit cache size
- while ( $this->mapCacheSize > $this->maxMapCacheSize ) {
- $key = key( $this->mapCache );
- $this->mapCacheSize -= count( $this->mapCache[$key] );
- unset( $this->mapCache[$key] );
- }
-
- $dbr = $this->getDB( DB_REPLICA );
- $map = [];
- $res = $dbr->select( 'revision',
- [ 'rev_id', 'rev_text_id' ],
- [ 'rev_page' => $pageId ],
- __METHOD__
- );
- foreach ( $res as $row ) {
- $map[$row->rev_text_id] = $row->rev_id;
- }
- $this->mapCache[$pageId] = $map;
- $this->mapCacheSize += count( $map );
- }
-
- return $this->mapCache[$pageId];
- }
-
- /**
- * This is based on part of HistoryBlobStub::getText().
- * Determine if the text can be retrieved from the row in the normal way.
- * @param array $stub
- * @param stdClass $secondaryRow
- * @return bool
- */
- function isUnbrokenStub( $stub, $secondaryRow ) {
- $flags = explode( ',', $secondaryRow->old_flags );
- $text = $secondaryRow->old_text;
- if ( in_array( 'external', $flags ) ) {
- $url = $text;
- MediaWiki\suppressWarnings();
- list( /* $proto */, $path ) = explode( '://', $url, 2 );
- MediaWiki\restoreWarnings();
-
- if ( $path == "" ) {
- return false;
- }
- $text = ExternalStore::fetchFromURL( $url );
- }
- if ( !in_array( 'object', $flags ) ) {
- return false;
- }
-
- if ( in_array( 'gzip', $flags ) ) {
- $obj = unserialize( gzinflate( $text ) );
- } else {
- $obj = unserialize( $text );
- }
-
- if ( !is_object( $obj ) ) {
- // Correct for old double-serialization bug.
- $obj = unserialize( $obj );
- }
-
- if ( !is_object( $obj ) ) {
- return false;
- }
-
- $obj->uncompress();
- $text = $obj->getItem( $stub['hash'] );
-
- return $text !== false;
- }
-}
-
-$maintClass = 'FixBug20757';
-require_once RUN_MAINTENANCE_IF_MAIN;
--- /dev/null
+<?php
+/**
+ * Script to fix T22757.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ * @ingroup Maintenance ExternalStorage
+ */
+
+require_once __DIR__ . '/../Maintenance.php';
+
+/**
+ * Maintenance script to fix T22757.
+ *
+ * @ingroup Maintenance ExternalStorage
+ */
+class FixT22757 extends Maintenance {
+ public $batchSize = 10000;
+ public $mapCache = [];
+ public $mapCacheSize = 0;
+ public $maxMapCacheSize = 1000000;
+
+ function __construct() {
+ parent::__construct();
+ $this->addDescription( 'Script to fix T22757 assuming that blob_tracking is intact' );
+ $this->addOption( 'dry-run', 'Report only' );
+ $this->addOption( 'start', 'old_id to start at', false, true );
+ }
+
+ function execute() {
+ $dbr = $this->getDB( DB_REPLICA );
+ $dbw = $this->getDB( DB_MASTER );
+
+ $dryRun = $this->getOption( 'dry-run' );
+ if ( $dryRun ) {
+ print "Dry run only.\n";
+ }
+
+ $startId = $this->getOption( 'start', 0 );
+ $numGood = 0;
+ $numFixed = 0;
+ $numBad = 0;
+
+ $totalRevs = $dbr->selectField( 'text', 'MAX(old_id)', false, __METHOD__ );
+
+ // In MySQL 4.1+, the binary field old_text has a non-working LOWER() function
+ $lowerLeft = 'LOWER(CONVERT(LEFT(old_text,22) USING latin1))';
+
+ while ( true ) {
+ print "ID: $startId / $totalRevs\r";
+
+ $res = $dbr->select(
+ 'text',
+ [ 'old_id', 'old_flags', 'old_text' ],
+ [
+ 'old_id > ' . intval( $startId ),
+ 'old_flags LIKE \'%object%\' AND old_flags NOT LIKE \'%external%\'',
+ "$lowerLeft = 'o:15:\"historyblobstub\"'",
+ ],
+ __METHOD__,
+ [
+ 'ORDER BY' => 'old_id',
+ 'LIMIT' => $this->batchSize,
+ ]
+ );
+
+ if ( !$res->numRows() ) {
+ break;
+ }
+
+ $secondaryIds = [];
+ $stubs = [];
+
+ foreach ( $res as $row ) {
+ $startId = $row->old_id;
+
+ // Basic sanity checks
+ $obj = unserialize( $row->old_text );
+ if ( $obj === false ) {
+ print "{$row->old_id}: unrecoverable: cannot unserialize\n";
+ ++$numBad;
+ continue;
+ }
+
+ if ( !is_object( $obj ) ) {
+ print "{$row->old_id}: unrecoverable: unserialized to type " .
+ gettype( $obj ) . ", possible double-serialization\n";
+ ++$numBad;
+ continue;
+ }
+
+ if ( strtolower( get_class( $obj ) ) !== 'historyblobstub' ) {
+ print "{$row->old_id}: unrecoverable: unexpected object class " .
+ get_class( $obj ) . "\n";
+ ++$numBad;
+ continue;
+ }
+
+ // Process flags
+ $flags = explode( ',', $row->old_flags );
+ if ( in_array( 'utf-8', $flags ) || in_array( 'utf8', $flags ) ) {
+ $legacyEncoding = false;
+ } else {
+ $legacyEncoding = true;
+ }
+
+ // Queue the stub for future batch processing
+ $id = intval( $obj->mOldId );
+ $secondaryIds[] = $id;
+ $stubs[$row->old_id] = [
+ 'legacyEncoding' => $legacyEncoding,
+ 'secondaryId' => $id,
+ 'hash' => $obj->mHash,
+ ];
+ }
+
+ $secondaryIds = array_unique( $secondaryIds );
+
+ if ( !count( $secondaryIds ) ) {
+ continue;
+ }
+
+ // Run the batch query on blob_tracking
+ $res = $dbr->select(
+ 'blob_tracking',
+ '*',
+ [
+ 'bt_text_id' => $secondaryIds,
+ ],
+ __METHOD__
+ );
+ $trackedBlobs = [];
+ foreach ( $res as $row ) {
+ $trackedBlobs[$row->bt_text_id] = $row;
+ }
+
+ // Process the stubs
+ foreach ( $stubs as $primaryId => $stub ) {
+ $secondaryId = $stub['secondaryId'];
+ if ( !isset( $trackedBlobs[$secondaryId] ) ) {
+ // No tracked blob. Work out what went wrong
+ $secondaryRow = $dbr->selectRow(
+ 'text',
+ [ 'old_flags', 'old_text' ],
+ [ 'old_id' => $secondaryId ],
+ __METHOD__
+ );
+ if ( !$secondaryRow ) {
+ print "$primaryId: unrecoverable: secondary row is missing\n";
+ ++$numBad;
+ } elseif ( $this->isUnbrokenStub( $stub, $secondaryRow ) ) {
+ // Not broken yet, and not in the tracked clusters so it won't get
+ // broken by the current RCT run.
+ ++$numGood;
+ } elseif ( strpos( $secondaryRow->old_flags, 'external' ) !== false ) {
+ print "$primaryId: unrecoverable: secondary gone to {$secondaryRow->old_text}\n";
+ ++$numBad;
+ } else {
+ print "$primaryId: unrecoverable: miscellaneous corruption of secondary row\n";
+ ++$numBad;
+ }
+ unset( $stubs[$primaryId] );
+ continue;
+ }
+ $trackRow = $trackedBlobs[$secondaryId];
+
+ // Check that the specified text really is available in the tracked source row
+ $url = "DB://{$trackRow->bt_cluster}/{$trackRow->bt_blob_id}/{$stub['hash']}";
+ $text = ExternalStore::fetchFromURL( $url );
+ if ( $text === false ) {
+ print "$primaryId: unrecoverable: source text missing\n";
+ ++$numBad;
+ unset( $stubs[$primaryId] );
+ continue;
+ }
+ if ( md5( $text ) !== $stub['hash'] ) {
+ print "$primaryId: unrecoverable: content hashes do not match\n";
+ ++$numBad;
+ unset( $stubs[$primaryId] );
+ continue;
+ }
+
+ // Find the page_id and rev_id
+ // The page is probably the same as the page of the secondary row
+ $pageId = intval( $trackRow->bt_page );
+ if ( !$pageId ) {
+ $revId = $pageId = 0;
+ } else {
+ $revId = $this->findTextIdInPage( $pageId, $primaryId );
+ if ( !$revId ) {
+ // Actually an orphan
+ $pageId = $revId = 0;
+ }
+ }
+
+ $newFlags = $stub['legacyEncoding'] ? 'external' : 'external,utf-8';
+
+ if ( !$dryRun ) {
+ // Reset the text row to point to the original copy
+ $this->beginTransaction( $dbw, __METHOD__ );
+ $dbw->update(
+ 'text',
+ // SET
+ [
+ 'old_flags' => $newFlags,
+ 'old_text' => $url
+ ],
+ // WHERE
+ [ 'old_id' => $primaryId ],
+ __METHOD__
+ );
+
+ // Add a blob_tracking row so that the new reference can be recompressed
+ // without needing to run trackBlobs.php again
+ $dbw->insert( 'blob_tracking',
+ [
+ 'bt_page' => $pageId,
+ 'bt_rev_id' => $revId,
+ 'bt_text_id' => $primaryId,
+ 'bt_cluster' => $trackRow->bt_cluster,
+ 'bt_blob_id' => $trackRow->bt_blob_id,
+ 'bt_cgz_hash' => $stub['hash'],
+ 'bt_new_url' => null,
+ 'bt_moved' => 0,
+ ],
+ __METHOD__
+ );
+ $this->commitTransaction( $dbw, __METHOD__ );
+ $this->waitForSlaves();
+ }
+
+ print "$primaryId: resolved to $url\n";
+ ++$numFixed;
+ }
+ }
+
+ print "\n";
+ print "Fixed: $numFixed\n";
+ print "Unrecoverable: $numBad\n";
+ print "Good stubs: $numGood\n";
+ }
+
+ function waitForSlaves() {
+ static $iteration = 0;
+ ++$iteration;
+ if ( ++$iteration > 50 == 0 ) {
+ wfWaitForSlaves();
+ $iteration = 0;
+ }
+ }
+
+ function findTextIdInPage( $pageId, $textId ) {
+ $ids = $this->getRevTextMap( $pageId );
+ if ( !isset( $ids[$textId] ) ) {
+ return null;
+ } else {
+ return $ids[$textId];
+ }
+ }
+
+ function getRevTextMap( $pageId ) {
+ if ( !isset( $this->mapCache[$pageId] ) ) {
+ // Limit cache size
+ while ( $this->mapCacheSize > $this->maxMapCacheSize ) {
+ $key = key( $this->mapCache );
+ $this->mapCacheSize -= count( $this->mapCache[$key] );
+ unset( $this->mapCache[$key] );
+ }
+
+ $dbr = $this->getDB( DB_REPLICA );
+ $map = [];
+ $res = $dbr->select( 'revision',
+ [ 'rev_id', 'rev_text_id' ],
+ [ 'rev_page' => $pageId ],
+ __METHOD__
+ );
+ foreach ( $res as $row ) {
+ $map[$row->rev_text_id] = $row->rev_id;
+ }
+ $this->mapCache[$pageId] = $map;
+ $this->mapCacheSize += count( $map );
+ }
+
+ return $this->mapCache[$pageId];
+ }
+
+ /**
+ * This is based on part of HistoryBlobStub::getText().
+ * Determine if the text can be retrieved from the row in the normal way.
+ * @param array $stub
+ * @param stdClass $secondaryRow
+ * @return bool
+ */
+ function isUnbrokenStub( $stub, $secondaryRow ) {
+ $flags = explode( ',', $secondaryRow->old_flags );
+ $text = $secondaryRow->old_text;
+ if ( in_array( 'external', $flags ) ) {
+ $url = $text;
+ MediaWiki\suppressWarnings();
+ list( /* $proto */, $path ) = explode( '://', $url, 2 );
+ MediaWiki\restoreWarnings();
+
+ if ( $path == "" ) {
+ return false;
+ }
+ $text = ExternalStore::fetchFromURL( $url );
+ }
+ if ( !in_array( 'object', $flags ) ) {
+ return false;
+ }
+
+ if ( in_array( 'gzip', $flags ) ) {
+ $obj = unserialize( gzinflate( $text ) );
+ } else {
+ $obj = unserialize( $text );
+ }
+
+ if ( !is_object( $obj ) ) {
+ // Correct for old double-serialization bug.
+ $obj = unserialize( $obj );
+ }
+
+ if ( !is_object( $obj ) ) {
+ return false;
+ }
+
+ $obj->uncompress();
+ $text = $obj->getItem( $stub['hash'] );
+
+ return $text !== false;
+ }
+}
+
+$maintClass = 'FixT22757';
+require_once RUN_MAINTENANCE_IF_MAIN;
echo "Doing integrity check...\n";
$dbr = wfGetDB( DB_REPLICA );
- // Scan for HistoryBlobStub objects in the text table (bug 20757)
+ // Scan for HistoryBlobStub objects in the text table (T22757)
$exists = $dbr->selectField( 'text', 1,
'old_flags LIKE \'%object%\' AND old_flags NOT LIKE \'%external%\' ' .
exit( 1 );
}
- // Scan the archive table for HistoryBlobStub objects or external flags (bug 22624)
+ // Scan the archive table for HistoryBlobStub objects or external flags (T24624)
$flags = $dbr->selectField( 'archive', 'ar_flags',
'ar_flags LIKE \'%external%\' OR (' .
'ar_flags LIKE \'%object%\' ' .
-- conversion algorithm is run. We store this so that we can update
-- collations without reparsing all pages.
-- Note: If you change the length of this field, you also need to change
- -- code in LinksUpdate.php. See bug 25254.
+ -- code in LinksUpdate.php. See T27254.
cl_sortkey_prefix varchar(255) binary NOT NULL default '',
-- This isn't really used at present. Provided for an optional
-- Size chosen to allow IPv6
-- FIXME: these fields were originally blank for single-IP blocks,
-- but now they are populated. No migration was ever done. They
- -- should be fixed to be blank again for such blocks (bug 49504).
+ -- should be fixed to be blank again for such blocks (T51504).
ipb_range_start tinyblob NOT NULL,
ipb_range_end tinyblob NOT NULL,
}
$lang = Language::factory( 'en' );
- // Set global language to ensure localised errors are in English (bug 20633)
+ // Set global language to ensure localised errors are in English (T22633)
RequestContext::getMain()->setLanguage( $lang );
$wgLang = $lang; // BackCompat
# Don't try to access the database
# This needs to be disabled early since extensions will try to use the l10n
- # cache from $wgExtensionFunctions (bug 20471)
+ # cache from $wgExtensionFunctions (T22471)
$wgLocalisationCacheConf = [
'class' => 'LocalisationCache',
'storeClass' => 'LCStoreNull',
"SELECT user_name,COUNT(*) AS n
FROM $user
GROUP BY user_name
- HAVING n > 1", __METHOD__ );
+ HAVING n > 1", __METHOD__ );
$list = [];
foreach ( $result as $row ) {
list-style: none none;
display: inline;
/* shared.css has some very weird directionality-specific rules for 'ul' we need to override,
- search for "Correct directionality when page dir is different from site/user dir" */
+ * search for "Correct directionality when page dir is different from site/user dir" */
margin: 0 !important;
padding: 0 !important;
}
/* Methods */
+ /**
+ * Return the representation of the state of this item.
+ *
+ * @return {Object} State of the object
+ */
+ mw.rcfilters.dm.FilterItem.prototype.getState = function () {
+ return {
+ selected: this.isSelected(),
+ included: this.isIncluded(),
+ conflicted: this.isConflicted(),
+ fullyCovered: this.isFullyCovered()
+ };
+ };
+
/**
* Get the name of this filter
*
// For example, see two groups with conflicts:
// userExpLevel: [
// {
- // name: 'experienced',
- // conflicts: [ 'unregistered' ]
+ // name: 'experienced',
+ // conflicts: [ 'unregistered' ]
// }
// ],
// registration: [
// {
- // name: 'registered',
+ // name: 'registered',
// },
// {
- // name: 'unregistered',
+ // name: 'unregistered',
// }
// ]
// If we select 'experienced', then 'unregistered' is in conflict (and vice versa),
}
}
+ &-selected {
+ background-color: #eaf3ff; // Accent90 AAA
+ }
+
&-label {
&-title {
font-weight: bold;
&-none {
.mw-rcfilters-mixin-circle( @highlight-none, 2em, 0.5em, true );
+ // Override border to dashed
+ border: 1px dashed #565656;
&.oo-ui-buttonOptionWidget.oo-ui-buttonElement-active,
&.oo-ui-buttonOptionWidget.oo-ui-optionWidget-pressed,
e.stopPropagation();
};
+ /**
+ * Emit a click event when the capsule is clicked so we can aggregate this
+ * in the parent (the capsule)
+ */
+ mw.rcfilters.ui.CapsuleItemWidget.prototype.onClick = function () {
+ this.emit( 'click' );
+ };
+
/**
* Override the event listening to the item close button click
*/
* @param {OO.ui.InputWidget} filterInput A filter input that focuses the capsule widget
* @param {Object} config Configuration object
* @cfg {jQuery} [$overlay] A jQuery object serving as overlay for popups
- * @cfg {number} [topScrollOffset=10] When scrolling the entire widget to the top, leave this
- * much space (in pixels) above the widget.
*/
mw.rcfilters.ui.FilterCapsuleMultiselectWidget = function MwRcfiltersUiFilterCapsuleMultiselectWidget( controller, model, filterInput, config ) {
var title = new OO.ui.LabelWidget( {
this.controller = controller;
this.model = model;
this.filterInput = filterInput;
-
- this.topScrollOffset = config.topScrollOffset || 10;
+ this.isSelecting = false;
this.resetButton = new OO.ui.ButtonWidget( {
icon: 'trash',
itemUpdate: 'onModelItemUpdate',
highlightChange: 'onModelHighlightChange'
} );
- this.popup.connect( this, { toggle: 'onPopupToggle' } );
+ this.aggregate( { click: 'capsuleItemClick' } );
// Add the filterInput as trigger
this.filterInput.$input
}
};
- /**
- * Respond to popup toggle event
- *
- * @param {boolean} isVisible Popup is visible
- */
- mw.rcfilters.ui.FilterCapsuleMultiselectWidget.prototype.onPopupToggle = function ( isVisible ) {
- if ( isVisible ) {
- this.scrollToTop();
- }
- };
-
- /**
- * Scroll the capsule to the top of the screen
- */
- mw.rcfilters.ui.FilterCapsuleMultiselectWidget.prototype.scrollToTop = function () {
- var container = OO.ui.Element.static.getClosestScrollableContainer( this.$element[ 0 ], 'y' );
-
- $( container ).animate( {
- scrollTop: this.$element.offset().top - this.topScrollOffset
- } );
- };
-
/**
* Reevaluate the restore state for the widget between setting to defaults and clearing all filters
*/
this.controller = controller;
this.model = model;
+ this.filters = {};
// Mixin constructors
OO.ui.mixin.GroupWidget.call( this, config );
this.$element
.addClass( 'mw-rcfilters-ui-filterGroupWidget' )
+ .addClass( 'mw-rcfilters-ui-filterGroupWidget-name-' + this.model.getName() )
.append(
this.$label,
this.$group
);
};
+ /**
+ * Get an item widget from its filter name
+ *
+ * @param {string} filterName Filter name
+ * @return {mw.rcfilters.ui.FilterItemWidget} Item widget
+ */
+ mw.rcfilters.ui.FilterGroupWidget.prototype.getItemWidget = function ( filterName ) {
+ return this.filters[ filterName ];
+ };
+
+ /**
+ * Populate data from the model
+ */
mw.rcfilters.ui.FilterGroupWidget.prototype.populateFromModel = function () {
var widget = this;
+ this.clearItems();
+ this.filters = {};
+
this.addItems(
this.model.getItems().map( function ( filterItem ) {
- return new mw.rcfilters.ui.FilterItemWidget(
+ var groupWidget = new mw.rcfilters.ui.FilterItemWidget(
widget.controller,
filterItem,
{
$overlay: widget.$overlay
}
);
+
+ widget.filters[ filterItem.getName() ] = groupWidget;
+
+ return groupWidget;
} )
);
};
this.controller = controller;
this.model = model;
+ this.selected = false;
this.checkboxWidget = new mw.rcfilters.ui.CheckboxInputWidget( {
value: this.model.getName(),
this.setCurrentMuteState();
};
+ /**
+ * Set selected state on this widget
+ *
+ * @param {boolean} [isSelected] Widget is selected
+ */
+ mw.rcfilters.ui.FilterItemWidget.prototype.toggleSelected = function ( isSelected ) {
+ isSelected = isSelected !== undefined ? isSelected : !this.selected;
+
+ if ( this.selected !== isSelected ) {
+ this.selected = isSelected;
+
+ this.$element.toggleClass( 'mw-rcfilters-ui-filterItemWidget-selected', this.selected );
+ }
+ };
+
/**
* Set the current mute state for this item
*/
// Events
this.model.connect( this, {
- initialize: 'onModelInitialize'
+ initialize: 'onModelInitialize',
+ itemUpdate: 'onModelItemUpdate'
} );
this.textInput.connect( this, {
change: 'onTextInputChange'
} );
+ this.capsule.connect( this, { capsuleItemClick: 'onCapsuleItemClick' } );
+ this.capsule.popup.connect( this, { toggle: 'onCapsulePopupToggle' } );
+
+ // Initialize
this.$element
.addClass( 'mw-rcfilters-ui-filterWrapperWidget' )
.append( this.capsule.$element, this.textInput.$element );
OO.inheritClass( mw.rcfilters.ui.FilterWrapperWidget, OO.ui.Widget );
OO.mixinClass( mw.rcfilters.ui.FilterWrapperWidget, OO.ui.mixin.PendingElement );
+ /**
+ * Respond to capsule item click and make the popup scroll down to the requested item
+ *
+ * @param {mw.rcfilters.ui.CapsuleItemWidget} item Clicked item
+ */
+ mw.rcfilters.ui.FilterWrapperWidget.prototype.onCapsuleItemClick = function ( item ) {
+ var filterName = item.getData(),
+ // Find the item in the popup
+ filterWidget = this.filterPopup.getItemWidget( filterName );
+
+ // Highlight item
+ this.filterPopup.select( filterName );
+
+ this.scrollToTop( filterWidget.$element );
+ };
+
+ /**
+ * Respond to popup toggle event. Reset selection in the list when the popup is closed.
+ *
+ * @param {boolean} isVisible Popup is visible
+ */
+ mw.rcfilters.ui.FilterWrapperWidget.prototype.onCapsulePopupToggle = function ( isVisible ) {
+ if ( !isVisible ) {
+ this.filterPopup.resetSelection();
+ } else {
+ this.scrollToTop( this.capsule.$element, 10 );
+ }
+ };
+
/**
* Respond to text input change
*
* @param {string} newValue Current value
*/
mw.rcfilters.ui.FilterWrapperWidget.prototype.onTextInputChange = function ( newValue ) {
+ this.filterPopup.resetSelection();
+
// Filter the results
this.filterPopup.filter( this.model.findMatches( newValue ) );
this.capsule.popup.clip();
}
} );
};
+
+ /**
+ * Respond to item update and reset the selection. This will make it so that
+ * any actual interaction with the system resets the selection state of any item.
+ */
+ mw.rcfilters.ui.FilterWrapperWidget.prototype.onModelItemUpdate = function () {
+ this.filterPopup.resetSelection();
+ };
+
+ /**
+ * Scroll the element to top within its container
+ *
+ * @private
+ * @param {jQuery} $element Element to position
+ * @param {number} [marginFromTop] When scrolling the entire widget to the top, leave this
+ * much space (in pixels) above the widget.
+ */
+ mw.rcfilters.ui.FilterWrapperWidget.prototype.scrollToTop = function ( $element, marginFromTop ) {
+ var container = OO.ui.Element.static.getClosestScrollableContainer( $element[ 0 ], 'y' ),
+ pos = OO.ui.Element.static.getRelativePosition( $element, $( container ) );
+
+ // Scroll to item
+ $( container ).animate( {
+ scrollTop: $( container ).scrollTop() + pos.top + ( marginFromTop || 0 )
+ } );
+ };
}( mediaWiki ) );
this.controller = controller;
this.model = model;
this.$overlay = config.$overlay || this.$element;
+ this.groups = {};
+ this.selected = null;
this.highlightButton = new OO.ui.ButtonWidget( {
label: mw.message( 'rcfilters-highlightbutton-title' ).text(),
// Reset
this.clearItems();
+ this.groups = {};
this.addItems(
Object.keys( this.model.getFilterGroups() ).map( function ( groupName ) {
- return new mw.rcfilters.ui.FilterGroupWidget(
+ var groupWidget = new mw.rcfilters.ui.FilterGroupWidget(
widget.controller,
widget.model.getGroup( groupName ),
{
$overlay: widget.$overlay
}
);
+
+ widget.groups[ groupName ] = groupWidget;
+ return groupWidget;
} )
);
};
this.controller.toggleHighlight();
};
+ /**
+ * Find the filter item widget that corresponds to the item name
+ *
+ * @param {string} itemName Filter name
+ * @return {mw.rcfilters.ui.FilterItemWidget} Filter widget
+ */
+ mw.rcfilters.ui.FiltersListWidget.prototype.getItemWidget = function ( itemName ) {
+ var filterItem = this.model.getItemByName( itemName ),
+ // Find the group
+ groupWidget = this.groups[ filterItem.getGroupName() ];
+
+ // Find the item inside the group
+ return groupWidget.getItemWidget( itemName );
+ };
+
+ /**
+ * Mark an item widget as selected
+ *
+ * @param {string} itemName Filter name
+ */
+ mw.rcfilters.ui.FiltersListWidget.prototype.select = function ( itemName ) {
+ var filterWidget;
+
+ if ( this.selected !== itemName ) {
+ // Unselect previous
+ if ( this.selected ) {
+ filterWidget = this.getItemWidget( this.selected );
+ filterWidget.toggleSelected( false );
+ }
+
+ // Select new one
+ this.selected = itemName;
+ if ( this.selected ) {
+ filterWidget = this.getItemWidget( this.selected );
+ filterWidget.toggleSelected( true );
+ }
+ }
+ };
+
+ /**
+ * Reset selection and remove selected states from all items
+ */
+ mw.rcfilters.ui.FiltersListWidget.prototype.resetSelection = function () {
+ if ( this.selected !== null ) {
+ this.selected = null;
+ this.getItems().forEach( function ( groupWidget ) {
+ groupWidget.getItems().forEach( function ( filterItemWidget ) {
+ filterItemWidget.toggleSelected( false );
+ } );
+ } );
+ }
+ };
+
/**
* Switch between showing the 'no results' message for filtering results or the result list.
*
display: table-caption;
caption-side: bottom;
/* In mw-core the font-size is duplicated, 94% in thumbiner
- and again 94% in thumbcaption. 88% for font size of the
- caption results in the same behavior. */
+ * and again 94% in thumbcaption. 88% for font size of the
+ * caption results in the same behavior. */
font-size: 88%;
line-height: 1.4em;
text-align: left;
Util.fetchModuleInfo( this.apiModule )
.done( function ( pi ) {
- var prefix, i, j, dl, widget, $widgetLabel, widgetField, helpField, tmp, flag, count,
+ var prefix, i, j, descriptionContainer, widget, $widgetLabel, widgetField, helpField, tmp, flag, count,
items = [],
deprecatedItems = [],
buttons = [],
that.tokenWidget = widget;
}
- dl = $( '<dl>' );
- dl.append( $( '<dd>', {
+ descriptionContainer = $( '<div>' );
+ descriptionContainer.append( $( '<div>', {
addClass: 'description',
append: Util.parseHTML( pi.parameters[ i ].description )
} ) );
if ( pi.parameters[ i ].info && pi.parameters[ i ].info.length ) {
for ( j = 0; j < pi.parameters[ i ].info.length; j++ ) {
- dl.append( $( '<dd>', {
+ descriptionContainer.append( $( '<div>', {
addClass: 'info',
append: Util.parseHTML( pi.parameters[ i ].info[ j ] )
} ) );
case 'limit':
if ( pi.parameters[ i ].highmax !== undefined ) {
- dl.append( $( '<dd>', {
+ descriptionContainer.append( $( '<div>', {
addClass: 'info',
append: [
Util.parseMsg(
]
} ) );
} else {
- dl.append( $( '<dd>', {
+ descriptionContainer.append( $( '<div>', {
addClass: 'info',
append: [
Util.parseMsg( 'api-help-param-limit', pi.parameters[ i ].max ),
tmp += 'max';
}
if ( tmp !== '' ) {
- dl.append( $( '<dd>', {
+ descriptionContainer.append( $( '<div>', {
addClass: 'info',
append: Util.parseMsg(
'api-help-param-integer-' + tmp,
);
}
if ( tmp.length ) {
- dl.append( $( '<dd>', {
+ descriptionContainer.append( $( '<div>', {
addClass: 'info',
append: Util.parseHTML( tmp.join( ' ' ) )
} ) );
} ), {
align: 'inline',
classes: [ 'mw-apisandbox-help-field' ],
- label: dl
+ label: descriptionContainer
}
);
*/
( function ( mw, $ ) {
$( function () {
- var $preftoc, $preferences, $fieldsets, labelFunc,
+ var $preftoc, $preferences, $fieldsets, labelFunc, previousTab,
$tzSelect, $tzTextbox, $localtimeHolder, servertime, allowCloseWindow,
convertmessagebox = require( 'mediawiki.notification.convertmessagebox' );
updateTimezoneSelection();
}
- // Preserve the tab after saving the preferences
- // Not using cookies, because their deletion results are inconsistent.
- // Not using jStorage due to its enormous size (for this feature)
- if ( window.sessionStorage ) {
- if ( sessionStorage.getItem( 'mediawikiPreferencesTab' ) !== null ) {
- switchPrefTab( sessionStorage.getItem( 'mediawikiPreferencesTab' ), 'noHash' );
- }
+ // Restore the active tab after saving the preferences
+ previousTab = mw.storage.session.get( 'mwpreferences-prevTab' );
+ if ( previousTab ) {
+ switchPrefTab( previousTab, 'noHash' );
// Deleting the key, the tab states should be reset until we press Save
- sessionStorage.removeItem( 'mediawikiPreferencesTab' );
-
- $( '#mw-prefs-form' ).submit( function () {
- var storageData = $( $preftoc ).find( 'li.selected a' ).attr( 'id' ).replace( 'preftab-', '' );
- sessionStorage.setItem( 'mediawikiPreferencesTab', storageData );
- } );
+ mw.storage.session.remove( previousTab );
}
+ $( '#mw-prefs-form' ).on( 'submit', function () {
+ var value = $( $preftoc ).find( 'li.selected a' ).attr( 'id' ).replace( 'preftab-', '' );
+ mw.storage.session.set( 'mwpreferences-prevTab', value );
+ } );
+
// Check if all of the form values are unchanged
function isPrefsChanged() {
var inputs = $( '#mw-prefs-form :input[name]' ),
* immediate execution after this amount of time (in milliseconds) if it didn't run
* by that time.
*/
- mw.requestIdleCallback = mw.requestIdleCallbackInternal;
- /*
- // XXX: Polyfill disabled due to https://bugs.chromium.org/p/chromium/issues/detail?id=647870
- mw.requestIdleCallback = window.requestIdleCallback
+ mw.requestIdleCallback = window.requestIdleCallback ?
// Bind because it throws TypeError if context is not window
- ? window.requestIdleCallback.bind( window )
- : mw.requestIdleCallbackInternal;
- */
+ window.requestIdleCallback.bind( window ) :
+ mw.requestIdleCallbackInternal;
+ // Note: Polyfill was previously disabled due to
+ // https://bugs.chromium.org/p/chromium/issues/detail?id=647870
+ // See also <http://codepen.io/Krinkle/full/XNGEvv>
}( mediaWiki ) );
};
/**
- * Set a value in device storage.
- *
- * @param {string} key Key name to store under
- * @param {string} value Value to be stored
- * @return {boolean} Whether the save succeeded or not
- */
+ * Set a value in device storage.
+ *
+ * @param {string} key Key name to store under
+ * @param {string} value Value to be stored
+ * @return {boolean} Whether the save succeeded or not
+ */
SafeStorage.prototype.set = function ( key, value ) {
try {
this.store.setItem( key, value );
};
/**
- * Remove a value from device storage.
- *
- * @param {string} key Key of item to remove
- * @return {boolean} Whether the save succeeded or not
- */
+ * Remove a value from device storage.
+ *
+ * @param {string} key Key of item to remove
+ * @return {boolean} Whether the save succeeded or not
+ */
SafeStorage.prototype.remove = function ( key ) {
try {
this.store.removeItem( key );
/**
* @property {jQuery} $container If the gallery contained in an element that is
- * not the main content element, then it stores that element.
+ * not the main content element, then it stores that element.
*/
/**
/**
* @property {number} imageHeight Height of the image based on viewport size
- * the URLs in the required size.
+ * the URLs in the required size.
*/
/* Setup */
Then(/^feedback should be (.+)$/) do |feedback|
on(LoginPage) do |page|
- page.feedback_element.when_present.click
+ page.feedback_element.click
expect(page.feedback).to match Regexp.escape(feedback)
end
end
end
Then(/^there should be a link to (.+)$/) do |text|
- expect(on(LoginPage).username_displayed_element.when_present.text).to eq text
+ expect(on(LoginPage).username_displayed_element.text).to eq text
end
Then(/^Username element should be there$/) do
When(/^I click Appearance$/) do
- visit(PreferencesPage).appearance_link_element.when_present.click
+ visit(PreferencesPage).appearance_link_element.click
end
When(/^I navigate to Preferences$/) do
When(/^I click Editing$/) do
- visit(PreferencesPage).editing_link_element.when_present.click
+ visit(PreferencesPage).editing_link_element.click
end
Then(/^I can select edit area font style$/) do
- expect(on(PreferencesEditingPage).edit_area_font_style_select_element.when_present).to exist
+ expect(on(PreferencesEditingPage).edit_area_font_style_select_element).to exist
end
Then(/^I can select live preview$/) do
- expect(on(PreferencesEditingPage).live_preview_check_element.when_present).to exist
+ expect(on(PreferencesEditingPage).live_preview_check_element).to exist
end
Then(/^I can select section editing by double clicking$/) do
- expect(on(PreferencesEditingPage).edit_section_double_click_check_element.when_present).to exist
+ expect(on(PreferencesEditingPage).edit_section_double_click_check_element).to exist
end
Then(/^I can select section editing by right clicking$/) do
- expect(on(PreferencesEditingPage).edit_section_right_click_check_element.when_present).to exist
+ expect(on(PreferencesEditingPage).edit_section_right_click_check_element).to exist
end
Then(/^I can select section editing via edit links$/) do
- expect(on(PreferencesEditingPage).edit_section_edit_link_element.when_present).to exist
+ expect(on(PreferencesEditingPage).edit_section_edit_link_element).to exist
end
Then(/^I can select show edit toolbar$/) do
- expect(on(PreferencesEditingPage).show_edit_toolbar_check_element.when_present).to exist
+ expect(on(PreferencesEditingPage).show_edit_toolbar_check_element).to exist
end
Then(/^I can select show preview before edit box$/) do
- expect(on(PreferencesEditingPage).preview_on_top_check_element.when_present).to exist
+ expect(on(PreferencesEditingPage).preview_on_top_check_element).to exist
end
Then(/^I can select show preview on first edit$/) do
- expect(on(PreferencesEditingPage).preview_on_first_check_element.when_present).to exist
+ expect(on(PreferencesEditingPage).preview_on_first_check_element).to exist
end
Then(/^I can select to prompt me when entering a blank edit summary$/) do
- expect(on(PreferencesEditingPage).forced_edit_summary_check_element.when_present).to exist
+ expect(on(PreferencesEditingPage).forced_edit_summary_check_element).to exist
end
Then(/^I can select to warn me when I leave an edit page with unsaved changes$/) do
- expect(on(PreferencesEditingPage).unsaved_changes_check_element.when_present).to exist
+ expect(on(PreferencesEditingPage).unsaved_changes_check_element).to exist
end
When(/^I click User profile$/) do
- visit(PreferencesPage).user_profile_link_element.when_present.click
+ visit(PreferencesPage).user_profile_link_element.click
end
Then(/^I can change my gender$/) do
class LoginPage
include PageObject
- page_url 'Special:UserLogin'
-
element(:error_message, css: 'div#userloginForm div.error')
- div(:feedback, class: 'errorbox')
- button(:login, id: 'wpLoginAttempt')
- li(:logout, id: 'pt-logout')
- text_field(:password, id: 'wpPassword1')
element(:password_error, css: 'input#wpPassword1:required:invalid')
- a(:password_strength, text: 'password strength')
- a(:phishing, text: 'phishing')
- text_field(:username, id: 'wpName1')
- a(:username_displayed, title: /Your user page/)
element(:username_error, css: 'input#wpName1:required:invalid')
-
- def logged_in_as_element
- @browser.div(id: 'mw-content-text').p.b
- end
-
- def login_with(username, password, wait_for_logout_element = true)
- username_element.when_present.send_keys(username)
- password_element.when_present.send_keys(password)
- login_element.when_present.click
- logout_element.when_present(10) if wait_for_logout_element
- end
end
}
if ( $maintenance->getDbType() === Maintenance::DB_NONE ) {
- if ( $wgLocalisationCacheConf['storeClass'] === false
- && ( $wgLocalisationCacheConf['store'] == 'db'
- || ( $wgLocalisationCacheConf['store'] == 'detect' && !$wgCacheDirectory ) )
+ if (
+ $wgLocalisationCacheConf['storeClass'] === false
+ && (
+ $wgLocalisationCacheConf['store'] == 'db'
+ || ( $wgLocalisationCacheConf['store'] == 'detect' && !$wgCacheDirectory )
+ )
) {
$wgLocalisationCacheConf['storeClass'] = 'LCStoreNull';
}
public function testExists() {
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
- 'This test has not been implemented yet. Rely on $wgCanonicalNamespaces.'
+ 'This test has not been implemented yet. Rely on $wgCanonicalNamespaces.'
);
}
*/
public function testGetCanonicalNamespaces() {
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
- 'This test has not been implemented yet. Rely on $wgCanonicalNamespaces.'
+ 'This test has not been implemented yet. Rely on $wgCanonicalNamespaces.'
);
}
*/
public function testGetCanonicalName() {
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
- 'This test has not been implemented yet. Rely on $wgCanonicalNamespaces.'
+ 'This test has not been implemented yet. Rely on $wgCanonicalNamespaces.'
);
}
*/
public function testGetCanonicalIndex() {
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
- 'This test has not been implemented yet. Rely on $wgCanonicalNamespaces.'
+ 'This test has not been implemented yet. Rely on $wgCanonicalNamespaces.'
);
}
*/
public function testGetValidNamespaces() {
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
- 'This test has not been implemented yet. Rely on $wgCanonicalNamespaces.'
+ 'This test has not been implemented yet. Rely on $wgCanonicalNamespaces.'
);
}
*/
return [
[ '<span>foo</span>', 'parse', '<span>foo</span>', '<span>foo</span>' ],
[ '<span>foo</span>', 'escaped', '<span>foo</span>',
- '<span>foo</span>' ],
+ '<span>foo</span>' ],
[ '<span>foo</span>', 'plain', '<span>foo</span>', '<span>foo</span>' ],
[ '<script>alert(1)</script>', 'parse', '<script>alert(1)</script>',
'<script>alert(1)</script>' ],
[ '<script>alert(1)</script>', 'escaped', '<script>alert(1)</script>',
'<script>alert(1)</script>' ],
[ '<script>alert(1)</script>', 'plain', '<script>alert(1)</script>',
- '<script>alert(1)</script>' ],
+ '<script>alert(1)</script>' ],
];
}
$page = new WikiPage( $title );
$this->setTemporaryHook( 'SearchDataForIndex',
- function ( &$fields, ContentHandler $handler, WikiPage $page, ParserOutput $output,
- SearchEngine $engine ) {
+ function (
+ &$fields,
+ ContentHandler $handler,
+ WikiPage $page,
+ ParserOutput $output,
+ SearchEngine $engine
+ ) {
$fields['testDataField'] = 'test content';
} );
],
],
'serverTemplate' => [
- 'dbname' => $wgDBname,
- 'user' => $wgDBuser,
- 'password' => $wgDBpassword,
- 'type' => $wgDBtype,
+ 'dbname' => $wgDBname,
+ 'user' => $wgDBuser,
+ 'password' => $wgDBpassword,
+ 'type' => $wgDBtype,
'dbDirectory' => $wgSQLiteDataDir,
- 'flags' => DBO_DEFAULT
+ 'flags' => DBO_DEFAULT
],
'hostsByName' => [
'test-db1' => $wgDBserver,
* Added this test based on an issue experienced with HHVM 3.3.0-dev
* where it did not define a cURL constant.
*
- * @T72570
+ * T72570
* @dataProvider provideCurlConstants
*/
public function testCurlConstants( $value ) {
$this->client->expects( $this->once() )->method( 'run' )->with( [
'method' => 'GET',
'url' => 'http://test/rest/42xyz42'
- // list( $rcode, $rdesc, $rhdrs, $rbody, $rerr )
+ // list( $rcode, $rdesc, $rhdrs, $rbody, $rerr )
] )->willReturn( [ 200, 'OK', [], 's:8:"somedata";', 0 ] );
$result = $this->bag->get( '42xyz42' );
$this->assertEquals( 'somedata', $result );
$this->client->expects( $this->once() )->method( 'run' )->with( [
'method' => 'PUT',
'url' => 'http://test/rest/42xyz42',
- 'body' => 's:8:"postdata";'
+ 'body' => 's:8:"postdata";'
// list( $rcode, $rdesc, $rhdrs, $rbody, $rerr )
] )->willReturn( [ 200, 'OK', [], 'Done', 0 ] );
$result = $this->bag->set( '42xyz42', 'postdata' );
/**
* @group Database
+ * @covers Parser
*/
-
class ParserMethodsTest extends MediaWikiLangTestCase {
public static function providePreSaveTransform() {
/**
* @dataProvider providePreSaveTransform
- * @covers Parser::preSaveTransform
*/
public function testPreSaveTransform( $text, $expected ) {
global $wgParser;
/**
* @dataProvider provideStripOuterParagraph
- * @covers Parser::stripOuterParagraph
*/
public function testStripOuterParagraph( $text, $expected ) {
$this->assertEquals( $expected, Parser::stripOuterParagraph( $text ) );
* @expectedException MWException
* @expectedExceptionMessage Parser state cleared while parsing.
* Did you call Parser::parse recursively?
- * @covers Parser::lock
*/
public function testRecursiveParse() {
global $wgParser;
return 'bar';
}
- /**
- * @covers Parser::callParserFunction
- */
public function testCallParserFunction() {
global $wgParser;
}
/**
- * @covers Parser::parse
+ * @covers Parser
* @covers ParserOutput::getSections
*/
public function testGetSections() {
/**
* @dataProvider provideNormalizeLinkUrl
- * @covers Parser::normalizeLinkUrl
- * @covers Parser::normalizeUrlComponent
*/
public function testNormalizeLinkUrl( $explanation, $url, $expected ) {
$this->assertEquals( $expected, Parser::normalizeLinkUrl( $url ), $explanation );
/**
* Basic tests for Parser::getPreloadText
* @author Antoine Musso
+ *
+ * @covers Parser
+ * @covers StripState
+ *
+ * @covers Preprocessor_DOM
+ * @covers PPDStack
+ * @covers PPDStackElement
+ * @covers PPDPart
+ * @covers PPFrame_DOM
+ * @covers PPTemplateFrame_DOM
+ * @covers PPCustomFrame_DOM
+ * @covers PPNode_DOM
+ *
+ * @covers Preprocessor_Hash
+ * @covers PPDStack_Hash
+ * @covers PPDStackElement_Hash
+ * @covers PPDPart_Hash
+ * @covers PPFrame_Hash
+ * @covers PPTemplateFrame_Hash
+ * @covers PPCustomFrame_Hash
+ * @covers PPNode_Hash_Tree
+ * @covers PPNode_Hash_Text
+ * @covers PPNode_Hash_Array
+ * @covers PPNode_Hash_Attr
*/
class ParserPreloadTest extends MediaWikiTestCase {
/**
unset( $this->title );
}
- /**
- * @covers Parser::getPreloadText
- */
public function testPreloadSimpleText() {
$this->assertPreloaded( 'simple', 'simple' );
}
- /**
- * @covers Parser::getPreloadText
- */
public function testPreloadedPreIsUnstripped() {
$this->assertPreloaded(
'<pre>monospaced</pre>',
);
}
- /**
- * @covers Parser::getPreloadText
- */
public function testPreloadedNowikiIsUnstripped() {
$this->assertPreloaded(
'<nowiki>[[Dummy title]]</nowiki>',
/**
* @group Database
* @group Parser
+ *
+ * @covers Parser
+ * @covers StripState
+ *
+ * @covers Preprocessor_DOM
+ * @covers PPDStack
+ * @covers PPDStackElement
+ * @covers PPDPart
+ * @covers PPFrame_DOM
+ * @covers PPTemplateFrame_DOM
+ * @covers PPCustomFrame_DOM
+ * @covers PPNode_DOM
+ *
+ * @covers Preprocessor_Hash
+ * @covers PPDStack_Hash
+ * @covers PPDStackElement_Hash
+ * @covers PPDPart_Hash
+ * @covers PPFrame_Hash
+ * @covers PPTemplateFrame_Hash
+ * @covers PPCustomFrame_Hash
+ * @covers PPNode_Hash_Tree
+ * @covers PPNode_Hash_Text
+ * @covers PPNode_Hash_Array
+ * @covers PPNode_Hash_Attr
*/
class TagHookTest extends MediaWikiTestCase {
public static function provideValidNames() {
/**
* @dataProvider provideValidNames
- * @covers Parser::setHook
*/
public function testTagHooks( $tag ) {
global $wgParserConf, $wgContLang;
/**
* @dataProvider provideBadNames
* @expectedException MWException
- * @covers Parser::setHook
*/
public function testBadTagHooks( $tag ) {
global $wgParserConf, $wgContLang;
/**
* @dataProvider provideValidNames
- * @covers Parser::setFunctionTagHook
*/
public function testFunctionTagHooks( $tag ) {
global $wgParserConf, $wgContLang;
/**
* @dataProvider provideBadNames
* @expectedException MWException
- * @covers Parser::setFunctionTagHook
*/
public function testBadFunctionTagHooks( $tag ) {
global $wgParserConf, $wgContLang;
return [
[ 0, 'test', 0, 'test', true ],
[ SearchIndexField::INDEX_TYPE_NESTED, 'test',
- SearchIndexField::INDEX_TYPE_NESTED, 'test', false ],
+ SearchIndexField::INDEX_TYPE_NESTED, 'test', false ],
[ 0, 'test', 0, 'test2', true ],
[ 0, 'test', 1, 'test', false ],
];
}
/**
- * @covers MediaWiki\Tidy\Balancer::balance
+ * @covers MediaWiki\Tidy\Balancer
+ * @covers MediaWiki\Tidy\BalanceSets
+ * @covers MediaWiki\Tidy\BalanceElement
+ * @covers MediaWiki\Tidy\BalanceStack
+ * @covers MediaWiki\Tidy\BalanceMarker
+ * @covers MediaWiki\Tidy\BalanceActiveFormattingElements
* @dataProvider provideBalancerTests
*/
public function testBalancer( $description, $input, $expected, $useTidy ) {
$last_timestamp_bin,
$timestamp_bin,
"timestamp ($timestamp_bin) of current ID ($id_bin) >= timestamp ($last_timestamp_bin) " .
- "of prior one ($lastId_bin)" );
+ "of prior one ($lastId_bin)" );
$hostbits_bin = substr( $id_bin, -$hostbits );
$last_hostbits_bin = substr( $lastId_bin, -$hostbits );
$hostbits_bin,
$last_hostbits_bin,
"Host ID ($hostbits_bin) of current ID ($id_bin) is same as host ID ($last_hostbits_bin) " .
- "of prior one ($lastId_bin)." );
+ "of prior one ($lastId_bin)." );
}
$lastId = $id;
<directory>structure</directory>
<file>suites/LessTestSuite.php</file>
</testsuite>
- <!-- As there is a class Maintenance, we cannot use the
- name "maintenance" directly -->
+ <!-- As there is a class Maintenance, we cannot use the name "maintenance" directly -->
<testsuite name="maintenance_suite">
<directory>maintenance</directory>
</testsuite>
'tests/qunit/suites/resources/mediawiki.api/mediawiki.ForeignApi.test.js',
'tests/qunit/suites/resources/mediawiki.special/mediawiki.special.recentchanges.test.js',
'tests/qunit/suites/resources/mediawiki.rcfilters/dm.FiltersViewModel.test.js',
+ 'tests/qunit/suites/resources/mediawiki.rcfilters/dm.FilterItem.test.js',
'tests/qunit/suites/resources/mediawiki/mediawiki.language.test.js',
'tests/qunit/suites/resources/mediawiki/mediawiki.cldr.test.js',
'tests/qunit/suites/resources/mediawiki/mediawiki.cookie.test.js',
--- /dev/null
+( function ( mw ) {
+ QUnit.module( 'mediawiki.rcfilters - FilterItem' );
+
+ QUnit.test( 'Initializing filter item', function ( assert ) {
+ var item,
+ group1 = new mw.rcfilters.dm.FilterGroup( 'group1' );
+
+ item = new mw.rcfilters.dm.FilterItem( 'filter1', group1 );
+ assert.equal(
+ item.getName(),
+ 'filter1',
+ 'Filter name is retained.'
+ );
+ assert.equal(
+ item.getGroupName(),
+ 'group1',
+ 'Group name is retained.'
+ );
+
+ item = new mw.rcfilters.dm.FilterItem(
+ 'filter1',
+ group1,
+ {
+ label: 'test label',
+ description: 'test description'
+ }
+ );
+ assert.equal(
+ item.getLabel(),
+ 'test label',
+ 'Label information is retained.'
+ );
+ assert.equal(
+ item.getLabel(),
+ 'test label',
+ 'Description information is retained.'
+ );
+
+ item = new mw.rcfilters.dm.FilterItem(
+ 'filter1',
+ group1,
+ {
+ selected: true
+ }
+ );
+ assert.equal(
+ item.isSelected(),
+ true,
+ 'Item can be selected in the config.'
+ );
+ item.toggleSelected( true );
+ assert.equal(
+ item.isSelected(),
+ true,
+ 'Item can toggle its selected state.'
+ );
+
+ // Subsets
+ item = new mw.rcfilters.dm.FilterItem(
+ 'filter1',
+ group1,
+ {
+ subset: [ 'sub1', 'sub2', 'sub3' ]
+ }
+ );
+ assert.deepEqual(
+ item.getSubset(),
+ [ 'sub1', 'sub2', 'sub3' ],
+ 'Subset information is retained.'
+ );
+ assert.equal(
+ item.existsInSubset( 'sub1' ),
+ true,
+ 'Specific item exists in subset.'
+ );
+ assert.equal(
+ item.existsInSubset( 'sub10' ),
+ false,
+ 'Specific item does not exists in subset.'
+ );
+ assert.equal(
+ item.isIncluded(),
+ false,
+ 'Initial state of "included" is false.'
+ );
+
+ item.toggleIncluded( true );
+ assert.equal(
+ item.isIncluded(),
+ true,
+ 'Item toggles its included state.'
+ );
+
+ // Conflicts
+ item = new mw.rcfilters.dm.FilterItem(
+ 'filter1',
+ group1,
+ {
+ conflicts: [ 'conflict1', 'conflict2', 'conflict3' ]
+ }
+ );
+ assert.deepEqual(
+ item.getConflicts(),
+ [ 'conflict1', 'conflict2', 'conflict3' ],
+ 'Conflict information is retained.'
+ );
+ assert.equal(
+ // TODO: Consider allowing for either a FilterItem or a filter name
+ // in this method, so it is consistent with the subset one
+ item.existsInConflicts( new mw.rcfilters.dm.FilterItem( 'conflict1', group1 ) ),
+ true,
+ 'Specific item exists in conflicts.'
+ );
+ assert.equal(
+ item.existsInConflicts( new mw.rcfilters.dm.FilterItem( 'conflict10', group1 ) ),
+ false,
+ 'Specific item does not exists in conflicts.'
+ );
+ assert.equal(
+ item.isConflicted(),
+ false,
+ 'Initial state of "conflicted" is false.'
+ );
+
+ item.toggleConflicted( true );
+ assert.equal(
+ item.isConflicted(),
+ true,
+ 'Item toggles its conflicted state.'
+ );
+
+ // Fully covered
+ item = new mw.rcfilters.dm.FilterItem( 'filter1', group1 );
+ assert.equal(
+ item.isFullyCovered(),
+ false,
+ 'Initial state of "full coverage" is false.'
+ );
+ item.toggleFullyCovered( true );
+ assert.equal(
+ item.isFullyCovered(),
+ true,
+ 'Item toggles its fully coverage state.'
+ );
+
+ } );
+
+ QUnit.test( 'Emitting events', function ( assert ) {
+ var group1 = new mw.rcfilters.dm.FilterGroup( 'group1' ),
+ item = new mw.rcfilters.dm.FilterItem( 'filter1', group1 ),
+ events = [];
+
+ // Listen to update events
+ item.on( 'update', function () {
+ events.push( item.getState() );
+ } );
+
+ // Do stuff
+ item.toggleSelected( true ); // { selected: true, included: false, conflicted: false, fullyCovered: false }
+ item.toggleSelected( true ); // No event (duplicate state)
+ item.toggleIncluded( true ); // { selected: true, included: true, conflicted: false, fullyCovered: false }
+ item.toggleConflicted( true ); // { selected: true, included: true, conflicted: true, fullyCovered: false }
+ item.toggleFullyCovered( true ); // { selected: true, included: true, conflicted: true, fullyCovered: true }
+ item.toggleSelected(); // { selected: false, included: true, conflicted: true, fullyCovered: true }
+
+ // Check emitted events
+ assert.deepEqual(
+ events,
+ [
+ { selected: true, included: false, conflicted: false, fullyCovered: false },
+ { selected: true, included: true, conflicted: false, fullyCovered: false },
+ { selected: true, included: true, conflicted: true, fullyCovered: false },
+ { selected: true, included: true, conflicted: true, fullyCovered: true },
+ { selected: false, included: true, conflicted: true, fullyCovered: true }
+ ],
+ 'Events emitted successfully.'
+ );
+ } );
+}( mediaWiki ) );
// For 404 handled thumbnails, we only use the base name of the URI
// for the thumb params and the parent directory for the source file name.
// Check that the zone relative path matches up so squid caches won't pick
- // up thumbs that would not be purged on source file deletion (bug 34231).
+ // up thumbs that would not be purged on source file deletion (T36231).
if ( $rel404 !== null ) { // thumbnail was handled via 404
if ( rawurldecode( $rel404 ) === $img->getThumbRel( $thumbName ) ) {
// Request for the canonical thumbnail name