Make each run of the FileBackendTest be for a different "wiki"
so you could have multiple runs at the same time without them
interfering with each other.
There's been intermittent failures on jenkins for this test. I'm
not sure if its some race condition (which wouldn't really make
sense given each run should be independent I thought), but this
can't hurt.
Change-Id: I3b639f1c783efc140028c3acdce35ef3f58bf66f
Move the block insertion to addDBData(), and use a provider to
itterate through the test strings.
This seems like the more correct way to run these tests, although it
still seems hacky, since the db isn't cleaned up after each test.
Change-Id: Ib22ce69797ec03a61b0cc330e8572865290ebd31
And added/removed spaces around some other tokens,
like +, -, *, /, <, >, =, !
Fixed windows newline style
Change-Id: I0b9c8c408f3f6bfc0d685a074d7ec468fb848fc8
First letters are supposed to be primary collation elements.
However, we do not want expansions to be considered
as firstletters (aka thorn "þ" -> "th" which isn't
the same as any other first letter (since "t" !== "th" )
however if þ was a first letter, the word "the" and
even worse the word "too" would be sorted under it, which
is wrong.
Looking for feedback if this all sounds sane. I have tested
it, it got rid of the contractions while at the same time
not removing any letter it wasn't supposed to.
Once this is merged, we could get rid of all the
-<langcode> entries. The other firstLetter array
entries for tailorings could be merged into
generateCollationData.php too, since incorrect
things would get pruned automatically, which
would probably make the logic in Collation.php
simpler.
Bug: 43740
Change-Id: I4bd3d39ec2938a53e2c6728adc48ee6cf9778d74
If a string encoded as part of the output ends in a backslash
(e.g. an edit token), FormatJson::prettyPrint() may incorrectly
treat the unescaped double quote marking the end of the string as
a character that is part of the string.
This is a serious problem in that the "pretty" output may not
necessarily be valid JSON; a later string literal might contain
one or more of these tokens: :[{,]}
To fix the bug, I exploit strtr's behavior when it is given an
associative array having keys of the same length to skip over
escaped backslashes while replacing escaped double quotes with "\x01".
I also updated the corresponding unit test.
Change-Id: I159105b6493c14b82cd0a41a95e04bfed744931e
Adds a new configuration variable ($wgApplyIpBlocksToXff), which when
enabled will scan the XFF header for IP addresses and check if any of
them have been blocked. $wgApplyIpBlocksToXff is disabled by default.
Bug: 23343
Change-Id: I3faa9c3e8107c6e46cdf21f8c18adda1f42890d7
Adds a new configuration variable ($wgApplyIpBlocksToXff), which when
enabled will scan the XFF header for IP addresses and check if any of
them have been blocked. $wgApplyIpBlocksToXff is disabled by default.
Bug: 23343
Change-Id: I3e38b94d10600a60d2d4857de54307f34c4662c4
The output for [[Image:Bad.jpg|thumb=Foobar.jpg|Title]] used to be:
<div class="thumb tright"><div class="thumbinner" style="width:1943px;"><a
href="/wiki/File:Foobar.jpg" class="image"><img alt=""
src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220"
class="thumbimage" srcset="http://example.com/images/0/09/Bad.jpg 1.5x,
http://example.com/images/0/09/Bad.jpg 2x" /></a> <div
class="thumbcaption"><div class="magnify"><a href="/wiki/File:Bad.jpg"
class="internal" title="Enlarge"><img
src="/skins/common/images/magnify-clip.png" width="15" height="11" alt=""
/></a></div>Title</div></div></div>
Note that the target of the <a> is the thumb, not the original image,
and that the srcset is loading the full resolution version of Bad.jpg.
The attached patches fix the link target and srcset issues
(suppressing the srcset when a manual thumb is used). It also adds a
new "Thumb.png" pseudo-file to the parserTests so that we can write
new tests documenting how manual thumbnails are expected to work,
and adds the 'php' option to the thumbnail tests (since the Parsoid
parser generates different output).
Change-Id: I5be80bfce855b85f9debf3ef1776b877d1f84b9f
This patch set reverts the following:
* Iaaf6ccebd8c40c9602748c58c3a5c73c29e7aa4d
* Ib607a446d3499a3c042dce408db5cbaf12fa9e3d
* Ic59fd20856eb0489d70f3469a56ebce0efb3db13 (partially)
Bug 46579 comment 17 describes a desired solution. In
If88923119179924a5ec091394ccab000ade16b3e we are working on a fix, but it is
taking longer than we anticipated. There was a deployment window planned
about now, but we didn't make it. It makes sense to revert for now, and commit
a proper solution somewhere next week.
Bug: 46579
Bug: 1495
Change-Id: Iac7ac4357dd80e8cdb238a6a207393f0712b3fe5
This will help with improving human readability of JS and JSON
objects encoded by both ResourceLoader and the API. This patch
also adds new "utf8" parameter to the JSON formatter of the API.
Changes to FormatJson class:
* Added escaping of '<', '>', and '&' by default to protect against XSS.
* Removed unnecessary escaping of '/' and added an additional option to
unescape non-ASCII characters (those above U+007F) as well.
* Added PHP 5.3 pretty printing code (to replace Services_JSON) that
uses a four-space indent as PHP 5.4 does.
Changes to Xml class:
* Defined Xml::encodeJsVar() in terms of FormatJson::encode()
and added a pretty printing option. Also added a pretty printing
option to Xml::encodeJsCall() as well.
* Deprecated Xml::escapeJsString() and QuickTemplate::jstext();
callers have to add quotes themselves, hence the escaping of
both double quotes and apostrophes.
Bug: 26818
Change-Id: I1987190f1ba5bf41738e7bd611209706c1f6bb5c
Also update some previous inconsistencies pointed out by Krinkle in change IDs:
* Ide20743a2e84ff68549286120e6cff9d9f396f54
* I811ca957b6588085d67606ebc0cd4033a1e53839
Change-Id: Ife33b931870d0d7e04fcb40974997436d27f528f
The tests under tests/phpunit/includes/normal/CleanUpTest.php do not use
data provider. When being run for code coverage (bug 31518) they take so
long that they ends up timing out.
The whole class need to be refactored to use data providers (bug 46561).
Change-Id: I78c270e71d23ffbab00d8812ee91d380aef342c6
* Previously, for doQuickOperations(), the default move function
would just delete the file if it was moved over itself. In fact,
the php-cloudfiles bindings have this same bug in its move function.
* For both copy and move, when the source and destination are the
same path, make sure that the headers get updated as specified.
This only applies for the 'overwrite' case (not 'overwriteSame').
* Fixed bad status for doQuickOperations() when copying a file over
itself using FSFileBackend.
* Clarified the documentation for 'overwriteSame' option.
* Renamed destSameAsSource to overwriteSameCase in FileOp for clarity.
Change-Id: I3f609d9413795c654de27958b1e807b1fc785f31
In Iaaf6ccebd8c40c9602748c58c3a5c73c29e7aa4d, the behavior of MessageCache
was changed so that it iterates over all possible on-wiki fallbacks including
the site language fallbacks. However, it omitted the site language itself.
Obviously, the problem appears only when the site language is not English,
because English is included always as the fallback language of last resort.
But in other cases, we need to add it explicitly.
Bug: 1495
Change-Id: Ib607a446d3499a3c042dce408db5cbaf12fa9e3d
Changing a global 3 times in a test is bad, using dataProvider for two
tests and split another in 3, because there are different.
Using mwglobals to set the globals, than restoring is done
automatically.
Change-Id: Ie0f9ce0be39e457d18752e905d6deeb1803cb4c3
Change some tests to use setMwGlobals to have restoring of globals after
the test.
This also removes some save/restore code, which is not needed, due to
the automatically restoring on tearDown with setMwGlobals.
Change-Id: I8d2ac9f6cc14f0bd4ee8eb851c09f2e71babc6e0
There is currently no straightforward way for anything to call a parser
function and get the result. This abstracts out that portion of
braceSubstitution() to allow this.
The immediate motivation for this patch is to close bug 41769 against
Scribunto, see I0138836654b0e34c5c23daaedcdf5d4f9d1c7ab2.
Bug: 41769
Change-Id: I339b882010dedd714e7965e25ad650ed8b8cd48f
* Cleaned up some data structures into hashes, which get better
compression and play well with the KEYS parameter in Lua scripts.
The claim list is now a sorted set with O(logN) removal in ack()
and O(log(N)+M) searching in recycleAndDeleteStaleJobs().
* Made the class itself control object serialization, so that lua
scripts have an easy time. Only the job data itself needs to be
serialized, where as other things just get bloated.
* Used Lua scripts to get push(), pop() and ack() down to 1 RTT.
* Likewise rewrote recycleAndDeleteStaleJobs() to use a script.
* Fixed bug where claimed duplicate jobs removed the data on ack(),
which meant that claimed duplicated jobs could no-op newer ones.
De-duplication should only apply to unclaimed jobs like for the
JobQueueDB class, so that unfinished jobs don't no-op new ones.
* Removed locking in recycleAndDeleteStaleJobs(), which would not do
much since the exclusive set request would serialize on the lua
script anyway. The lua script will finish quickly the next times
if done more than once in a row due to sorted set usage.
Also made recycleAndDeleteStaleJobs() run randomly to reduce the
chance of a single calling tying up the server.
* Removed useless hDel() call in getJobFromUidInternal().
* Changed unit tests to handle the different supported orders better.
Added tests for the 'timestamp' ordering.
Change-Id: Ib2d7aff18753195248ab856afd4a46e18b301db9
Changed some gettype == 'array', 'object' and similar to is_array,
is_object or similar
Output of gettype must not stable across versions and it is slow
Change-Id: I07bfc063b03be1200989dd6facee66b35ab51d77
* Renamed WebRequest::exportUserSession -> RequestContext::exportSession.
Updated the only callers of this new function.
* Init the user with User::newFromId() instead of relying on the session
(which breaks when things like CentralAuth are enabled).
* Made RequestContext::exportSession() include the user ID.
* Removed now-redundant user ID checks in upload jobs.
* Added unit tests for the session import function.
Change-Id: I543e6766f7a8a828ea5d270328c3bc7738c6fe94
The CleanUpTest are a bit long and reach the medium timeout of 10
seconds. Mark them as large would give them a 60 seconds timeout,
hopefully enough to generate code coverage.
Change-Id: Id6d13204428ec1810a9b56db76bed351bf45b950
PHP Code Coverage uses the @cover comment statement to limit code
coverage to some specific function. The method reference lacked the
trailing 's' leading to an error when running coverage:
PHP_CodeCoverage_Exception: Trying to @cover not existing method
"Title::checkReadPermission".
Change-Id: Ie09e804039271ec8f0165c32dc7849ea4be8a3b9
* Beefed up unit tests for this case and other "ignoreMissingSource" cases
such as when the source container or parent directory do not exist.
Change-Id: Iea6dae2424edfd0c4367e5cff606c09a4e8a865b
* Improved handling of corrupt values in cache for MemcLockManager.
Also improved the use of Status warnings a bit.
* Removed broken special-case handling for SH->EX lock escalation.
Updated MysqLockManager to compensate.
* Made FSLockManager only use one handle per file, which is more
efficient and avoids errors when escalating locks (SH->EX).
* Made lock unit tests have more useful output on failure.
Change-Id: Ib304712fa2b6b3fd02bfc1b08b6f238c771960c2
MessageCacheTest::addDBData is called before setUp, so wgLanguageCode
and wgContLang are not set to 'en', which result in mediawiki pages
created as $key/en. When the test runs, the language is set correctly
and mediawiki is searching under $key, and does not find anything.
Set wgLanguageCode and wgContLang at the begin of addDBData
1) MessageCacheTest::testMessageFallbacks with data set #0
('FallbackLanguageTest-Full', 'ab', 'ab')
Message fallback failed.
Failed asserting that false matches expected 'ab'.
Change-Id: I8e70b7b424df6a9ad98bfb6c228809f4b4437d1e