aboutsummaryrefslogtreecommitdiffstats
path: root/includes/Revision/RevisionRenderer.php
Commit message (Collapse)AuthorAgeFilesLines
* Use type declaration on undocumented private functionsUmherirrender2025-04-021-2/+2
| | | | Change-Id: I0d8d2237500ed6f18439410c902d47c42e4119bc
* 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
* Use explicit nullable type on parameter argumentsUmherirrender2024-10-161-2/+2
| | | | | | | | | | | 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
* Namespace all remaining classes in includes/parserJames D. Forrester2024-10-151-1/+1
| | | | | Bug: T353458 Change-Id: If02cc9b1ff78e26c1cf8c91ee4695845eb133829
* specials: Catch RevisionAccessException and ignore on Special:UndeleteUmherirrender2024-09-301-0/+5
| | | | | | | Also add @throws documentation, when the exception needs check by caller Bug: T108495 Change-Id: I2c98381d9c3a639a71e6a8f8f8a5db6f98bcb073
* Provide previous parse results to parser when renderingC. Scott Ananian2024-08-231-6/+50
| | | | | | | | | | | | | | | | | | | | | | | | | This patch lays the groundwork for incremental/selective parsing in Parsoid by ensuring that we can pass previous cached parses through the parse pipeline to Parsoid. We do this by adding a new render hint type, `previous-output`, and ensuring it is passed along. Because revisions can contain a ParserOutput which is the combination of separate ParserOutput objects for each of their slots, RenderedRevision also contains a method to unsplit the combined ParserOutput to reconstruct an original ParserOutput for use in incremental parsing. Currently this is mostly a stub, but illustrates how slot combination and splitting can work, assuming those transformations are reversible. Extra calls to ParserCache::getDirty() are added to some code paths in order to ensure that any previously-cached ParserOutput is available for selective update. In order to mitigate any performance concerns, these are only done for the Parsoid parser at the moment. Future patches will add additional metrics to quantify the cost/benefit ratio of the additional cache lookups on these paths. Bug: T363421 Bug: T371713 Change-Id: I440884f1d7e09c1ff9806f848b7b53a636367690
* Stop using LoadBalancer::getConnectionRef() so it can be hard-deprecatedAmir Sarabadani2024-04-301-2/+2
| | | | | Bug: T326274 Change-Id: I90493d7cd4c21fdc022bcc19765fc04d986a9c8f
* Fix some spelling errorsTim Starling2024-03-181-3/+3
| | | | Change-Id: I3632ce1ae00527f806652deb96cafb473aed3dcf
* [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 ParserOutputJames D. Forrester2023-12-141-1/+1
| | | | | | | 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
* Migrate last batch of simple Database::select* calls to SQBAmir Sarabadani2023-08-011-12/+8
| | | | | | | Done semi-automatically via a parser written on top of ANTLR4 Bug: T311866 Change-Id: Ib71d6810e480d7176726082347b569e346557de7
* Reorg: Move HTML-related classes out of includes/ to Html/Amir Sarabadani2023-02-161-1/+1
| | | | | Bug: T321882 Change-Id: I5dc1f7e9c303cd3f5b9dd7010d6bb470d8400a18
* Merge "RevisionRenderer: Avoid deprecated ParserOptions::newCanonical()"jenkins-bot2022-11-151-3/+3
|\
| * RevisionRenderer: Avoid deprecated ParserOptions::newCanonical()Bartosz Dziewoński2022-11-141-3/+3
| | | | | | | | Change-Id: I8b2acf091a54ac9c4231764fa00468ac42b116c9
* | Track the reason for rendering.daniel2022-11-091-0/+6
|/ | | | | | | Allow the causeAction that triggers page rendering to be looped through to ParserCache, so we can count what causes writes to the cache. Change-Id: I6ad8e105a3ce457e3ab4f85cd154f47a32085e0d
* Various doc fixes about false and null on method arguments/return typesUmherirrender2022-11-031-2/+2
| | | | | | Doc-only changes Change-Id: Ice974b3ba41708859dfe646e94b31c5ebbf26410
* Remove Title dependency from RenderedRevisionPetr Pchelko2021-10-191-4/+8
| | | | Change-Id: I8da86277e0c8406a49ebd86faddf3dc2abbf5328
* docs: Change wording master to primary in comments and log textUmherirrender2021-09-011-3/+3
| | | | | Bug: T254646 Change-Id: I5379dc79be60c99f0a30f74e5d624f81fe6f921b
* More master -> primary documentation and internal var renamingJames D. Forrester2021-07-151-2/+2
| | | | | Bug: T254646 Change-Id: I63cc8895033714bdfbf09aee933a8f0a43b387f3
* Post Revision-removal cleanupDannyS7122021-06-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Replace uses of DB_MASTER with DB_PRIMARYJames D. Forrester2021-04-291-1/+1
| | | | | | Just an auto-replace from codesniffer for now. Change-Id: I5240dc9ac5929d291b0ef1c743ea2bfd3f428266
* Convert RevisionRenderer to AuthorityPetr Pchelko2021-03-241-8/+10
| | | | Change-Id: Ie702f29621c43e496d70bf5204cf11af7569e6d5
* RevisionRenderer: Fix typosAmmarpad2021-01-161-2/+2
| | | | Change-Id: I0acf10aa958dcd7d97eea64387964791752f9424
* Add missing $hints in short-cut callLucas Werkmeister2020-10-091-1/+1
| | | | | | | | RevisionRenderer::combineSlotOutput() is supposed to pass through the $hints when it calls getSlotParserOutput(), but in the shortcut case for only the main slot, it failed to do that. Change-Id: I7db2082bcd21b1c4a4b001e8405f1f9a29fe3ac3
* Upgrade phan config to 0.7.1Daimona Eaytoy2019-09-041-2/+0
| | | | | | | | This allows us to remove many suppressions for phan false positives. Bug: T231636 Depends-On: I82a279e1f7b0fdefd3bb712e46c7d0665429d065 Change-Id: I5c251e9584a1ae9fb1577afcafb5001e0dcd41c7
* Unsuppress phan issues part 6Daimona Eaytoy2019-09-011-0/+3
| | | | | | Bug: T231636 Depends-On: I50377746f01749b058c39fd8229f9d566224cc43 Change-Id: I2cd24e73726394e3200a570c45d5e86b6849bfa9
* rdbms: add setTempTablesOnlyMode() to suppress CONN_TRX_AUTOCOMMIT during testsAaron Schulz2019-08-191-12/+4
| | | | | Bug: T202116 Change-Id: Ib3e80eb04580b2d5a75ede8fb5546409c09a751a
* Fix bogus field use in RevisionRenderer::getSpeculativePageIdAaron Schulz2019-08-011-1/+1
| | | | | | | | | This field was renamed, causing a functional merge conflict Follow-up 5099ee9f7273 Bug: T229589 Change-Id: I7a6bb68ff1fe320313276dc5a67c70de6715ccb6
* parser: add speculative page IDs to use with {{PAGEID}}Aaron Schulz2019-07-261-1/+24
| | | | | | | | | | This works similarly to speculative rev IDs with {{REVISIONID}}. Re-parses can be avoided if the page ID is correctly guessed. Also make the {{PAGEID:X}} parser function set vary-page-id. Bug: T226785 Change-Id: I0b19be45e6ddd6cde330bfcd09d243e4e5beda01
* Make ExternalStore wrap ExternalStoreFactory and create access classAaron Schulz2019-06-281-1/+0
| | | | | | | | | | | | | | | * Inject settings and global instances as dependencies to the ExternalStoreMedium instances. This includes the local wiki domain, so that wfWikiId() calls are not scattered around. * Create ExternalStoreAccess service for read/write logic. * Deprecate the ExternalStore wrapper methods. * Add some exception cases for bogus store URLs are used instead of just giving PHP warnings and failing later. * Make moveToExternal.php require the type/protocol to decide which ExternalStoreMedium to use instead of assuming "DB". * Convert logging calls to use LoggerInterface. Change-Id: I40c3b5534fc8a31116c4c5eb64ee6e4903a6197a
* revision: rename various $wikiId fields/parameters to $dbDomainAaron Schulz2019-06-281-7/+7
| | | | | | | | | These fields are passed to methods like LoadBalancer::getConnection() and are already expected to be DB domains. Update various comments as well. Fix a few minor IDEA warnings. Change-Id: I7cf76700690aec449872a80d30b5ba540d2bf315
* parser: inject the time for {{REVISIONTIMESTAMP}} on pre-save parseAaron Schulz2019-06-091-0/+7
| | | | | | | | | | | | | | | | | | DerivedPageDataUpdater::prepareContent already locks in the revision timestamp before insertion, so inject that into the parser options used for any pre-save parse (e.g for edit filters). This means that a reparse is no longer needed within in the same save request to get the post-save canonical output. A parse will still be required if the edit filter output used an edit stash output, since the revision timestamp is not set at stash time. Instead of using vary-revision, add a vary-revision-timestamp flag for the revision timestamp words. The month/day/hour variants retain their prior optimizations for allowing edit stash output reuse for the post-save canonical output. Change-Id: Ic2c13db4d21197c79a89de0de56745ca32918eb6
* Merge "[MCR] Introduce SlotRoleHandler and SlotRoleRegistry"jenkins-bot2018-12-031-3/+23
|\
| * [MCR] Introduce SlotRoleHandler and SlotRoleRegistrydaniel2018-11-301-3/+23
| | | | | | | | | | | | | | | | | | | | | | These new classes provide a mechanism for defining the behavior of slots, like the content models it supports. This acts as an extension point for extensions that need to define custom slots, like the MediaInfo extension for the SDC project. Bug: T194046 Change-Id: Ia20c98eee819293199e541be75b5521f6413bc2f
* | Use stashed ParserOutput during saving.daniel2018-11-221-0/+9
|/ | | | | | | | | | | The code in DerivedPageDataUpdater that used the stashed ParserOutput from ApiStashEdit::checkCache was accidentally broken when RevisionRenderer was introduced in I871978bf79f67c9e7954fb3fc8528d6e365f2cc1. This is likely the cause for the degraded save timing noted in T205369. Bug: T205369 Change-Id: I6d8fdda73dccae08d18bfb528b948706f56ad2e0
* Set the SaveParser logger in RevisionRendererAaron Schulz2018-10-301-0/+7
| | | | Change-Id: Iacc28ce583fed8cf2a7f7b931754c64619cb4917
* Re-namespace RevisionStore and RevisionRecord classesBrad Jorsch2018-10-091-2/+0
| | | | | | | | | | | | | | | | | | | During development a lot of classes were placed in MediaWiki\Storage\. The precedent set would mean that every class relating to something stored in a database table, plus all related value classes and such, would go into that namespace. Let's put them into MediaWiki\Revision\ instead. Then future classes related to the 'page' table can go into MediaWiki\Page\, future classes related to the 'user' table can go into MediaWiki\User\, and so on. Note I didn't move DerivedPageDataUpdater, PageUpdateException, PageUpdater, or RevisionSlotsUpdate in this patch. If these are kept long-term, they probably belong in MediaWiki\Page\ or MediaWiki\Edit\ instead. Bug: T204158 Change-Id: I16bea8927566a3c73c07e4f4afb3537e05aa04a5
* Add constant for the name of the 'main' slot for MCRGergő Tisza2018-09-241-4/+5
| | | | | Bug: T202142 Change-Id: I97a74e5a029b014f3c2195188936d5c8233c1b7f
* Make HTML generation in RenderedRevision optionaldaniel2018-08-311-24/+35
| | | | | | | | | | This allows optimization for situations in which a caller needs the meta-data of a ParserOutput, and the respective ContentHandler can provide that meta-data without generating HTML output. Bug: T194048 Change-Id: I786d294d18a6a2e3cea61577313e21b578c44f1e
* [MCR] Introduce RevisionRendererdaniel2018-08-301-0/+207
RevisionRenderer is the MCR replacement for Content::getParserOutput, as outlined in <https://www.mediawiki.org/wiki/User:Daniel_Kinzler_(WMDE)/MCR-PageUpdater>. Note: This change also introduces quite a bit of code for merging ParserOutput objects. Bug: T194048 Change-Id: I871978bf79f67c9e7954fb3fc8528d6e365f2cc1