aboutsummaryrefslogtreecommitdiffstats
path: root/includes/import
Commit message (Collapse)AuthorAgeFilesLines
* Use type declaration on undocumented private functionsUmherirrender2025-04-021-1/+1
| | | | Change-Id: I0d8d2237500ed6f18439410c902d47c42e4119bc
* Replace a number of uses of class aliases with the real thingsJames D. Forrester2025-03-262-0/+2
| | | | | | | Found via disabling phan's alias support for a run (and ignoring wgLang's hard-coded state of being a \Language, alas). Change-Id: I4753bcd84d72d6de111fc7ffc5841fa417bf7333
* Namespace all remaining files in includes/exceptionJames D. Forrester2025-03-251-0/+1
| | | | | | | | | In MediaWiki/Exception, to follow PSR-4 per plural vs. singular (this can be changed later if people really care). Also, move the couple of exceptions in here that were already namespaced in the MW-top-level into the new space. Bug: T353458 Change-Id: I12ed850ae99effb699a6d7ada173f54e72f0570e
* DomainEvents: Rename PageEvent and PageUpdatedEventdaniel2025-03-111-3/+3
| | | | | | | | | | | | Why: - clarify naming after modeling discussions What: - Rename PageEvent to PageStateEvent - Rename PageUpdatedEvent to PageRevisionUpdatedEvent. Bug: T388588 Change-Id: I987c93a443d364782e692e2cf71b878ccbc5a2fa
* PageUpdatedEvent: improve modeling of flagsdaniel2025-02-201-1/+1
| | | | | | | | | | | | | | | | Why: - Improve consistency, naming, documentation and definition of flags. What: - remove direct access to flags, provide a separate getter for each flag instead. - Deprecate EDIT_SUPPRESS_RC in favor of EDIT_SILENT - Introduce EDIT_IMPLICIT to replace "automated" mode - Introduce FLAG_RECONCILIATION_REQUEST into PageEvent. - Introduce isReconciliationRequest into DomainEvent. Bug: T383552 Change-Id: I2bffbb5810376829f871e1840ca799a8d8232dda
* Merge "Dummy revisions: add tests for event emission"jenkins-bot2025-02-131-1/+1
|\
| * Dummy revisions: add tests for event emissiondaniel2025-02-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | Why: before we change how we do dummy revisions, we should have tests in place that check which events and hooks get fired, and how updates to other parts of the system propagate when dummy revisions are inserted. This protect us from unexpected changes in behavior. Bug: T198297 Bug: T384691 Change-Id: I1f8c0ac68b91f101699fe9a9cf9ccbada514030a
* | Merge "Replace call_user_func with dynamic function call"jenkins-bot2025-02-131-3/+3
|\ \
| * | Replace call_user_func with dynamic function callUmherirrender2025-02-131-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | Use modern php syntax to call a callable. Reduce the stack trace to improve performance and better IDE and static analyzer support Change-Id: I9ef131032a662a3b8db69aa7079dbd51f88f575a
* | | Merge "Replace call_user_func_array with dynamic function call"jenkins-bot2025-02-121-13/+4
|\ \ \ | |/ / |/| |
| * | Replace call_user_func_array with dynamic function callUmherirrender2025-02-031-13/+4
| |/ | | | | | | | | | | | | | | | | Use modern php syntax to call a callable. Reduce the stack trace to improve performance and better IDE and static analyzer Also replace func_get_args with variables Change-Id: Ie193c4e996ab136e08f1e16c988448d054520aa7
* / Use $string === '' instead of strlen( $string ) === 0Fomafix2025-01-301-2/+2
|/ | | | | | | | | Add $string === false or $string === null where $string can have other types than a string. Also document null as possible return value in FileRepo. Change-Id: Iaa29ba01c3fd6bea506debdc6f929edfe881c808
* PageUpdatedEvent: explicitly model cause and performerdaniel2025-01-211-3/+3
| | | | | | | | | | | | | | | | | | | | | This introduces the concept of a "cause" and "performer" into PageUpdatedEvent. Causes are e.g. "edit" or "import" or "move". The performer is the same as the author for edits, but not necessarily for undeletions, moves, etc. Note that cause and performer were already being tracked in DerivedPageDataUpdater for logging purposes. PageUpdatedEvent was modeling the cause using flags. This change formalizes the concept of "cause" and "performer" and ensures it is handled consistently. As an aside, this simplifies some test cases in DerivedPageDataUpdaterTest to avoid confused state. Bug: T383031 Bug: T383095 Change-Id: I79bde5604790636c91848f265fffd81d6348a8b4
* DomainEvent: Support type hierarchiesdaniel2025-01-211-1/+1
| | | | | | | | | | | | | | Why: - It's useful to be able to listen to sets of compatible event types. What: - Make DomainEvents aware of a list of types they are compatible with. - Make EventDispatchEngine dispatch to all compatible listeners, registered for any of the supported types. - Move all page events to their own namespace Bug: T384330 Change-Id: I96bde2cfaf198e409a6ef3a24101ee7d02d57959
* Remove trivial 1-line PHPDocs that just repeat the codethiemowmde2025-01-161-3/+0
| | | | | | | | | | | | | I assume these are all either auto-generated by an IDE or the language-level type declarations have been added later. In any case the comments don't add any new information to what the code already says. This is just extra clutter that makes the code harder to read, I would argue. There are many, many more comments like this. In this patch I intentionally focus on the most trivial 1-line comments. Change-Id: Ia294bf4ce0d8a77036842fe25884bc175c2b0e7d
* Replace isset() with falsy checksUmherirrender2024-12-191-6/+6
| | | | | | | | | isset() should only be used to suppress errors, not for null check. When the property is always defined, there is no need to use isset. Found by a new phan plugin (2efea9f989) https://www.mediawiki.org/wiki/Manual:Coding_conventions/PHP#isset Change-Id: I186e799256fbaf5ee77558bd146f9418dd5eaacc
* Import: ensure PageUpdatedEvent has the correct properties.daniel2024-12-131-7/+5
| | | | | | | | | | | | Previously, PageUpdatedEvents emitted by ImportableOldRevisionImporter were always reporting a page creation, even if the page already existed. The reason is that DerivedPageContentUpdater::prepareUpdate() relies on $options['oldrevision'] to be supplied by the caller if grabCurrentRevision() wasn't called. ImportedOldRevisionImpoter was doing neither. This change ensures that they correctly report the revision that was current before the import by making the importer call grabCurrentRevision(). Note that prepareUpdate() cannot just call grabCurrentRevision(), because it's called after the current revision was already updated, so the old revision and new revision would end up being the same. Change-Id: I2d0108ac62dba67f2cf5bbfde431e570195ee3f6
* Ensure necessary updates are performed on import and undeletedaniel2024-12-121-0/+4
| | | | | | | | | | | | | | | | | | | | | | In Ice76519 we lost the mechanism for triggering updates for the search index and message cache on import and undeletion. This change restores the trigger for these updates. To achieve this, the logic for instantiating PageUpdatedEvents is moved into DerivedPageDataUpdater. Perhaps the firing of the event can be moved into that class eventually. To improve consistency, the flags field in PageUpdatedEvent is changed from a bitmap corresponding to the flags field in PageUpdater to an array corresponding to the options array in DerivedPageDataUpdater. For regression testing, this change defines new test traits, one for each ingress. These traits define the expected behavior of each ingress in each relevant situation (edit, move, import, and undeletion). Bug: T381225 Bug: T381299 Change-Id: Ib0d1dd143160fb64d42cacfbc75fbb55f5614c1c
* Add type hints to detect bool/null message paramsBartosz Dziewoński2024-11-141-1/+5
| | | | | | | | | | | | Add more precise type hints to every method I could find that takes message params as arguments, so that Phan will warn if bool or null is passed, which is deprecated (T378876). Errors found in this repository thanks to these checks are fixed in I286a4a51e879bdf61f65c87dc078621c51045bee. Bug: T378876 Change-Id: I3e0df790ff9db2fa630f82408a7254a359fe61ca
* Use namespaced classesUmherirrender2024-10-215-0/+5
| | | | | | | Changes to the use statements done automatically via script Addition of missing use statement done manually Change-Id: I73fb416573f5af600e529d224b5beb5d2e3d27d3
* Merge "Use explicit nullable type on parameter arguments"jenkins-bot2024-10-162-4/+4
|\
| * Use explicit nullable type on parameter argumentsUmherirrender2024-10-162-4/+4
| | | | | | | | | | | | | | | | | | | | | | Implicitly marking parameter $... as nullable is deprecated in php8.4, the explicit nullable type must be used instead Created with autofix from Ide15839e98a6229c22584d1c1c88c690982e1d7a Break one long line in SpecialPage.php Bug: T376276 Change-Id: I807257b2ba1ab2744ab74d9572c9c3d3ac2a968e
* | Replace uses of deprecated ChangeTags static methodsJames D. Forrester2024-10-161-1/+1
|/ | | | | Bug: T360664 Change-Id: I3363a225e54bb2cae01ba066d432a8b7b21933d2
* Add namespace to maintenance/includes classesJames D. Forrester2024-10-092-0/+2
| | | | | | | Also a few other fixes of PHP class aliases spotted by phan. Bug: T353458 Change-Id: Ie79d65722c47c24f8f20f1293355cfd3c2e8c2ad
* Add namespace to IDBAccessObject and DBAccessObjectUtilsJames D. Forrester2024-09-273-0/+3
| | | | | Bug: T353458 Change-Id: I23cf7991f8792d4d000d1780463d8ce76dc0aee0
* Replace User, Title, and WikiPage in more signaturesDaimona Eaytoy2024-07-101-3/+3
| | | | Change-Id: I04e408e734edc5498c32c4433f02da613bbfafa6
* ImportableUploadRevisionImporter: Mark downloadSource() as private, missed ↵James D. Forrester2024-05-021-6/+1
| | | | | | when caller removed in 1.40 Change-Id: I02ef2144dc6ead8c9232b20bd8e4647779b11ff4
* docs: Adjust all @deprecated tags to use 'since…' for consistencyJames D. Forrester2024-05-011-1/+1
| | | | | | | | This skips ones that have been marked but were never in the then RELEASE-NOTES and later HISTORY file, and so weren't properly deprecated ever. Change-Id: I31df2d7e83182b5bf9524237fc4a1862356bfd5a
* Update name & email for bvibberBrooke Vibber2024-02-086-6/+6
| | | | | | | | | | | | | Updating name & email addresses for Brooke Vibber. Re-ran updateCredits.php as well so there are some new entries in there as well. There are a couple of files in resources/libs that will have to be changed upstream to keep tests happy, I will do patches later. :D Change-Id: I2f2e75d3fa42e8cf6de19a8fbb615bac28efcd54
* Namespace includes/contextJames D. Forrester2024-02-082-0/+2
| | | | | Bug: T353458 Change-Id: I4dbef138fd0110c14c70214282519189d70c94fb
* Remove more indirect calls to IDBAccessObject::READ_* constantsAmir Sarabadani2024-01-233-4/+4
| | | | | | | | | | Found via (?<!IDBAccessObject)::READ_ We are planning to deprecate and remove implementing IDBAccessObject interface just to use the constants. Bug: T354194 Change-Id: I89d442fa493b8e5332ce118e5bf13f13b8dd3477
* Change uses of getDBLoadBalancerFactory() to getConnectionProvider()Bartosz Dziewoński2024-01-221-1/+1
| | | | | | | | | | | | Update cases where one of the IConnectionProvider methods is called immediately. This doesn't really change anything, but I hope it helps promote getConnectionProvider() as the common way to do this. Follow-up to 8604c384f624273f46b653ec252ffaed30e6ff89. Change-Id: Id0e7d02bab0c570343c2b1f03c70b44ee39db112
* Replace more instances of deprecated MWExceptionDaimona Eaytoy2024-01-191-9/+6
| | | | | Bug: T328220 Change-Id: Iba90f7f9b5766bccc05380d040138d74d5e9558a
* Migrate remaining Database::insert calls to InsertQueryBuilderAmir Sarabadani2023-12-221-11/+12
| | | | | | | | | Tests are not checked. There is nothing left as far I can check. Bug: T353219 Change-Id: I1d58397118c7ab1110b9d7cf400c59c4bff7378c
* Inline once-called short private methods to its caller, part 1Amir Sarabadani2023-12-181-22/+4
| | | | | | | | | This makes the code easier to read to avoid jumps and improves encapsulation by not allowing the rest of the class having access to the logic. Of course, if needed then some code can be refactored out again but for now let's not do YAGNI. Change-Id: Ic37524e386fc04fd67e33768417ff8425f85b0ca
* WikiImporterFactory: Deprecate getWikiImporter() without performerBartosz Dziewoński2023-12-111-1/+2
| | | | | | | Depends-On: I4ec83fe0a887398a216e2b0392dfa852218fef1e Depends-On: I97622086ee08fa0ff3305ba6683be3b4f43e0921 Depends-On: I5659e34657fa14bd92c3d9d08cc6496595e24264 Change-Id: I670ca6139c356aa775697bfac7096652d371f2cc
* WikiImporter: Pass Authority for permissions instead of global contextBartosz Dziewoński2023-12-112-22/+29
| | | | | | | | | | | | | | | Pass Authority to WikiImporter constructor, instead of looking at the user from RequestContext::getMain(), and skipping this check if $wgCommandLineMode is true. Maintenance scripts now use UltimateAuthority, to match the original intent of skipping permission checks, see 2ed55f42 / r96311. The Authority parameter to WikiImporterFactory::getWikiImporter() is optional for now for backwards-compatibility. It should become required later after deprecation. Change-Id: Iea1d03dcdcbda2f9a9adbff1b0d319efd22c4d86
* WikiImporter: Fix an access to global configBartosz Dziewoński2023-12-081-3/+1
| | | | Change-Id: Ic8e8b84d0285a5c4dffa2cde282905e576b96e5c
* Use real type hints for services etc. in import/Bartosz Dziewoński2023-12-085-153/+35
| | | | | | Also remove redundant doc comments. Change-Id: I2e4eb3f287b6b715dc392811687fdfb9a611b773
* Namespace remaining files under includes/deferredJames D. Forrester2023-11-221-0/+2
| | | | | Bug: T166010 Change-Id: Ibd40734b96fd2900e3ce12239d09becfb4150059
* Migrate off wfGetDB() in more places to ICPAmir Sarabadani2023-11-201-2/+2
| | | | | | | | | | | | | | | | | This function is uber-deprecated, meaning even its replacement is deprecated, We have already migrated in static functions and more. In this batch, all calls have been migrated that there is already a call to MediaWikiServices::getInstance() making the migration easier. Of course in most cases, they should eventually turn into proper service injection but this at least makes it clear what services should be injected. Also removing "category" group since we are removing all groups except a handful from mw (see T263127 for more information). Bug: T330641 Change-Id: I90cd35ee45a37eb6e6bf7a531cc8f75effbd0328
* Replace more single-value $db->buildComparison() with $db->expr()Bartosz Dziewoński2023-10-221-3/+2
| | | | | | | A few more fairly simple cases that don't quite match the regexp in I2cfc3070c2a08fc3888ad48a995f7d79198cc336 or required other tweaks. Change-Id: I5438c777344e9ba07f3b62a452fce9ec63baa48a
* Use the expression assignment operator to simplify codeUmherirrender2023-10-141-1/+1
| | | | | | Suggested by phan, available since php7.4 Change-Id: Ic372ba9abb14de1196b89fca079e99168464eb06
* WikiRevision: Preserve lowercase of external actorsFunc2023-09-231-1/+9
| | | | | | | We need a pure UserIdentity. Bug: T347228 Change-Id: Ib52fbc6c797215d7b9b62d99f941d6996bf2d59a
* Namespace Config-related classes under \MediaWiki\ConfigJames D. Forrester2023-09-212-0/+2
| | | | | Bug: T166010 Change-Id: I4066885a7ea071d22497abcdb3f95e73e154d08c
* Merge "Migrate another major batch to SelectQueryBuilder"jenkins-bot2023-09-202-11/+17
|\
| * Migrate another major batch to SelectQueryBuilderAmir Sarabadani2023-09-202-11/+17
| | | | | | | | | | | | | | | | I fixed some edge cases in the script that migrates to SQB and it managed to fix these now. Bug: T344971 Change-Id: I00cc9a6660d9bd4c64c976121b2121ccd7aae1f0
* | Namespace remaining User-related classes under \MediaWiki\UserJames D. Forrester2023-09-201-0/+1
| | | | | | | | | | Bug: T166010 Change-Id: Ibda1e8be0f23c6262a32b607f8260cad36f188fc
* | Namespace User under \MediaWiki\UserJames D. Forrester2023-09-194-0/+4
|/ | | | | Bug: T166010 Change-Id: I7257302b485588af31384d4f7fc8e30551f161f1
* Namespace remaining Title-related classes under \MediaWiki\TitleJames D. Forrester2023-09-192-1/+8
| | | | | Bug: T166010 Change-Id: Ia2e5a7367cc8cdbd8a7b845ae2fd5d776ff22891