Commit graph

490 commits

Author SHA1 Message Date
DannyS712
93e278b5db Hard deprecate Revision::getSerializedData
Bug: T246284
Change-Id: I49ac11b4f952b2494349cc49360501dd3bfc2c90
2020-03-31 16:33:04 +00:00
DannyS712
a96fd717a7 Hard deprecate Revision::getRecentChange and ::getTextId, both unused
Bug: T246284
Change-Id: I10197231642b45ad60e4588f94edad2bacf2f46e
2020-03-31 02:38:27 +00:00
DannyS712
9dd9b0cb46 Hard deprecate Revision::setUserIdAndName
Bug: T246284
Change-Id: I97d476bbffac99f8169e13a3f7c1dfca967be8ea
2020-03-30 16:10:53 +00:00
DannyS712
aff1cfd0b0 Hard deprecate Revision::isUnpatrolled
Bug: T246284
Change-Id: I5817ec0041cb2119a5febc8dd57f66700743e752
2020-03-27 19:35:33 +00:00
DannyS712
1d4df4f221 Hard deprecate Revision::getQueryInfo and ::getArchiveQueryInfo
Bug: T246284
Change-Id: I708f265aac3016e34d02936cf5dff98a3036ef0f
2020-03-26 23:53:19 +00:00
DannyS712
3e69804595 Hard deprecate fallbacks to $wgUser in Revision::get methods
Affected are ::getUser, ::getUserText, and ::getComment

Bug: T248291
Change-Id: Ia7aecca1bae094b71f83e0c79dd75b6de927d962
2020-03-26 03:18:15 +00:00
jenkins-bot
839c9f8d6e Merge "Hard deprecate Revision::userWasLastToEdit" 2020-03-26 02:04:32 +00:00
jenkins-bot
727c9e6d32 Merge "Hard deprecate Revision::base36Sha1" 2020-03-26 01:25:52 +00:00
DannyS712
ecf7f3fb28 Hard deprecate Revision::userWasLastToEdit
Bug: T246284
Change-Id: I908dd6025a2a78edf7d3c3661f540aeb498c4bad
2020-03-26 01:17:25 +00:00
DannyS712
90eb2dc46d Hard deprecate Revision::base36Sha1
Bug: T246284
Change-Id: I12b80940358ea2f941483b5edf74e8c8472ace31
2020-03-25 21:11:37 +00:00
DannyS712
b9bd99825c Hard deprecate Revision::setTitle
Only one remaining use, not deployed, patch pending at
I0b088f5851cf63b2bb0ff1d7127e2fbefcd2c62e anyway

Bug: T246284
Change-Id: I40e26ee669fd914db781fb3ace8e21148fb5c108
2020-03-25 20:50:05 +00:00
Petr Pchelko
aa1ea49a51 Hard deprecate Revision::loadFromTimestamp
Bug: T246284
Depends-On: Ia8d49b3158baf578ccd3476d6537be36dcea7e13
Change-Id: Ic4df02a7e21d4d1c0140e0f5a985a90f66983fab
2020-03-25 12:21:02 -07:00
Petr Pchelko
b3ab937939 Deprecate Revision::loadFromPageId
Bug: T246284
Depends-On: Id4ec83cc0ac0685857064486697a7daed979ea69
Change-Id: I5de750322e30052700f509d2908456ebd5be95ef
2020-03-25 12:10:48 -07: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
jenkins-bot
bdd722e310 Merge "Remove compat code for pre-MCR schema." 2020-03-25 18:19:33 +00:00
jenkins-bot
9e238b9670 Merge "Hard deprecate Revision::getTimestampFromId" 2020-03-24 21:04:46 +00:00
daniel
495323c063 Remove compat code for pre-MCR schema.
NOTE: This was manually tested to ensure it does not
break updates, see T242764.

Bug: T198557
Change-Id: I1d9f5465018bae10124514bc38169e23e0e613e6
2020-03-24 19:45:47 +01:00
Petr Pchelko
618236d204 Hard deprecate Revision::newFromPageId
Bug: T246284
Depends-On: I955d9c3478eb5278bdc807d11aab04e8e051d22f
Change-Id: I01ac581234980c6e7dbf916558c231ab648cbbae
2020-03-18 17:18:58 -07:00
Petr Pchelko
ebd35bdc85 Hard deprecate Revision::getParentLengths
As well hard-deprecate RevisionStore::listRevisionSizes.
It was marked as @deprecated, but the release for the
deprecation was not specified. Let's say it's 1.35.

Additionally, in order to avoid temporary code duplication,
listRevisionSizes now uses getRevisionSizes and ignores the
database object injected into it. This is ok since we're
hard-deprecating the method and all the usages have been
removed.

Bug: T246284
Change-Id: Ifad1c25a0af892b88fce492b2d34c8cf71279b70
2020-03-18 12:26:26 -07:00
Petr Pchelko
1e4beb3107 Hard deprecate Revision::newKnownCurrent
Bug: T246284
Change-Id: Iba93fdeb0a88e6fa4068f03367b23a1f670257c6
2020-03-18 11:52:44 -07: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
Petr Pchelko
bd12ef3168 Hard deprecate Revision::getTimestampFromId
Bug: T246284
Depends-On: If2f07de101baf2a007da61d3cfb617f35c61a957
Depends-On: I852af2f19cbd1df0f9137e0f75ed7a272a54a169
Change-Id: I585fe3f7c3cf0081934c170a8600da2ec715a2d7
2020-03-03 18:21:43 -08:00
DannyS712
77d503db09 Remove Revision::loadFromId(), deprecated and unused
Bug: T242311
Change-Id: I0c8fe834da79cb6db3c2268df50ba460fa97d981
2020-03-01 09:12:30 +00:00
DannyS712
48f7580a68 Hard deprecate Revision::countByTitle
Part of the soft deprecated revision class, no known callers

Bug: T246284
Change-Id: I56c15a8d41f56cae18240e069f29e6801eafb64f
2020-02-29 03:24:25 +00:00
DannyS712
0f9fc7b76f Hard deprecate Revision::countByPageId
Part of the soft deprecated revision class, no known callers outside of a test, which hide the deprecation

Bug: T246284
Change-Id: I7b80c7e51e26845d2703d1dc5434baf9d0744d11
2020-02-29 03:23:55 +00:00
DannyS712
2efa4b69a9 Hard deprecate Revision::loadFromTitle
Part of the soft deprecated revision class, no known callers outside
of EditPage, which is updated, and tests, which hide the deprecation

Bug: T246284
Change-Id: I099cb93a12f3a1d9a720e18e3236374321ce7b0c
2020-02-28 19:10:17 -08:00
DannyS712
d3aa888904 Hard deprecate Revision::userCanBitfield
Also replace uses. Some callers had a user that could be null;
RevisionRecord::userCanBitfield requires a user, so add $wgUser
fallbacks at the callers with soft deprecations for using them,
and will hard deprecate in a subsequent task.

Bug: T245958
Change-Id: I137e21e3883b149fdd98d1b59d4e498d15b39dd9
2020-02-24 21:18:49 +00:00
DannyS712
b3451ba87a Use __METHOD__ instead of __FUNCTION__
Follow up to I8990bc16

Change-Id: Id6435add2eea34ee8f79b70df152d08c3fb29ce1
2020-02-20 03:08:51 +00:00
DannyS712
328f093458 Deprecate falling back to $wgUser in some functions
Not passing a user to the following functions is deprecated:
* Title::getNotificationTimestamp
* Revision::newNullRevision
* WikiPage::insertProtectNullRevision
* PatrolLog::record
* LogEventsList::userCan
* LogEventsList::userCanBitfield
* LogEventsList::userCanViewLogType
* LogPage::addEntry

Bug: T242935
Bug: T243652
Change-Id: I8990bc16ac72680fb65f8ca37eb7908749a9e5cc
2020-02-19 21:43:46 +00:00
ArtBaltai
30e54b3962 Introduce ContentHandlerFactory
Added:
- ContentHandlerFactory
Tests:
- PHPUnit
Changed
- Calls of changed and deprecated
- DI for some service/api
Deprecated:
- ContentHandler::* then similar to ContentHandlerFactory
- ContentHandler::getForTitle
- ContentHandler::$handlers

Bug: T235165
Change-Id: I59246938c7ad7b3e70e46c9e698708ef9bc672c6
2020-02-07 00:53:51 +03:00
James D. Forrester
4f2d1efdda Coding style: Auto-fix MediaWiki.Classes.UnsortedUseStatements.UnsortedUse
Change-Id: I94a0ae83c65e8ee419bbd1ae1e86ab21ed4d8210
2020-01-10 09:32:25 -08:00
jenkins-bot
ad63f697e1 Merge "Set method visibility in some classes" 2019-12-09 16:34:27 +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
Umherirrender
925e3eb30b Set method visibility in some classes
Change-Id: I3c3d59d4b3edf2459efeac890721a43475e27198
2019-12-05 17:42:55 +00:00
Umherirrender
337ecb0514 Add missing @param and @return to documentation
Change-Id: Ibc5849cc8ea7e7c4eb30ded9c1cfa5f52187c377
2019-11-10 22:12:58 +00:00
Max Semenik
bdf7e3f5bd Set constant visibility, part 1
Change-Id: I3dad26b1a0bd469fa84fee5c15d9b581765ceb94
2019-10-18 02:19:24 +00:00
Petr Pchelko
06bfc74034 Hard deprecate Revision::getRevisionText() method
Bug: T198343
Depends-On: Ibc943d757b97c144296e7116c1f9caf944c7f345
Depends-On: Ic799aa2dbe26de2e0cbe2be6218341a44ae051e8
Change-Id: I13b737b33b087d92f8ce86a34de6ca0931baa222
2019-10-07 11:31:20 -07:00
Aaron Schulz
a5c7fd0db2 Move callers away from Title::GAID_FOR_UPDATE
These callers just need to load some data from DB_MASTER.
Subsequent code needing that latest title data should also use the
required flags, rather than relying on flakey global cache state.

Change-Id: I53248ea4b5bf1cd953f956c41b8244831ec5ef04
2019-09-09 13:19:08 -07: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
43cc14657d Unsuppress phan issues, part 8
And also clean up the config.

Bug: T231636
Depends-On: Ie6233561de78457cae5e4e44e220feec2d1272d8
Change-Id: I82a279e1f7b0fdefd3bb712e46c7d0665429d065
2019-09-04 01:02:06 +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
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
Aaron Schulz
cb15755e92 Normalize use of "INNER JOIN" to "JOIN" in database queries
The ANSI SQL default join type is INNER and this might save
some line breaks here and there.

Change-Id: Ibd39976f46ca3f9b71190d3b60b76ca085787a00
2019-03-06 09:17:30 -08:00
jenkins-bot
3110946330 Merge "Fix documentation for Revision::getComment and WikiPage::getComment" 2019-02-16 10:59:48 +00:00
Kunal Mehta
cc5d9a92a2 build: Updating mediawiki/mediawiki-codesniffer to 24.0.0
Change-Id: I66b1775b7c1d36076d9ca78cbeb42787a743f2aa
2019-02-07 18:39:42 +00:00
Thiemo Kreuz
960a1acd5a Use shorter ?: syntax in Revision class
This is semantically the same because the returned object can't be
anything but an object (which can never be false), or null. Personlly,
I find the more expressive "=== null" check does not help here, but
makes the code a little harder to read.

Change-Id: Ib7390a7680f24fec7f5b9cea716603c14ad3f2dd
2019-02-04 18:42:13 +00:00
Max Semenik
25c3a843b0 Remove Revision::fetchRevision()
Deprecated in 1.28, hard deprecated since 1.31. No callers, never had
callers outside of core.

Change-Id: I39721d12ad0d221931d23f2807f0a87cf05f0e3a
2019-01-30 15:43:30 -08:00
Thiemo Kreuz
c3dfa88966 Add missing empty lines between methods
This might hint at an edge-case in the PHP CodeSniffer sniff that should
detect if methods are separated by a single empty line. Feel free to
investigate. I, personally, can't invest more time in this than
suggesting this quick fix.

Change-Id: Ib3c60eac76f255b4fe929f7933de256222716576
2019-01-15 19:14:35 +00:00
Thiemo Kreuz
631be0b64d Fix documentation for Revision::getComment and WikiPage::getComment
This mismatch between the documentation and how the code behaves was
introduced via Ia4c20a9 in December 2017. The getComment() methods have
never been documented to return null, but now do.

I tried to fix this both ways (see I32202df for the other approach), but
decided it's easier and cleaner to keep the null. Reasoning:

* The code behaves like this for more than a year already. Removing the
  null would possibly be as desruptive as when it was introduced.

* Removing the null breaks Wikibase.

* I think returning null is the right thing to do.

I did a brief check of all callers of these two methods. I found a few
that might misbehave a little bit when they are confronted with null, e.g.
in MobileFrontend or Echo. In the vast majority of cases the null will be
silently casted to an empty string and be fine. In a few cases a "the
comment is empty" message might disappear, and the null be shown in the UI
instead, possibly resulting in an empty, confusing HTML element. I would
argue this is an issue with the frontend code then. It should not expect
to have access to all comments. Some might be supressed.

Bug: T174025
Change-Id: I0e1ff9686d1d875812460631c29330c398e74bcf
2019-01-15 14:42:17 +01:00
daniel
f4f66368e4 Revision: Assert that $mRecord is never null in Revision
Bug: T187153
Change-Id: I828954855aa24114ec756e45d4dfe1468b2efa27
2018-12-21 23:09:11 +00:00