Now largely automated:
VARS=$(grep -o "'[A-Za-z0-9_]*'" includes/MainConfigNames.php | \
tr "\n" '|' | sed "s/|$/\n/;s/'//g")
sed -i -E "s/'($VARS)'/MainConfigNames::\1/g" \
$(grep -ERIl "'($VARS)'" includes/)
Then git add -p with lots of error-prone manual checking. Then
semi-manually add all the necessary "use" lines:
vim $(grep -L 'use MediaWiki\\MainConfigNames;' \
$(git diff --cached --name-only --diff-filter=M HEAD^))
I didn't bother fixing lines that were over 100 characters unless they
were over 120 and triggered phpcs.
Bug: T305805
Change-Id: I74e0ab511abecb276717ad4276a124760a268147
* Indicate whether a class is a service (to be found via MediaWikiServices)
or a lower-level class for certain backend logic.
* Indicate how to create / where to get instances of non-service classes,
e.g. point to the relevant service.
* Remove copy-pasta text in file docblock that is unrelated,
and incorporate any relevant text into the class docblock instead.
Change-Id: Ia3b9b8c22da4d7160c5e14ae6a6a7c9dca30e9db
Use name constants instead of string literals in calls to Config::get
and ServiceOptions::get, when referring to core configuration variables.
This protects against typos and makes the decumentation and schema
declaration of the config settings discoverable.
This is the first batch, only touching files directly under /includes/
Change-Id: I7252e636c7c86d950d9257b33491af492c6dd5eb
Instead of relying on the source page existence.
Also clean the integration test up a bit and avoid
passing null where string is expected.
Bug: T47348
Change-Id: I15ef9fcedb4b3f5ecc253095e07ceaffe9630b17
The functions returning null or the class property is set explict null.
Some function should not accept null or return null.
Found by phan strict checks
Change-Id: Ie50f23249282cdb18caa332f562a3945a58d86ff
Instead of returning two different classes from the method, return the Status object only and hide any additional information in its value. This allows us to propagate all additional information we need together with the result.
Change-Id: I5c2bd3f0eb91a225d127fb06101ecfb62dbffa07
Since LinksUpdate was already run after a page move, it was just a
matter of propagating a move flag down to it, and resolving the
differences between the move case and the edit case.
This should be faster since it avoids writing to the links tables twice
on a page move.
Change-Id: Ifaa4051a736b01cda82fbd890325e0751ce041f8
Avoid delete of non existing rows which sets gap locks.
For PageUpdater::doCreate: When creating a new page it is known there is
no row in the redirect table, but a "DELETE FROM redirect WHERE page_id
= new page" is running within the open transaction and sets a gap lock
for "last page id in redirect" until unlimited. A redirect page creation
from another user now wants to insert and has to wait for release of the
lock, because it has a page id, which is in the locked gap. That can
result in timeouts for page creation.
For MovePage::moveToInternal: When a normal page is moved it is known
there is no row in the redirect table, but the page move is issue a
delete + gap lock and a parallel move with a page id in that range can
get a deadlock.
Bug: T120140
Change-Id: I5ddfdb690e0cc33b178b5fdcc01ffb6220911fa8
WikiPage::doEditUpdates() has been deprecated. Using the PageUpdaterFactory's
newDerivedPageDataUpdater() is the new way forward. Also, I made sure to have
the `$options` array with the `causeAction` and `causeAgent` key/value pairs.
Change-Id: I9f2c212d7c83a46799f9f947dc372dc364289680
After parent patch MovePage changed code is covered
by tests, plus tested locally quite a bit. Seems to work.
Change-Id: I0f8db203eb4aa767e5e1f3067f3a9e35835f38ea
Use ObjectFactory specs for collation classes
Avoid the language construction in the factory class,
make it a detail of the implementation of each class
Follow-Up of Ifc96f851e6091ce834dbaf0e91695c648a42169c
Bug: T286079
Change-Id: Ib581f64aec8619986fb8dd49ceee0524d59a1b84
Updates for the removal of the Revision class itself
and the various methods/hooks/variables removed in the
process, including:
- Update some documentation removing most references
to the Revision class and updating the MCR migration
notes to reflect the past tense for Revision methods.
- Change some capitalization from "Revision" to "revision"
to make it clear comments are about revisions in general,
not the Revision class in particular.
- Minor code tweaks including removing unused variables that
were around for the old hooks that were removed, and
removing the use of DeprecatablePropertyArray where no
longer needed for anything.
- Fix incorrect documentation for PageUpdater::getStatus(),
the status value changed a while ago to have revision-record
in addition to revision, and recently to only have the
revision-record, but ironically PageUpdater was never updated.
- Removed Parser::$mRevisionObject, used to be a Revision object
and was deprecated in 1.35, missed earlier because it was no
longer being set to Revision objects, always null.
- Add RevisionRecord typehints in DummyLinker to match those
in the corresponding Linker methods
This should be a no-op in terms of functionality.
Bug: T247143
Change-Id: I03bbb94fc29085855448780b1a5ad9063911ecc4
- UserEditCountUpdate: accept UserIdentity instead of User
- Move User::incEditCount() to UserEditTracker
Change-Id: Ibf1482bcbcbf4d56fc06531bb3e17e2a6e3e2e6f
Clear all caches to make sure no stale information is used
when parsing the newly created redirect. Without this, moves would fail
under certain conditions when Lua core runs on the new page.
It is not entirely clear why this is needed, but it seems to fix the
issue when I tried it on mwdebug.
Bug: T279832
Change-Id: I222fe577c907aa9e6ac9accc597b3a1e45c9d7cc
All hooks were previously hard deprecated
in 1.35. Affected hooks:
* ArticleRevisionUndeleted - use RevisionUndeleted
* ArticleRollbackComplete - use RollbackComplete
* DiffRevisionTools - use DiffTools
* DiffViewHeader - use DifferenceEngineViewHeader
* HistoryRevisionTools - use HistoryTools
* NewRevisionFromEditComplete - use RevisionFromEditComplete
* PageContentInsertComplete - use PageSaveComplete
* PageContentSaveComplete - use PageSaveComplete
* ParserFetchTemplate - use BeforeParserFetchTemplateRevisionRecord
* RevisionInsertComplete - use RevisionRecordInserted
* TitleMoveComplete - use PageMoveComplete
* TitleMoveCompleting - use PageMoveCompleting
* UndeleteShowRevision - no replacement
Includes a fix for setting the associated rev id
of page protections, which previously was only done
using $nullRevision which was a Revision object created
if any hooks needed it; those hooks were hard deprecated
and so for WMF prod the rev id was not being set.
Bug: T247143
Depends-On: Idfa345193ae99fb2f1c9a8f8d28d8d540a6e3d62
Change-Id: I519167f76a5a3c1f5410415b2721462a3dcc3ec8
This is micro-optimization of closure code to avoid binding the closure
to $this where it is not needed.
Created by I25a17fb22b6b669e817317a0f45051ae9c608208
Change-Id: I0ffc6200f6c6693d78a3151cb8cea7dce7c21653
Throwing exception is not appropriate here and will prevent proper usage
of ArticleDeleteHook, which is ostensibly meant to allow extensions to
cleanly abort the deletion if they need to.
When the target page deletion fails, instead of blowing everything up
with exception, just cancel the open atomic section and return the
user-friendly deletion error back to the user.
Bug: T265779
Change-Id: I66b4458a103f1274715e22a784344c55a62a59ac
This is the last check before moving and update the title on the page
table. Be sure to delete the page too avoid duplicate entry on the
index.
Change-Id: I75582a13bd1feedc072ea8d044470e445a9f6730
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
These were never meant to be part of the public interface and should not
ever have been marked with @since. They're only useful for constructing
the respective objects, which no outside users should be doing.
Change-Id: I86e01272d46fc72af32172d8a12b9180971d4613