Commit graph

482 commits

Author SHA1 Message Date
Daimona Eaytoy
5945611e0b Annotate OldChangesList::recentChangesLine as returning a safe value
Some recent core change, possibly
I2b59c90a609aec1ec74e9c2e7f6fc67573158493, made taint-check think that
the return value of MapCacheLRU::getWithSetCallback is tainted, hence
it's now complaining if this value is output.

This is currently blocking merges in AbuseFilter, see e.g.
https://integration.wikimedia.org/ci/job/mwext-php72-phan-docker/82384/console

Change-Id: I42a596bd4309d60e3ead4e391b1148d503a5680f
2020-11-07 15:37:32 +01:00
Thiemo Kreuz
b0130ca649 Update a lot of unspecific "array" types in PHPDocs
This includes fixing some mistakes, as well as removing
redundant text that doesn't add new information, either because
it literally repeats what the code already says, or is actually
duplicated.

Change-Id: I3a8dd8ce57192deda8916cc444c87d7ab1a36515
2020-10-28 11:01:33 +01:00
jenkins-bot
d7280851ec Merge "Add days left messages to changes-lists' clock icons" 2020-10-06 17:14:57 +00:00
jenkins-bot
72a90d3d06 Merge "Document hook names in hook interfaces." 2020-10-02 16:15:21 +00:00
Umherirrender
d790580fda Fix typos related to repeated words
Change-Id: Ibc187d95b003017255bc87adf56afae7a59bd3db
2020-09-27 10:25:36 +00:00
daniel
2e57447c58 Document hook names in hook interfaces.
Bug: T258665
Change-Id: Ifddbf57f8aa2e3eb0d5845601376cbafa08ed407
2020-09-27 12:03:12 +02:00
Sam Wilson
070ffce218 Add days left messages to changes-lists' clock icons
Add a new resource module for watchlist expiry behaviour in
changes lists, to add a message when the clock is clicked on
mobile.

Bug: T261415
Change-Id: I621b1571b57686beb9fb5802533b1e70d293bc2a
2020-09-16 12:00:32 +08:00
Thiemo Kreuz
d206da0e1e CSS 'class' names can be an array in Html::…element
Change-Id: I301d23066b19051b9e1cb9363639f6189a8b173c
2020-09-08 19:11:19 +00:00
DannyS712
77781b08c7 Add delete-redirect for deleting single-rev redirects during moves
A new user right, `delete-redirect`, is added (not given to anyone
by default). At Special:MovePage, if attempting to move to a single
revision redirect that would otherwise be an invalid target (i.e.
doesn't point to the source page), the user is able to delete the
target.

Deletions are logged as `delete/delete_redir2`, and the move is
then logged normally as `move/move`, mirroring current delete and
move logging.

To allow for separate handling by Special:MovePage,
MovePage::isValidMove now returns a fatal status `redirectexists` if
the target isn't valid but passes Title::isSingleRevRedirect.
Otherwise, `articleexists` is returned (as previously). Other callers
that don't intend to treat single revision redirects differently
should treat `redirectexists` the same as `articleexists`.

Currently, this deletion (like normal delete and move) cannot be
done through the move api. Since the deletion is only valid when
moving a page, unlike for normal deletion, deleting redirects with
this right cannot be done via the delete api either.

Bug: T239277
Change-Id: I36c8df0a12d326ae07018046541bd00103936144
2020-09-04 03:50:17 +00:00
Ostrzyciel
a47778d5c0 Add mw-reverted change tag
The tag is added to reverted edits as described in T254074.

Functionality:
* Adding the mw-reverted tag to reverted edits (duh)
* Limiting the maximum depth of the update through a config variable
(mitigation #2 from T259014).
* Only applying the reverted tag after the edit has been somehow
approved. Only the patrol subsystem currently implements this, but
there's a hook that extensions can use (mitigation #4 from T259014, more
explanation in T259103).
* When performing the delayed update, it is checked whether the reverted
edit was reverted itself. If so, the update is ignored. This is
probably the only way to make the feature work due to the lack of an
explicit "disapproval" mechanism other than reverting.
* The update is also ignored if the revert is marked as deleted.

Technical design:
* The update code is in RevertedTagUpdate.php, which is a deferrable
update, but is not used as such. It's separated to allow for better DI,
testing and better code reusability in the future.
* The update is queued / ran using the Job subsystem. The relevant job
is in RevertedTagUpdateJob.php
* PageUpdater determines whether the edit is approved or not and passes
that to the DerivedPageDataUpdater.
* The BeforeRevertedTagUpdate hook lets extensions decide whether the
update should be ran right away or await approval.
* DerivedPageDataUpdater checks whether the edit is a revert and if so
either enqueues the job (if it's auto-approved) or caches the EditResult
for later use (if it needs approval).
* RevertedTagUpdateManager allows for easy re-enqueueing of the update
for extensions. Thus, it has a very minimal interface.

Other notes:
* The unit testing setup for RevertedTagUpdate is a bit complicated,
but it was the only way I could make this class testable while using
the static ChangeTags class.

Bug: T254074
Depends-On: I86d0e660f0acd51a7351396c5c82a400d3963b94
Change-Id: I70d5b29fec6b6058613f7ac2fb49f9fad9dc8da4
2020-08-31 13:40:50 +00:00
DannyS712
f734e37c0e Remove RecentChange::markPatrolled, deprecated and unused
Deprecated in 1.35, no remaining uses:
https://codesearch.wmcloud.org/search/?q=markPatrolled%5C(&i=nope&files=&repos=

Bug: T246192
Change-Id: I3704589e7447aecb4abae9c9d668ff5f38857525
2020-08-26 21:21:17 +00:00
hmonroy
0c2cc49bdc Update language in watchlist expiry
Update watchlist expiry language indicators (dropdowns, tooltips, watch
via star, watch via edit):
 * Change "Permanently" to "Permanent"
 * Change "XX days left" and "Expires in X days" to "XX days left in
   watchlist"
 * Update the "Click.." sentence by star to "Click to remove it."
 * Change watch period for a page that is less than "1 day left" to "A
   few hours left"

Bug: T253135
Bug: T255632
Change-Id: I114c6f77e86ad81b1810fedcd49f52c88700ca16
2020-08-14 11:47:03 -07:00
Ostrzyciel
5488a33340 Save additional info about reverts in ct_params
This aims to persist the EditResult object associated with reverts
in the ct_params field of change_tag table for revert tags. This can
be later used for analytics or when performing a delayed
RevertedTagUpdateJob (see T259103).

The code doing that has to be in the RecentChange class, as only it
knows the relevant rc_id and rev_id.

Bug: T259733
Change-Id: I365cf44484aa5bf907128a075fcff890649504c4
2020-08-07 06:45:50 +00:00
Sam Wilson
cde153d25c Add watchlist clock icon to RecentChanges
Extend the watchlist expiry clock icon from Special:Watchlist to
also be displayed on Special:RecentChanges for expiring watchlist
items.

Bug: T258310
Change-Id: I254570addd1835119c863639111bd5394cb4b697
2020-07-28 15:30:18 +08:00
Sam Wilson
1342c90537 Fix watchlist query and filters for RecentChanges
This query was correctly excluding expired items from RC, but it
was failing to include them when the unwatched filter was set.

This is a follow-up to https://gerrit.wikimedia.org/r/c/mediawiki/core/+/602211

Bug: T252136
Change-Id: I5d43d746df21cc3674eb2e92c3f604b7c87b7d1a
2020-07-28 08:38:25 +08:00
Thiemo Kreuz
fd7363a1e1 Fix broken PHPDoc comments that don't start with /**
Change-Id: I8db56ff0f73873864dde260e51adcd729aa74e94
2020-07-23 16:09:41 +00:00
jenkins-bot
453e1357ee Merge "Update stability annotations to follow new stable interface policy" 2020-07-13 10:05:02 +00:00
jenkins-bot
6a20eebf3d Merge "Mark potential abstract classes stable for subclassing" 2020-07-13 09:48:26 +00:00
daniel
48eb174759 Update stability annotations to follow new stable interface policy
This is a follow-up to I1939bb11038ec2.

Bug: T247862
Change-Id: I69a1ec1700bfb68a36003d65cc2184f23f208794
2020-07-13 09:40:54 +00:00
daniel
e6e0ad2472 Replace "@stable for implementation" with "@stable to implement"
For compliance with the new version of the table interface policy
(T255803).

This patch was created by an automated search & replace operation
on the includes/ directory.

Bug: T257789
Change-Id: I17e5e92e24c708ffc846945a136347670a3a20c7
2020-07-13 11:05:49 +02:00
Nikki Nikkhoui
5fb9e95b22 Mark potential abstract classes stable for subclassing
Going through some more abstract classes in core, and
marking those that are extended by extensions as
stable.

I have limited knowledge on the uses of these classes so
marking for vibisility/review.

Bug: T247862
Change-Id: I1939bb11038ec2536eebbdbd12524e83d615b86b
2020-07-11 15:33:34 -07:00
DannyS712
94169ee873 Whitespace cleanup: Use tabs for indentation, avoid double spaces
Change-Id: I346073b59d283029bd6666356c62c81e687ea5e6
2020-06-27 07:53:07 +00:00
jenkins-bot
da6f6a2aa8 Merge "Add clock icon to expiring items in Special:Watchlist" 2020-06-24 17:34:50 +00:00
Tim Starling
d459add63d Introduce wfDeprecatedMsg()
Deprecating something means to say something nasty about it, or to draw
its character into question. For example, "this function is lazy and good
for nothing". Deprecatory remarks by a developer are generally taken as a
warning that violence will soon be done against the function in question.
Other developers are thus warned to avoid associating with the deprecated
function.

However, since wfDeprecated() was introduced, it has become obvious that
the targets of deprecation are not limited to functions. Developers can
deprecate literally anything: a parameter, a return value, a file
format, Mondays, the concept of being, etc. wfDeprecated() requires
every deprecatory statement to begin with "use of", leading to some
awkward sentences. For example, one might say: "Use of your mouth to
cough without it being covered by your arm is deprecated since 2020."

So, introduce wfDeprecatedMsg(), which allows deprecation messages to be
specified in plain text, with the caller description being optionally
appended. Migrate incorrect or gramatically awkward uses of wfDeprecated()
to wfDeprecatedMsg().

Change-Id: Ib3dd2fe37677d98425d0f3692db5c9e988943ae8
2020-06-22 14:34:39 +10:00
Umherirrender
17a5d5a84b Fix combination of (int) and ??
(int) has higher precedence as ?? and that means the array key is always
casted first and the error suppression part of ?? cannot work

https://www.php.net/manual/en/language.operators.precedence.php

Change-Id: Iee7dc9297c0745ce48295f637a7591ce9385aa4d
2020-06-19 17:28:22 +02:00
Sam Wilson
93396e965e Add clock icon to expiring items in Special:Watchlist
If a changeslist item has an expiry date, add a grey clock icon
after the page title, with a tooltip indicating when the item
expires.

Bug: T250212
Change-Id: I38f8c85321cf257eeea8de5a3bd73bbc0b5ea393
2020-06-19 05:48:21 +08:00
DannyS712
3c811b5e3d CategoryMembershipChange: Don't call Revision::getTimestamp
Check if a Revision object was passed before calling ::getTimestamp

Bug: T254966
Change-Id: Ibd7330e9de5052b99ed7168d59a14c2990f2c185
2020-06-10 05:42:50 +00:00
Daimona Eaytoy
2b37cfaf18 build: Bump mediawiki-codesniffer to 31.0.0
Done with `composer fix` and suppressing the rest (i.e. sniffs for
global variables, which for core should be suppressed anyway).

Additionally, add `-p` to `phpcbf`, as otherwise it just seems stuck.

Change-Id: Ide8d6cdd083655891b6d654e78440fbda81ab2bc
2020-05-30 14:56:28 +00:00
Tim Starling
68c433bd23 Hooks::run() call site migration
Migrate all callers of Hooks::run() to use the new
HookContainer/HookRunner system.

General principles:
* Use DI if it is already used. We're not changing the way state is
  managed in this patch.
* HookContainer is always injected, not HookRunner. HookContainer
  is a service, it's a more generic interface, it is the only
  thing that provides isRegistered() which is needed in some cases,
  and a HookRunner can be efficiently constructed from it
  (confirmed by benchmark). Because HookContainer is needed
  for object construction, it is also needed by all factories.
* "Ask your friendly local base class". Big hierarchies like
  SpecialPage and ApiBase have getHookContainer() and getHookRunner()
  methods in the base class, and classes that extend that base class
  are not expected to know or care where the base class gets its
  HookContainer from.
* ProtectedHookAccessorTrait provides protected getHookContainer() and
  getHookRunner() methods, getting them from the global service
  container. The point of this is to ease migration to DI by ensuring
  that call sites ask their local friendly base class rather than
  getting a HookRunner from the service container directly.
* Private $this->hookRunner. In some smaller classes where accessor
  methods did not seem warranted, there is a private HookRunner property
  which is accessed directly. Very rarely (two cases), there is a
  protected property, for consistency with code that conventionally
  assumes protected=private, but in cases where the class might actually
  be overridden, a protected accessor is preferred over a protected
  property.
* The last resort: Hooks::runner(). Mostly for static, file-scope and
  global code. In a few cases it was used for objects with broken
  construction schemes, out of horror or laziness.

Constructors with new required arguments:
* AuthManager
* BadFileLookup
* BlockManager
* ClassicInterwikiLookup
* ContentHandlerFactory
* ContentSecurityPolicy
* DefaultOptionsManager
* DerivedPageDataUpdater
* FullSearchResultWidget
* HtmlCacheUpdater
* LanguageFactory
* LanguageNameUtils
* LinkRenderer
* LinkRendererFactory
* LocalisationCache
* MagicWordFactory
* MessageCache
* NamespaceInfo
* PageEditStash
* PageHandlerFactory
* PageUpdater
* ParserFactory
* PermissionManager
* RevisionStore
* RevisionStoreFactory
* SearchEngineConfig
* SearchEngineFactory
* SearchFormWidget
* SearchNearMatcher
* SessionBackend
* SpecialPageFactory
* UserNameUtils
* UserOptionsManager
* WatchedItemQueryService
* WatchedItemStore

Constructors with new optional arguments:
* DefaultPreferencesFactory
* Language
* LinkHolderArray
* MovePage
* Parser
* ParserCache
* PasswordReset
* Router

setHookContainer() now required after construction:
* AuthenticationProvider
* ResourceLoaderModule
* SearchEngine

Change-Id: Id442b0dbe43aba84bd5cf801d86dedc768b082c7
2020-05-30 14:23:28 +00:00
Ori Livneh
19931e069f mime: Update usage of MimeAnalyzer methods
Follow-up to I93bd71ec1.

Bug: T252228
Change-Id: I45c9fc592c9e41e0868e7d965206d4c04f4f92e1
2020-05-28 20:13:47 +00:00
Reedy
d53e91d272 Fix more PSR12.Properties.ConstantVisibility.NotFound
Change-Id: I94520b10d78a17ea8e965633dd475ea711f25c99
2020-05-15 00:33:32 +01:00
jenkins-bot
a74779afbb Merge "Introduce ProtectedHookAccessorTrait and pilot the Hooks::run() migration" 2020-05-14 13:33:55 +00:00
James D. Forrester
4111cab7ee Replace use of old $wgVersion constant with MW_VERSION
Change-Id: I4b9208b63fa082c9dbc7842868f1199b1a747dc5
2020-05-13 15:01:19 -07:00
Tim Starling
28ae2a60e9 Introduce ProtectedHookAccessorTrait and pilot the Hooks::run() migration
* ProtectedHookAccessorTrait provides protected getHookContainer() and
  getHookRunner() methods, getting them from the global service
  container. The point of this is to ease migration to DI by ensuring
  that call sites ask their local friendly base class rather than
  getting a HookRunner from the service container directly.
* Migrate ChangesList and subclasses from Hooks::run() to the new system,
  as a pilot for full migration.

Change-Id: Ic2d408fdb108087d81d0981aa670b35e0a6bb0ce
2020-05-13 13:50:32 +10:00
jenkins-bot
63a306c9f6 Merge "Explicit return in ChannelFeed::formatTime() implementations" 2020-05-08 22:00:41 +00:00
Reedy
b75e99a325 Explicit return in ChannelFeed::formatTime() implementations
Change-Id: I8b33e9c28a12a5387b8ccce504027f681e917655
2020-05-08 21:32:12 +00:00
Umherirrender
a9c55726e0 Add missing public visibility on some methods
RSSFeed::formatTime and AtomFeed::formatTime are private

Change-Id: I6bf081c31c92e7130ae0ae527ba4a8f4635c7de2
2020-05-08 21:25:36 +00:00
DannyS712
3d4fb45f96 ChangesList::insertRollback - Force rc_this_oldid to integer before use
Same for the other fields that needed to be integers

Follow up to 71b64e46e4

Bug: T251386
Change-Id: Idf4cc7d3cc54a98e46619c0996f8109bc1e88620
2020-04-29 10:56:51 +00:00
DannyS712
71b64e46e4 ChangesList::insertRollback - remove internal use of Revision objects
Bug: T246284
Change-Id: I0f506e73eee994c1dd8610803f8ce1c53164ca59
2020-04-27 22:10:25 +00:00
Tim Starling
0b7295a5cd Hook interface doc comment followup
Mostly just narrower array types. A handful of other errors fixed.

Change-Id: Ied79d9e389867911bf83696dbb47f43305f8be7b
2020-04-21 09:12:23 +10:00
apaskulin
c44488f725 docs: Hook interface doc comment review
Edited doc comments for hook interfaces to improve
consistency and add type hints.

Bug: T246855
Change-Id: I38fa802463cd6f39bf5946dbbeb1b3ebaea604b2
2020-04-21 09:10:08 +10:00
Tim Starling
f5aaf75ad1 Automatically generated hook interfaces
Add hook interfaces which were generated by a script which parses
hooks.txt and identifies caller namespaces and directories.

Hook interfaces are mostly placed in a Hook/ subdirectory
relative to the caller location. When there are callers in multiple
directories, a "primary" caller was manually selected. The exceptions to
this are:

* The source root, maintenance and tests, which use includes/Hook. Test
  hooks need to be autoloadable in a non-test request so that
  implementing test interfaces in a generic handler will not fail.
* resources uses includes/resourceloader/Hook
* The following third-level subdirectories had their hooks placed in
  the parent ../Hook:
    * includes/filerepo/file
    * includes/search/searchwidgets
    * includes/specials/forms
    * includes/specials/helpers
    * includes/specials/pagers

Parameters marked as legacy references in hooks.txt are passed
by value in the interfaces.

Bug: T240307
Change-Id: I6efe2e7dd1f0c6a3d0f4d100a4c34e41f8428720
2020-04-20 13:31:05 +10:00
DannyS712
af7f397ccc Pass RevisionRecord to Linker methods
Hard deprecation of passing Revision objects will follow soon,
but until that is ready core calls can be updated

There is some code cleanup that could be done around the calls, but
to simplify review no other changes are made.

Bug: T249561
Change-Id: Ifcfb3811650decffeaa87dc033c41fd1710b47a6
2020-04-18 01:24:54 +00:00
DannyS712
9e561b4e65 Use RevisionRecord in ChangesList::revDateLink
The change to ChangesList::revDateLink is not backwards compatible,
because the method was marked as @internal

Due to a breaking change in HistoryPager::revLink, and the fact that
it didn't have a visibility defined, it has been made private

Bug: T246284
Change-Id: I2f1309fda1c312a6cf634de48ad0bbcfcb2d83ae
2020-04-04 00:49:28 +00:00
jenkins-bot
0de13c6125 Merge "Fix mismatching type hints in PHPDoc tags" 2020-03-26 13:35:31 +00:00
Petr Pchelko
a2cf98ef70 Remove usages and hard deprecate Revision::newFromRow
Also updates CategoryMembershipChange to accept a RevisionRecord
instead of a Revision.

Bug: T246284
Change-Id: I30024b7278e108b0f4e20ef1eb44647916fad47c
2020-03-25 11:42:36 -07:00
Thiemo Kreuz
1006aa41e6 Fix mismatching type hints in PHPDoc tags
This is a collection of random bits from my local stashes. This patch
intentionally only touches comments, no code.

Notably:
* Use more specific string[] instead of array, if possible.
* Some comments mention "or null", but miss to list the type.

Change-Id: I712b28964f125c8e3dcb4e3fb993757a09f96644
2020-03-24 09:59:02 +01:00
Thiemo Kreuz
7a4df9b019 Remove auto-generated and empty lines in comments
… and add the missing newline after the initial <?php.

Change-Id: I83bbbb1504e4b2bd97eec63c7626d34c655c3197
2020-03-17 09:55:24 +01:00
DannyS712
78bc3ae255 Hard deprecate Revision::userCan
Replace remaining uses outside of tests, hide deprecated in tests

Bug: T247259
Change-Id: I91dfb46ed6864ee89d968aea8ec93b5ea2f8389e
2020-03-11 02:10:52 +00:00
Abbe98
0da37edd0b EnhancedChangesList: add screen reader support to live changes
Expose EnhancedChangesList content to assistive technology as it's updated.

Change-Id: I5b9744075bf7ab03388ed7f827a171b6c253de8d
2020-03-10 21:17:57 +00:00
DannyS712
7186b63f82 Hard deprecate Title::getUserPermissionsErrors
Remove final uses as well

Bug: T244929
Change-Id: I65e937c7b9904b1e93f649508b14148849589f82
2020-02-26 05:09:55 +00:00
DannyS712
dec8ddddcf Hard deprecate RecentChange::markPatrolled
It uses $wgUser, but rather than adding a user parameter, the whole
method can just be deprecated and removed. All existing calls have
already been updated.

Bug: T245195
Change-Id: Id7d67cd69d87283cb88455593a4a183c4a5c7721
2020-02-26 04:19:55 +00:00
Timo Tijhof
f575721a06 Update all use of $wgVersion to MW_VERSION
Follows-up I04628de4152dd5.

Bug: T212738
Change-Id: I718474ec0d9fd29ac2c05477f0f2493615d8aff5
2020-02-25 02:16:12 +00:00
James D. Forrester
0958a0bce4 Coding style: Auto-fix MediaWiki.Usage.IsNull.IsNull
Change-Id: I90cfe8366c0245c9c67e598d17800684897a4e27
2020-01-10 14:17:13 -08:00
jenkins-bot
cf92c2dc44 Merge "Use namespaced IPUtils class" 2020-01-01 23:56:22 +00:00
Kunal Mehta
99007e96c7 Use namespaced IPUtils class
Change-Id: I047e099a93203a59093946d336a143d899d0271f
2020-01-01 02:36:49 -08:00
Daimona Eaytoy
dbf0990447 Avoid PHP scalar type juggling in includes/ (part 2)
Continuation of e5444ea55a.

Change-Id: I9f95e7de4e219dee3abcdd210bb708d949f378d0
2019-12-30 20:57:18 +00:00
Thiemo Kreuz
b39a56d74e Make use of existing array value variables in foreach loops
In all these cases, the foreach() loop specifies a variable for the
current value. We don't need two ways to access the same value. This
makes the code harder to read.

Change-Id: I6ed7a518439963b7091057194de993a7e977be32
2019-12-29 12:04:29 +00:00
Daimona Eaytoy
598c4d7fcb build: Upgrade phan to 0.9.0
Scalar casts are still allowed (for now), because there's a huge amount
of false positives. Ditto for invalid array offsets.

Thoughts about the rest: luckily, many false positives with array offsets
have gone. Moreover, since *Internal issues are suppressed in the base
config, we can remove inline suppressions.

Unfortunately, there are a couple of new issues about array additions
with only false positives, because apparently they don't take
branches into account.

Change-Id: I5a3913c6e762f77bfdae55051a395fae95d1f841
2019-12-07 20:16:19 +00:00
jenkins-bot
2b04ef6657 Merge "Set method visibility for various constructors" 2019-12-05 10:23:34 +00:00
Umherirrender
0688dd7c6d Set method visibility for various constructors
Change-Id: Id3c88257e866923b06e878ccdeddded7f08f2c98
2019-12-03 20:17:30 +01:00
Thiemo Kreuz
78ca9eff4a Remove duplicate variable name from class property PHPDocs
Repeating the variable name doesn't do anything. Documentation
generators don't need it. It's more stuff to read that doesn't add new
information. And it can become outdated.

Note there are two types of @var docs. When used inline (and not on a
class property) the variable name is needed.

Change-Id: If5a520405efacd8cefd90b878c999b842b91ac61
2019-12-02 12:58:29 +00:00
jdlrobson
5128caa3e5 Remove extraneous semicolons in unintended places and DOCUMENT!
The contributions and history page was showing some semicolons in unexpected places.
These unwanted semicolons are now supressed by reverting to a new standalone element
in exactly the same place as the previous semicolon. This avoids the issue of
ordering that we hit before.

I have documented the behaviour of the semicolon separator in contribpager pages
My seemingly harmless change in Ic4508788299a13c4c830f447141d17d99ebe002e

For future generations I have encapsulated what I've learned in extensive
comments which seem important given the information I have acquired while
working on this patch.

Bug: T233649
Change-Id: I9723ead1815685a9cbcccf2c4e2f3ffff36dcee3
2019-11-12 09:24:47 -08:00
jdlrobson
30c98e2351 Semicolon separator for article title and timestamp is a pseudo element
This helps us avoid a stray semicolon in mobile mode.

Bug: T233649
Change-Id: Ic4508788299a13c4c830f447141d17d99ebe002e
2019-11-04 13:49:21 -08:00
Max Semenik
8a98dd9d59 Convert some private static arrays to constants
Remove @since for some private ones as we don't guarantee anything
about private class members.

Change-Id: Ifb898353c02082e9ef69d67f69339345c6cd154d
2019-10-16 01:30:54 +00:00
Daimona Eaytoy
e3412efac3 Unsuppress PhanParamReqAfterOpt, use PHP71 nullable types
These were all checked with codesearch to ensure nothing is overriding
these methods.
For the most part, I've updated the signature to use nullable types; for
two Pager's, I've just made all parameters non-optional, because you're
already forced to pass them with a required parameter at the end.

Bug: T231636
Change-Id: Ie047891f55fcd322039194cfa9a8549e4f1f6f14
2019-10-10 11:53:58 +02:00
jenkins-bot
05ce3b7740 Merge "Title: make newFromText, isValid, and canExist behave consistently." 2019-10-08 13:54:57 +00:00
daniel
9171cbe4ca Title: make newFromText, isValid, and canExist behave consistently.
This patch fixes the documentation of newFromText and makeTitleSafe to
no longer state incorrectly that any Title they return is guaranteed to
be valid. That has never been true.

It also makes canExist() checks a lot stricter, to match the assumptions
of current callers, namely that the title can exist as a wiki page.

Finally, it replaces several existing calls to isValid() with calls to
canExist().

Bug: T229705
Change-Id: I2a483136ec6acca49afb5eb32cb94616672b8fb2
2019-10-08 11:16:11 +02:00
Volker E
203f7aba8c Mark consistently with any edit summaries
Marking with `.comment` to be consistent with `Linker:commentBlock`.

Change-Id: Idba91bd3d1345aa18da6745ad86f1bac2628dae7
2019-09-19 18:06:48 -07:00
jenkins-bot
60882bb6b0 Merge "Log entries can be rendered with parentheses in HTML" 2019-09-20 00:22:16 +00:00
jdlrobson
432cc11fae Log entries can be rendered with parentheses in HTML
Entries such as "User creation log" on Special:RecentChanges can
be wrapped or not wrapped in parentheses

Bug: T219348
Change-Id: Ic764081497dbe8d6d9e5bff6f8a1ceeac4b306e2
2019-09-19 03:58:51 +00:00
Umherirrender
f74400487f phan: Disable enable_class_alias_support
It is enabled for b/c in extensions, but not needed in core

Change-Id: I51dca12be9c77049f77563d9bf0edd07928c2300
2019-09-15 08:26:52 +00:00
jenkins-bot
0705929343 Merge "Remove dead code from RCCacheEntryFactory" 2019-09-14 13:12:52 +00:00
jenkins-bot
f15d6aaa97 Merge "Remove usages of Title::get{Previous,Next}RevisionId" 2019-09-13 22:58:36 +00:00
Petr Pchelko
56c21d059c Remove usages of Title::get{Previous,Next}RevisionId
The methods were deprecated since 1.34.

Change-Id: Ib95ac1ba36a8ffd6b71ed67642d8abb2e3538bae
2019-09-13 09:49:13 -07:00
Matěj Suchánek
bfd32fc842 Remove dead code from RCCacheEntryFactory
Change-Id: I7832bac1e9c700e4a2a37b765d257ce8a7ace458
2019-09-13 11:51:52 +02:00
Daimona Eaytoy
a4327ec8c8 changes: Fix wrong typehint
Fortunately the method is private.

Change-Id: Ic3838f1269c99b9679c7552bcb7b049f0b8e7b6f
2019-09-12 10:57:34 +00:00
Brad Jorsch
c29909e59f Mostly drop old pre-actor user schemas
This removes most of the pre-actor user and user_text columns, and the
$wgActorTableSchemaMigrationStage setting that used to determine
whether the columns were used.

rev_user and rev_user_text remain in the code, as on Wikimedia wikis the
revision table is too large to alter at this time. A future change will
combine that with the removal of rev_comment, rev_content_model, and
rev_content_format (and the addition of rev_comment_id and rev_actor).

ActorMigration's constructor continues to take a $stage parameter, and
continues to have the logic for handling it, for the benefit of
extensions that might need their own migration process. Code using
ActorMigration for accessing the core fields should be updated to use
the new actor fields directly. That will be done for in a followup.

Bug: T188327
Change-Id: Id35544b879af1cd708f3efd303fce8d9a1b9eb02
2019-09-09 11:38:36 -04:00
Daimona Eaytoy
b5cbb5ab3f Upgrade phan config to 0.7.1
This allows us to remove many suppressions for phan false positives.

Bug: T231636
Depends-On: I82a279e1f7b0fdefd3bb712e46c7d0665429d065
Change-Id: I5c251e9584a1ae9fb1577afcafb5001e0dcd41c7
2019-09-04 08:20:53 +00:00
Daimona Eaytoy
c659bc6308 Unsuppress another phan issue (part 7)
Bug: T231636
Depends-On: I2cd24e73726394e3200a570c45d5e86b6849bfa9
Depends-On: I4fa3e6aad872434ca397325ed7a83f94973661d0
Change-Id: Ie6233561de78457cae5e4e44e220feec2d1272d8
2019-09-03 17:19:21 +00:00
Daimona Eaytoy
327e8ea416 Unsuppress phan issues part 6
Bug: T231636
Depends-On: I50377746f01749b058c39fd8229f9d566224cc43
Change-Id: I2cd24e73726394e3200a570c45d5e86b6849bfa9
2019-09-01 09:48:45 +00:00
Daimona Eaytoy
e2e543f7c2 Unsuppress more phan issues (part 5)
Bug: T231636
Depends-On: I6e5fba7bd273219b1206559420b5bdb78734aa84
Change-Id: I50377746f01749b058c39fd8229f9d566224cc43
2019-09-01 09:48:31 +00:00
Daimona Eaytoy
e70b5b3309 Unsuppress other phan issues (part 4)
Bug: T231636
Depends-On: I58e67c2b38389df874438deada4239510d21654f
Change-Id: I6e5fba7bd273219b1206559420b5bdb78734aa84
2019-08-31 17:13:39 +00:00
Petr Pchelko
f1914810a7 Remove usages of Title::quickUserCan
Change-Id: Ifa53e0ec800e23dc4184d133a100fb9378dfee9e
2019-08-29 11:48:30 -07:00
Daimona Eaytoy
f18af0b61f Remove more Oracle and Mssql leftovers
Follows-up 4d10bb14e8 and 807d793ab9.

According to codesearch [0], these were the last usages. Note that this
patch leaves two constants in places, IDatabase::DBO_SYSDBA and
DBO_DDLMODE. These are public constants used "mostly for oracle" according
to the docs, but maybe we could find other use cases in the future (?).

[0] - https://codesearch.wmflabs.org/core/?q=oracle%7Cmssql&i=fosho&files=%5C.%5B%5Ej%5Cd%5D%7Cen%5C.json&repos=

Bug: T230418
Change-Id: Ibfb748b4b23b885a77f4de161af4bf2ab9649a89
2019-08-25 17:21:49 +00:00
jenkins-bot
36fdf484e9 Merge "Replace User::isAllowed with PermissionManager." 2019-08-21 08:00:33 +00:00
Petr Pchelko
1d286560d2 Replace User::isAllowed with PermissionManager.
Covers root includes, actions, api, block, changes,
changetags, diff and PermissionManager itself.

Bug: T220191
Change-Id: Ic027d32f5dd8f4c74865df0c8a9fcf91123c889c
2019-08-20 14:43:51 -07:00
Stephane Bisson
04f0b682a5 RCFilters: add namespace filters for all contents and all discussions
These filters provide a shortcut to see or highlight all entries associated
with a subject or a talk namespace.

They are defined as real filters on the client-side and are superset
of all other namespace filters.

They are expanded to the list of namespaces they represent on the server-side.

Bug: T201520
Change-Id: Id9e04a38c2d7c8165c27af98959aa5715225faa8
2019-08-15 13:57:02 -04:00
jenkins-bot
c698fe313e Merge "Clean up spacing of doc comments" 2019-08-05 22:51:10 +00:00
Umherirrender
2664eeb632 Clean up spacing of doc comments
Align the doc stars and normalize start and end tokens

Change-Id: Ib0d92e128e7b882bb5b838bd00c74fc16ef14303
2019-08-05 22:29:50 +00:00
jdlrobson
2336c51488 Improve log entries display in change lists
Log entries are wrapped with parenthesis - not hardcoded into HTML
causing stray brackets in Minerva where this element is floated.
Has no impact on other skins

In addition to this the entire log entry item is wrapped in a new
span mw-changeslist-log-entry to ensure the text is recognised
as a whole entity - on Minerva floats were leading to the action
and the action object being separated (e.g. uploaded and "File:Name
were separated

Bug: T229360
Change-Id: Idae997b15f68bb0dfcaa857f7458ba3497233d41
2019-08-05 12:23:39 -07:00
Derick Alangi
40c88a6ac9 changes: Avoid use of deprecated method Revision::userCanBitfield()
Revision::userCanBitfield() is deprecated and RevisionRecord should
be used instead.

Change-Id: I0d6ad6863be520d3264809be69532dfb2e3dab9a
2019-08-03 22:43:24 +00:00
jenkins-bot
d1f681a77d Merge "ChangesList: Add $groups parameter to FetchChangesList hook" 2019-07-22 21:45:41 +00:00
jdlrobson
d7f8c45856 ChangesList: Add $groups parameter to FetchChangesList hook
This parameter is needed for consumers trying to return a $list object.

Bug: T228280
Change-Id: Ib68ff8fa782ac12479ef02247cdf78e405b64bad
2019-07-22 21:31:40 +00:00
Derick Alangi
b33fb102d1 changes: Usage of 'noudp' & 'pleasedontudp' no longer exist
Since no usage exist and this was deprecated in 1.31, should it
be removed?

Now I think with the use of Phan and having $send type hinted to
a bool, if a string is used, phan will catch that? :)

Usage
=====

https://codesearch.wmflabs.org/search/?q=(%27noudp%27%7C%27pleasedontudp%27)&i=nope&files=&repos=

Change-Id: Id0482e69e2e2b1cdf0a9ece230e04323bf51324f
2019-07-22 09:55:57 +01:00
jenkins-bot
0854352fa7 Merge "Do not hardcode square brackets in "rollback link"" 2019-07-21 19:41:24 +00:00
Derick Alangi
c5b7101a15 Avoid usage of deprecated Revision::* constants
Change-Id: Ibb55d5a01f997f9c79bcf2f5e09d4f02d22152d2
2019-07-21 17:26:48 +01:00
Derick Alangi
339211a1ea Avoid usage of deprecated Revision::* constants, use RevisionRecord
Change-Id: I872fc89e5c02dd6a3ae9cd7e76640b95dc33f514
2019-07-21 15:03:03 +01:00
jdlrobson
aaea6a0fc0 Do not hardcode square brackets in "rollback link"
Additional change:
* standardize on "optional" lowercase in qqq messages

Bug: T219948
Change-Id: I7d79c0ca534bff7165975943d5fa22dfe0a616db
2019-07-18 14:30:23 -07:00
jenkins-bot
67d01c452d Merge "Tolerate invalid titles in some ChangesFeed and LogFormatter code" 2019-06-24 23:29:11 +00:00