aboutsummaryrefslogtreecommitdiffstats
path: root/includes/Revision
Commit message (Collapse)AuthorAgeFilesLines
...
* Stop using LoadBalancer::getConnectionRef() so it can be hard-deprecatedAmir Sarabadani2024-04-301-2/+2
| | | | | Bug: T326274 Change-Id: I90493d7cd4c21fdc022bcc19765fc04d986a9c8f
* Replace all instances of "per default" with "by default"Tim Starling2024-04-292-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | According to the dictionary, "per" (or more conventionally "as per") means "according to". Refer OED "per" sense II.3.a. For example: "No value was passed, so return null, as per default". In this sentence, we are not specifying the default, we are referring to the default. This correct usage of "per default" was used nowhere in MediaWiki core as far as I can see. Instead we have "per default" being used to mean "by default", that is, giving the value to use when no explicit value was specified. In OED, the phrase "by default" is blessed with its own section just for computing usage: "P.1.e. Computing. As an option or setting adopted automatically by a computer program whenever an alternative is not specified by the user or programmer. Cf. sense I.7a." There are highly similar pre-computing usages of the same phrase, whereas the phrase "per default" is not mentioned. As a matter of style, I think "per default" should not be used even when it is strictly correct, since the common incorrect usage makes it ambiguous and misleading. Change-Id: Ibcccc65ead864d082677b472b34ff32ff41c60ae
* Fix some line indentUmherirrender2024-04-201-2/+2
| | | | Change-Id: I8f82724197d20f9289d80e138d80310f1eab29f2
* Remove ContributionsLookup serviceThalia2024-04-151-278/+0
| | | | | | | | | This was added in 300fcfd00bba76f9f770f1f053a1903d5876ad56 for an experimental REST endpoint that was removed in c3fe4b037d9ad7e5fd158f3e686f717c75a0fd20, and is now unused. Bug: T305506 Change-Id: I900c00747f77af6b0844105e9681c9d4acfe1ad5
* Fix some spelling errorsTim Starling2024-03-181-3/+3
| | | | Change-Id: I3632ce1ae00527f806652deb96cafb473aed3dcf
* build: Fix line indentsUmherirrender2024-03-111-4/+4
| | | | | | | Fixed SkinModuleTest::provideGetFeatureFilePathsOrder as nesting of arrays for parameters is wrong Change-Id: I9875008adf62d284c48662ebfbd245d72e5be064
* RevisionStore: Use SelectQueryBuilder in findIdenticalRevisionBartosz Dziewoński2024-03-061-22/+13
| | | | | | Improve SelectQueryBuilder doc issues found in the process. Change-Id: I1934eebc79c3aea0c03ca3fc949bffbf5860187f
* RevisionStore: Force index to fix slow query in findIdenticalRevisionBartosz Dziewoński2024-03-051-0/+2
| | | | | Bug: T354015 Change-Id: Id3945dafa021e840b5ee791433c372322ae57f77
* Merge "rdbms: Remove more usages of DBAccessObjectUtils::getDBOptions()"jenkins-bot2024-02-271-2/+10
|\
| * rdbms: Remove more usages of DBAccessObjectUtils::getDBOptions()Amir Sarabadani2024-02-221-2/+10
| | | | | | | | | | | | | | | | | | Also remove the fallback index and options as it was agreed upon in the ticket as its needlessly complicates the function and is only used in SqlBlobStore which can have its own copy of the function Bug: T354194 Change-Id: I38b179c9bfeb7d2c3e92fa4845dce19558f45a0f
* | Merge "Remove IDBAccessObject from being implemented in many classes"jenkins-bot2024-02-213-4/+3
|\ \
| * | Remove IDBAccessObject from being implemented in many classesAmir Sarabadani2024-02-193-4/+3
| |/ | | | | | | | | | | | | | | | | | | | | | | This is inconsistent with the access pattern of other constants in MediaWiki. it's also confusing (e.g. it's unclear to a newcomer why UserFactory is implementing IDBAccessObject) and it's prone to clashes (e.g. BagOStuff class has a clashing constant). It has been already announced: https://w.wiki/9DAX Bug: T354194 Change-Id: Ic2357634b8385d65b55db2b557191419b06c40e0
* | Merge "[ParserOutput] Rename $mText to $mRawText and ::setText() to ↵jenkins-bot2024-02-211-1/+1
|\ \ | |/ |/| | | ::setRawText()"
| * [ParserOutput] Rename $mText to $mRawText and ::setText() to ::setRawText()C. Scott Ananian2024-02-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ParserOutput::getText() is not a simple getter, but does transformations on the "text" of the ParserOutput; the simple getter is named ::getRawText(). To maintain consistency, rename ParserOutput::setText() to ::setRawText() and the property name ParserOutput::$mText to ::$mRawText so future readers are not confused. The JSON property name as it appears in the serialized ParserCache is left as 'Text' so that we don't have any forward- or backward- rollback issues. Change-Id: I3ef34814ab9473cc70d0a6806e8c5a4a02b73491
* | Namespace Message, move to appropriate directoryJames D. Forrester2024-02-142-2/+2
|/ | | | | Bug: T353458 Change-Id: I088cbc53fbcdb974e5b05b45a62e91709dacc024
* Namespace includes/contextJames D. Forrester2024-02-081-2/+2
| | | | | Bug: T353458 Change-Id: I4dbef138fd0110c14c70214282519189d70c94fb
* Add ParserOutput::{get,set}RenderId() and set render id in ContentRendererC. Scott Ananian2024-02-071-7/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Set the render ID for each parse stored into cache so that we are able to identify a specific parse when there are dependencies (for example in an edit based on that parse). This is recorded as a property added to the ParserOutput, not the parent CacheTime interface. Even though the render ID is /related/ to the CacheTime interface, CacheTime is also used directly as a parser cache key, and the UUID should not be part of the lookup key. In general we are trying to move the location where these cache properties are set as early as possible, so we check at each location to ensure we don't overwrite a previously-set value. Eventually we can convert most of these checks into assertions that the cache properties have already been set (T350538). The primary location for setting cache properties is the ContentRenderer. Moved setting the revision timestamp into ContentRenderer as well, as it was set along the same code paths. An extra parameter was added to ContentRenderer::getParserOutput() to support this. Added merge code to ParserOutput::mergeInternalMetaDataFrom() which should ensure that cache time, revision, timestamp, and render id are all set properly when multiple slots are combined together in MCR. In order to ensure the render ID is set on all codepaths we needed to plumb the GlobalIdGenerator service into ContentRenderer, ParserCache, ParserCacheFactory, and RevisionOutputCache. Eventually (T350538) it should only be necessary in the ContentRenderer. Bug: T350538 Bug: T349868 Followup-To: Ic9b7cc0fcf365e772b7d080d76a065e3fd585f80 Change-Id: I72c5e6f86b7f081ab5ce7a56f5365d2f75067a78
* RevisionStore: Remove usage of ActorMigrationAlexander Vorwerk2024-02-052-41/+28
| | | | | Bug: T227047 Change-Id: Ie877b578b5760d3592afd7654df524fe4d20a6ff
* Always allow local IP actors to be created when importingThalia2024-01-291-2/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Why: * Following T345578, the ActorStore throws an error on attempting to create an actor whose name is their IP address if temporary accounts are enabled. * For the specific case of importing old revisions, we need to be able to create new actors whose name is their IP address, while still generally disallowing it. What: * Add $allowCreateIpActors flag to ActorStore, and check for it during actor name validation. * Set the flag from ActorStoreFactory::getActorStore depending on whether temporary users are enabled. * Add ActorStoreFactory::getActorStoreForImport, which sets flag to true. * Add RevisionStoreFactory::getRevisionStoreForImport, which uses getActorStoreForImport. Use this from classes handling imports, so that IP actors can always be created. * Add $forImport flag on ActorMigration, since RevisionStore uses an actor store obtained via ActorMigration. Bug: T354207 Change-Id: I0715bd0d23089fd8156e579913e6e823089809be
* Replace unchecked MWException with SPL exceptionsDaimona Eaytoy2024-01-281-2/+1
| | | | | Bug: T328220 Change-Id: I4e0454ce3ad3741756e2010a76e548d6c9a6bcb5
* Remove more indirect calls to IDBAccessObject::READ_* constantsAmir Sarabadani2024-01-232-5/+5
| | | | | | | | | | Found via (?<!IDBAccessObject)::READ_ We are planning to deprecate and remove implementing IDBAccessObject interface just to use the constants. Bug: T354194 Change-Id: I89d442fa493b8e5332ce118e5bf13f13b8dd3477
* Merge "Introduce DBAccessObjectUtils::getDBFromRecency()"jenkins-bot2024-01-221-15/+17
|\
| * Introduce DBAccessObjectUtils::getDBFromRecency()Amir Sarabadani2024-01-191-15/+17
| | | | | | | | | | | | | | And general clean up of db connection handling in core Bug: T354194 Change-Id: Icb3685f1d7f8d1f4bcadf8e292ddf9450180fcdb
* | Merge "Revision: Add types and streamline SlotRoleRegistry code"jenkins-bot2024-01-211-37/+22
|\ \
| * | Revision: Add types and streamline SlotRoleRegistry codethiemowmde2024-01-211-37/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In detail: * Add type declarations everywhere. * Remove redundant PHPDoc tags. * Avoid possibly expensive in_array() scans when an isset() can do the same job. * Replace some indirect $this->isDefinedRole() calls with more direct isset(). This is not done for performance but for readability. I find it really confusing to see an `if ( $this->isDefinedRole() )` followed by code that accesses $this->instantiators[…]. How is this related? How does the method call guarantee the array element is there? Why not just check if the array element is there? Which is what happens now. Change-Id: Ifeaed847b89b756b7be4430d769f94132d2d9e49
* | | ActorMigration: Drop temp table codeAlexander Vorwerk2024-01-191-9/+5
| | | | | | | | | | | | | | | | | | | | | There is no actor migration left for which a temp table is needed. Bug: T215466 Change-Id: I4e85b0a8e05323263a44454691ef3e6963aad3ab
* | | Merge "Replace deprecated MWException"jenkins-bot2024-01-161-9/+4
|\ \ \ | |_|/ |/| |
| * | Replace deprecated MWExceptionDaimona Eaytoy2024-01-161-9/+4
| |/ | | | | | | | | Bug: T328220 Change-Id: Ic45438d9e6bbf127f1415add81ab902044765840
* / Directly call IDBAccessObject constants instead of implementing itAmir Sarabadani2024-01-102-18/+18
|/ | | | | | | | | | | | Instead of calling self::READ_* on these constants, just directly call it. Since these classes are public and might be relied on directly in other places, we can't remove the "implements IDBAccessObject" yet but we will start doing that soon. Bug: T354194 Change-Id: I3e26b9fc7f93efdfc55a1790a7cdfa5c0d562303
* Namespace ParserOutputJames D. Forrester2023-12-143-3/+3
| | | | | | | Most used non-namespaced class! Bug: T353458 Change-Id: I4c2cbb0a808b3881a4d6ca489eee5d8c8ebf26cf
* Parsoid-VE-MCR hack: Always return main slot output if useParsoid is setSubramanya Sastry2023-11-131-4/+7
| | | | | | | | | | | | | | | | | | * VE needs to be given HTML for the main slot since that is the only editing that is supported right now. This is a quickish hack to fix the problem and breakage caused by c8d0470f. When T351113 is addressed, these hacks will be removed. * But Parsoid read-view API users will now only get the main slot output for these pages. But since this is only an issue on Commons and Parsoid read views there will be worked on much later (T351113), we have time to figure out the changes needed to address this properly. * Updated existing tests. Bug: T351026 Bug: T351113 Change-Id: Id79098e2969bd207f819e3c9e89c8122f7182a2e
* Mass migrate simple cases to use expression builderAmir Sarabadani2023-10-262-3/+3
| | | | | | | | | | | | | | | Done via '([A-Za-z_\.]+) ?(=|!=|<|<=|>|>=) ?' . (\$db(?:r|w|))->addQuotes\( (.+?) \) to: $3->expr\( '$1', '$2', $4 \) And '([A-Za-z_\.]+) IS NULL OR ([A-Za-z_\.]+) ?(=|!=|<|<=|>|>=) ?' . (\$db(?:r|w|))->addQuotes\( (.+?) \) to: $4->expr( '$1', '=', null )->or\( '$2', '$3', $5 \) Bug: T210206 Change-Id: I109bf2a712bdefa9e074f775b1bee41ac5b9d665
* Introduce ChangeTagsStore::modifyDisplayQueryBuilder()Amir Sarabadani2023-09-271-25/+9
| | | | | | | | To deprecate ::modifyDisplayQuery() and unblock a lot of migrations to SelectQueryBuilder. Bug: T344971 Change-Id: Icb9265644bdbc0b30e2a419ae0103f0e78fe90bd
* Merge "RevisionArchiveRecord: Also check for permission to view deleted pages"jenkins-bot2023-09-211-0/+41
|\
| * RevisionArchiveRecord: Also check for permission to view deleted pagesBartosz Dziewoński2023-09-201-0/+41
| | | | | | | | | | Bug: T345777 Change-Id: I12c00c9a5d547ddaa459fdd1489dd82b91fc3fe2
* | Migrate another major batch to SelectQueryBuilderAmir Sarabadani2023-09-201-8/+7
| | | | | | | | | | | | | | | | 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 NamespaceInfo under \MediaWiki\TitleJames D. Forrester2023-09-191-1/+1
| | | | | | | | | | | | | | One of the big ones, so doing this alone. Bug: T166010 Change-Id: Ibe103cd362535d3cb94cb8931e95fc74099d1497
* | Namespace 'special' Pagers under \MediaWiki\PagerJames D. Forrester2023-09-181-1/+1
|/ | | | | | | | | | They're under 'specials' because that's where they're mostly used, but they're just another kind of Pager (shown by their use outwith the MediaWiki\Specials hierarchy, which is a bad code smell for us to review later). Bug: T166010 Change-Id: Iad3f91582b723c1e6679525aa852ffdfd8c6d5ba
* Bump phan to 0.13.0Amir Sarabadani2023-09-112-5/+5
| | | | Change-Id: I57c25d953700ca1cd97cc71ec2a28cbeb9ee875f
* In query builders, use insertInto() and deleteFrom() instead of insert() and ↵Tim Starling2023-09-081-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | delete() The design principle for SelectQueryBuilder was to make the chained builder calls look as much like SQL as possible, so that developers could leverage their knowledge of SQL to understand what the query builder is doing. That's why SelectQueryBuilder::select() takes a list of fields, and by the same principle, it makes sense for UpdateQueryBuilder::update() to take a table. However with "insert" and "delete", the SQL designers chose to add prepositions "into" and "from", and I think it makes sense to follow that here. In terms of natural language, we update a table, but we don't delete a table, or insert a table. We delete rows from a table, or insert rows into a table. The table is not the object of the verb. So, add insertInto() as an alias for insert(), and add deleteFrom() as an alias for delete(). Use the new methods in MW core callers where PHPStorm knows the type. Change-Id: Idb327a54a57a0fb2288ea067472c1e9727016000
* Introduce ArchiveSelectQueryBuilderAmir Sarabadani2023-09-074-13/+100
| | | | | | | Similar to RevisionSQB (Ifd690dc8f030) Bug: T344971 Change-Id: Ic520bcf09f4cc95ebd6a3990cff46dec5b7cd350
* Merge "ArchivedRevisionLookup: Allow lookups using just the revision ID"jenkins-bot2023-09-061-8/+10
|\
| * ArchivedRevisionLookup: Allow lookups using just the revision IDBartosz Dziewoński2023-09-021-8/+10
| | | | | | | | | | | | | | | | | | | | | | A unique index on ar_rev_id was added in T193180 (2019), allowing revisions of deleted pages to be reliably looked up by just their ID. Use the improved getArchivedRevisionRecord() method in a few places that previously had to use manual queries. Bug: T251066 Change-Id: I9352f64952ac4b803d76e9e72f88a01be7317c56
* | Merge "General whitespace clean-up of tabs followed by multiple spaces"jenkins-bot2023-09-061-1/+1
|\ \
| * | General whitespace clean-up of tabs followed by multiple spacesJames D. Forrester2023-09-061-1/+1
| |/ | | | | | | Change-Id: I22090062274dceec96d43e23eb227a7e3b1e36fa
* / Introduce RevisionSelectQueryBuilderAmir Sarabadani2023-09-063-25/+145
|/ | | | | | | | | Deprecating RevisionStore::getQueryInfo() and cleaning up a lot of code Also removing a brittle test that wasn't really testing anything. Bug: T344971 Change-Id: Ifd690dc8f030f86e3567a717eaeb830cb6dc703b
* Remove deprecated ActorMigration usages around ContribsPagerFunc2023-08-251-8/+0
| | | | Change-Id: I1a4224eac8bad47f7228faf68ea7f9c7d44a44ad
* Reorg: Move MWTimestamp to MediaWiki\UtilsAmir Sarabadani2023-08-194-4/+4
| | | | | Bug: T321882 Change-Id: I48c10343295c4eb3d9ef8037343b0070e928f040
* Mass migrate Database::insert calls to InsertQueryBuilderAmir Sarabadani2023-08-071-24/+37
| | | | | | | Done automatically based on a php parser written on top of ANTLR4 Bug: T335377 Change-Id: Ie8fabc594edab18e55cb1d5bbf573762106e3d71
* Migrate last batch of simple Database::select* calls to SQBAmir Sarabadani2023-08-013-85/+84
| | | | | | | Done semi-automatically via a parser written on top of ANTLR4 Bug: T311866 Change-Id: Ib71d6810e480d7176726082347b569e346557de7