Commit graph

54989 commits

Author SHA1 Message Date
Roan Kattouw
a6643499a4 Obtain MessageBlobStore instance in a consistent way
Use MediaWikiServices (not OutputPage) to obtain a ResourceLoader
instance, then call ->getMessageBlobStore() to obtain its
MessageBlobStore instance (don't construct a new one).

Change-Id: I6b8bacac9888b5807328eece01134a6c5747dc72
2019-05-07 01:09:45 +00:00
jenkins-bot
57609f4ded Merge "Consolidate duplicated unseen change logic and fix inconsistent code" 2019-05-06 19:59:46 +00:00
jenkins-bot
5f3b124dfe Merge "Convert WatchedItem and friends to LinkTarget" 2019-05-06 19:33:44 +00:00
jenkins-bot
61d80fb2ca Merge "Move Title::getSubject/Talk/OtherPage to NamespaceInfo" 2019-05-06 19:33:37 +00:00
jenkins-bot
c3d8fa1fc3 Merge "Update LinkCache to use NamespaceInfo" 2019-05-06 16:48:20 +00:00
Aryeh Gregor
761e704d6e Convert WatchedItem and friends to LinkTarget
There is no longer any reference to Title in WatchedItem classes or
their unit tests except for one hook that keeps Title for compat. Happy
side effects include getting rid of $revisionGetTimestampFromIdCallback,
and a net reduction of 143 LOC.

Change-Id: Id998c6f336ed808f7259e4f8359bcf8d6c0210d6
2019-05-06 15:30:45 +00:00
Aryeh Gregor
e30cb5ba90 Move Title::getSubject/Talk/OtherPage to NamespaceInfo
This allows converting some more code to LinkTarget. 100% test coverage.

Change-Id: I28903af6a41d02755f37f31561a524547445821e
2019-05-06 08:29:28 -07:00
jenkins-bot
8d9d8c8bb3 Merge "Force user id and actor id to 0 when loading from remote wikis" 2019-05-06 15:19:38 +00:00
Bill Pirkle
d4b72572a6 Force user id and actor id to 0 when loading from remote wikis
Stop-gap solution for the problem described in T222212.
Force the User ID and Actor ID to zero for users loaded
from the database of another wiki, to prevent subtle data
corruption and confusing failure modes.

Bug: T222381
Change-Id: Ic585f972d61da136744d080df13d8eb1ecd04cf5
2019-05-06 09:08:51 -05:00
jenkins-bot
dfbcce91c2 Merge "Make RepoGroup a service instead of singleton" 2019-05-06 12:51:46 +00:00
jenkins-bot
123b2ff2fa Merge "100% test coverage for NamespaceInfo" 2019-05-06 12:32:17 +00:00
jenkins-bot
27ede06954 Merge "Move ApiQueryUserInfo::getBlockInfo() to ApiBase" 2019-05-06 12:29:40 +00:00
jenkins-bot
d848678e55 Merge "rcfeed: Replace usage of deprecated class RCFeedEngine (in comments)" 2019-05-06 11:43:00 +00:00
jenkins-bot
d339c17d70 Merge "NS_MEDIA also always has page_id 0" 2019-05-06 11:39:14 +00:00
Aryeh Gregor
a220518f8f 100% test coverage for NamespaceInfo
In the new tests I added, I tried to cover all interesting scenarios and
not just hit each line to make the coverage green. But I didn't review
all the existing tests to see if they were properly thorough, so there
might still be room for improvement.

I uncovered a bug here that will be addressed in a separate commit,
because the fix is not so simple. For now I left the test expectation as
a @todo.

Change-Id: I33d556bf83c631a8a02a6c77f2f5cb06b8dbf869
2019-05-06 14:17:06 +03:00
Aryeh Gregor
e6691999f4 Make RepoGroup a service instead of singleton
Change-Id: Id1661bf992ee7b7a1822f52fdfefe8e045b9f280
2019-05-06 13:57:40 +03:00
jenkins-bot
d183642dfb Merge "MovePage methods need to run safety checks" 2019-05-06 10:51:40 +00:00
jenkins-bot
7ada64684e Merge "Don't pass Config to NamespaceInfo" 2019-05-06 10:51:34 +00:00
jenkins-bot
a97bac4084 Merge "Update GenderCache to use NamespaceInfo" 2019-05-06 10:45:15 +00:00
jenkins-bot
2052711639 Merge "Deprecate the Http class" 2019-05-06 10:15:10 +00:00
Aryeh Gregor
6f2906e36a Update LinkCache to use NamespaceInfo
Change-Id: Ie9ebc2564861068dea8a64aea5cbeacb03597cea
2019-05-06 09:37:58 +00:00
Aryeh Gregor
3860a8d9b4 Update DefaultPreferencesFactory to use NamespaceInfo
Depends-On: I552264714de7227965f978f20f932f41cf96042e
Change-Id: I0568e7f4c7223208001f378a03fef395df8bff69
2019-05-06 12:19:13 +03:00
Aryeh Gregor
571567cddc Update GenderCache to use NamespaceInfo
Change-Id: I0c2997bf8764249c26251d0f63f3ea0a0b272a7e
2019-05-06 12:08:45 +03:00
Aryeh Gregor
9018579681 Deprecate the Http class
All methods got moved to HttpRequestFactory or MWHttpRequest or dropped.

I made the return value of the new HttpRequestFactory::request/get/post
methods null on error instead of false, so that when we drop PHP 7
support, we can use a "?string" return value. This could theoretically
change behavior of code that was switched from the old Http methods, but
probably won't. I kept the old behavior for the deprecated methods.

I changed the default value of $wgHTTPProxy from false to ''. This way
it should be usable directly without a trivial wrapper method. For the
benefit of anyone who might have set it to false in LocalSettings.php, I
also recommend casting to string just in case.

Http::$httpEngine is deprecated. Eventually it will be removed along
with the curl and PHP engines, leaving only the Guzlle engine.

I also added deprecation of MWHttpRequest::factory, which occurred in
1.31, to the release notes for 1.34. Now hopefully we can hard-deprecate
it in another couple of versions.

Bug: T214390
Change-Id: I2a316a758d793857f248bd251b90f5e9a6440e3a
2019-05-06 12:07:26 +03:00
Aryeh Gregor
fb7d698365 Don't pass Config to NamespaceInfo
Change-Id: Ie43e6108c6b9bcb666b1dece055e0df689e2ec42
2019-05-06 11:31:34 +03:00
Aryeh Gregor
24949e738d MovePage methods need to run safety checks
A move method that doesn't check for things like moving a page on top of
itself or moving to a namespace with a different content model does not
seem like it's what callers would expect, and not what Title::moveTo
ever did. If there's a caller that really wants this behavior, we can
make moveUnsafe public.

I also made the $reason and $createRedirect parameters to move()
optional to match Title::moveTo() behavior. However, I made $reason
default to null instead of '', to distinguish between an empty edit
reason provided by the user and no edit reason provided at all (e.g., a
move done internally without specific user request).

Depends-On: I971e619eb76c4474fe037fad258f9c496717bf41
Change-Id: I6ddcc9f34a48f997ae39b79cd2df40dd2cc10197
2019-05-06 10:04:26 +03:00
Amir Sarabadani
693c8b2f5a Move ApiQueryUserInfo::getBlockInfo() to ApiBase
ApiBase directly uses this method causing a cyclic dependency between
ApiBase and ApiQueryUserInfo

Change-Id: I84ed21641c44b2f65ebe1980b0893d1846db3b34
2019-05-06 00:06:30 +02:00
Translation updater bot
427fbee734 Localisation updates from https://translatewiki.net.
Change-Id: I7fb884c03375b5c918f8e4b7f5309bbbe70c89ad
2019-05-05 21:54:56 +02:00
jenkins-bot
3aa8eb1e45 Merge "Permissions: Declare the $nsInfo property and document it in constructor" 2019-05-05 19:35:38 +00:00
Aryeh Gregor
090f6daa1b Move getPrevious/NextRevision logic out of Title
They belong in RevisionStore. This change removes the dependency on
Title for these methods and will assist in porting more code to
LinkTarget.

At the same time, deprecate the Title parameter to
RevisionLookup/RevisionStore getPreviousRevision/getNextRevision, and
add a $flags parameter to match the functionality of the Title versions.
Since code search turned up no callers that passed a Title outside core,
this variant is immediately hard-deprecated. The Title methods
themselves are only soft-deprecated.

Change-Id: I76bc6fd6ee1a9f35b5f29fa640824fb5da3bb78e
2019-05-05 21:08:46 +03:00
Derick Alangi
fb9a84de84 Permissions: Declare the $nsInfo property and document it in constructor
Was added in commit 1f7ab9c but was never documented nor declared before its
usage.

Change-Id: Iea833f9ffb6ac210251912d35cdebf9bb064d610
2019-05-05 17:21:39 +01:00
Aryeh Gregor
908e46028a Don't require Title for getTimestampFromId
3e36ba655e added an option for passing a page ID to this method of
Revision, and e03787afd9 switched it to a Title and made it mandatory.
This behavior propagated to the method in RevisionStore.  As far as I
can tell, the parameter does not help anything, but it can add a
database query to get the page ID if it's not cached, and impedes
conversion to LinkTarget. I can't figure out any reason to not
completely drop it. I've noted it as deprecated but still supported it
for now for compatibility -- I found one extension that does pass it.
(It's ignored, though, which theoretically would be a behavior change if
someone was passing a Title that didn't match the revision ID.)

While I was at it, I added the method to RevisionLookup, although it's
only used in later patches. Properly I should move that piece to a later
patch, but it didn't seem worth the effort.

I didn't change the Revision method, because the whole Revision class is
deprecated anyway.

Change-Id: I26ef5f2bf828f0f450633b7237d26d888e2c8773
2019-05-05 14:35:53 +03:00
Aryeh Gregor
f7201e3b9b Convert WatchedItem and friends to UserIdentity
I wasn't able to port some places that rely on isAllowed, getOption, or
related methods.

This adds isRegistered() to UserIdentity, which works like
User::isLoggedIn() but with a better name.

I also cleaned up User mocks in WatchedItemQueryServiceUnitTest in the
course of debugging test failures when switching them to
UserIdentityValue instead of mock Users where possible. They now specify
explicitly which methods are allowed to be called on their User objects,
which I believe is good practice for mocks (and unfortunately PHPUnit
makes it awkward).

Bug: T207972
Depends-On: I883d506197a011fe4c102b72df4d9deb58ab5ca2
Change-Id: Iadbf7bc31a496899dbef44e49065ff89f37aea89
2019-05-05 14:35:52 +03:00
Aryeh Gregor
0006d922b0 NS_MEDIA also always has page_id 0
Change-Id: I0047e5f8e367fe3e8433e715ea56616a6f8dab85
2019-05-05 11:37:01 +03:00
jenkins-bot
795bbed0ec Merge "Add UserOptionsUpdateJob class" 2019-05-04 17:42:48 +00:00
Aaron Schulz
03d37f283b Consolidate duplicated unseen change logic and fix inconsistent code
Bug: T218511
Change-Id: I42387498dff0b1fc31f006ce3ba71241de9d45d7
2019-05-03 13:23:24 -07:00
Translation updater bot
2c36cc7f6f Localisation updates from https://translatewiki.net.
Change-Id: Iaffb949f59706ee6ca0d61ca8a3c9487be0d5a31
2019-05-03 22:00:03 +02:00
jenkins-bot
94b9ae422b Merge "Avoid/Replace usage of deprecated wfMemcKey() function" 2019-05-03 19:27:23 +00:00
Aaron Schulz
4d8bfbdca4 Add UserOptionsUpdateJob class
This can help avoid DB master queries on HTTP GET requests

Change-Id: I6fa2d53d96509d88f5d3e1ff18f3ca1de8fa4bb1
2019-05-03 12:02:20 -07:00
Bartosz Dziewoński
36d33daa03 HTMLForm: Improve method interface for collapsible forms
Also minor tweaks:
* Fix @since tags, this did not make it into 1.33
* Fix usage of FieldsetLayout 'group' in OOUIHTMLForm
* Documentation changes

Follow-up to 2896e87a10,
per my post-merge review on that commit.

Change-Id: Ib93375cde19730a46e4929878d6e472d3ac8f631
2019-05-02 14:33:20 -07:00
jenkins-bot
8d7889f42c Merge "SearchInputWidget: Replace pushPending hack" 2019-05-02 19:08:50 +00:00
Brad Jorsch
77ca1430e4
SECURITY: LogPager: Don't STRAIGHT_JOIN when using log_search
We'll hope MariaDB doesn't trigger T221458 in that situation.

Bug: T222324
Signed-off-by: Scott Bassett <sbassett@deploy1001.eqiad.wmnet>
Signed-off-by: James D. Forrester <jforrester@wikimedia.org>
Change-Id: I06364e9d0bce45bd97b2ec837d1f479feff76699
2019-05-02 10:54:42 -07:00
Ed Sanders
e8a2f22aae SearchInputWidget: Replace pushPending hack
Use the showPendingRequest config option instead of setting
a prototype method to false.

Bug: T222329
Change-Id: I0e3176141c63ed9a849326c2f9a5a26ffc2b273f
2019-05-02 17:27:37 +01:00
Derick Alangi
1b9ea4d1bf Avoid/Replace usage of deprecated wfMemcKey() function
This global function was deprecated in 1.30 and is replaced with
the use of `ObjectCache::getLocalClusterInstance()->makeKey()`.

Change-Id: Ic08b53111be4374a973e08c2ed68224bfa922fa8
2019-05-02 14:27:31 +00:00
Aryeh Gregor
18ec468633 Don't pass Config to service constructors
We don't want to depend on the entire site configuration when we only
need a few specific settings.

This change additionally means that these services no longer see a live
version of the settings, but rather a copy. This means in tests you
really do have to call overrideMwServices() if you want services to pick
up your config changes.

ResourceLoader and SearchEngineConfig will need more work to port,
because they expose their member Config in a getter, and the getter is
actually used.

Parser and NamespaceInfo are also relatively complicated, so I split
them into separate patches.

Tested with 100% code coverage. \o/

Depends-On: If6534b18f6657ec1aba7327463f2661037f995b3
Change-Id: I1a3f358e8659b49de4502dc8216ecb6f35f4e02a
2019-05-02 11:33:56 +03:00
jenkins-bot
55cdf18ecf Merge "Hide uploads link on IP contributions page" 2019-05-01 20:04:06 +00:00
jenkins-bot
5863b8b458 Merge "Localisation updates from https://translatewiki.net." 2019-05-01 19:56:25 +00:00
Translation updater bot
3fdd09ec45 Localisation updates from https://translatewiki.net.
Change-Id: I31fb1c0676b6f32bbdde280afb98d3ce6c85854a
2019-05-01 21:55:49 +02:00
jenkins-bot
b1afc34fc8 Merge "Fix class name handling in DeprecationHelper" 2019-05-01 19:51:36 +00:00
jenkins-bot
a8b38e84ac Merge "shell: annotate return types" 2019-05-01 19:16:37 +00:00