aboutsummaryrefslogtreecommitdiffstats
path: root/includes/Category
Commit message (Collapse)AuthorAgeFilesLines
* Use type declaration on undocumented private functionsUmherirrender2025-04-021-1/+1
| | | | Change-Id: I0d8d2237500ed6f18439410c902d47c42e4119bc
* Deprecate OutputPage::getNoGallery()C. Scott Ananian2025-03-221-1/+2
| | | | | | | | | | | | | | | Also switch to using OutputPage::$metadata to store $mNoGallery, although the expected replacement is OutputPage::getOutputFlag(). This is a slight semantic change, as it is the OR of the NO_GALLERY flag for all ParserOutputs used to compose the Output, instead of simply being the value of the last ParserOutput used. This isn't expected to be significant in practice. Improved the documentation of ParserOutputFlags::NO_GALLERY while we're touching this code. Bug: T301020 Change-Id: Ibaa31df331974e98254ecfcc4393ec1fda2ebe64
* Re-apply "Drop all 49 remaining class_aliases from MediaWiki 1.40"Daimona Eaytoy2025-03-054-12/+0
| | | | | | | | | This reverts commit 1695950bccb1ca7eba98952753708ae7c4b76d8d and re-applies commit I8f3c2ea021d0f6e. Reason for revert: the remaining usages have been updated in Ida665f486eff384. Bug: T166010 Change-Id: I43f06e6872b264e43aef7fa7c2ac47159926a694
* Revert "Drop all 49 remaining class_aliases from MediaWiki 1.40"Ahmon Dancy2025-03-044-0/+12
| | | | | | | | | This reverts commit db47e7f7154a2121bce6d3d9e93a74486bf765f3. Reason for revert: Broke scap sync-world in beta, and possibly caused T387938 Bug: T166010 Change-Id: If608c3e27081bb36b284ad16a5b912dd51b3557e
* Drop all 49 remaining class_aliases from MediaWiki 1.40James D. Forrester2025-03-044-12/+0
| | | | | | | Bug: T166010 Depends-On: Iba93dd9749656e641c427e01790d7a14cd1a2dc2 Depends-On: I97ccc2c49ce09ca96192bf6ffdc833c1765c3faa Change-Id: I8f3c2ea021d0f6e574dde901f0bfd4a0408f5455
* Replace a few misplaces is_object checksthiemowmde2025-02-121-4/+2
| | | | | | | | | | | | is_object is very rarely what we actually need. In many cases we know exactly what the object can be, and should check for that specific class or for null. A database row is an instance of stdClass. Checking that with is_object also works but is less correct and would allow stuff we cannot accept in these places. Change-Id: I1dc663d7325cabc059ef11c4845b0189208e907f
* Category: Add support for read newAmir Sarabadani2025-02-072-25/+53
| | | | | | | In Category and CategoryViewer Bug: T385890 Change-Id: I498765bbb6dd1c942f28694e567189429637bfc1
* Streamline some code related to disabled messagesThiemo Kreuz2024-12-031-19/+9
| | | | | | | | | | | In case a message does fancy stuff with {{#if: and such, we can not (only) use isDisabled(). Some messages are dynamically disabled via parser functions. isDisabled() can't pick this up as it works only on the raw message. However, in some cases we know isDisabled() is good enough. Change-Id: I1d267aed221c74b623c68ac5196ddf1b91a26a0f
* Category: Fix mistake when adjusting negative page countsKevin Israel2024-11-011-5/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | 7854e75a66f83e87 added another page count check, specifically that the total number of regular pages (total number of pages, minus the numbers of subcategories and files) must not be negative. As with the existing checks, this may trigger a recount of all pages in the category. Until the recount happens, the total number of pages is adjusted to make it consistent with this rule. However, the calculation is incorrect, in that the number of regular pages is computed, not the total pages, which must be at least the sum of the other page counts. Fix the calculation to use that sum, not 0, as the minimum, instead of subtracting it from the total number of pages (and failing to add it back afterward). Also updated the comment, and added a couple more, to state why we are doing this instead of just making sure that none of the three properties is set to a negative number as had been done before. Also removed the check for a negative total because PHP will make sure (by converting to float) that underflow will not change the sign from negative to positive when we subtract the numbers of subcategories and files (which we ensure are not negative) from the total. Bug: T373773 Change-Id: I1360abbc594d89be899a6081c84cff2f160878fa
* Category: Refresh counts for negative page countUmherirrender2024-10-281-2/+4
| | | | | | | | | | | The current code checks for negative member count (mPages contains the sum of subcats, files and pages), checking also for negative page count and adjust the member count if there is a wrong value. Set the member count after correction of subcats and files count to avoid in worse case another stale number. Bug: T373773 Change-Id: Ia8d6bdf6f68152396544b8a8dd73c3922839a9f9
* Remove meaningless @var documentation from constantsthiemowmde2024-10-091-2/+0
| | | | | | | | | A constant is not a variable. The type is hard-coded via the value and can never change. While the extra @var probably doesn't hurt much, it's redundant and error-prone and can't provide any additional information. Change-Id: Iee1f36a1905d9b9c6b26d0684b7848571f0c1733
* Add missing documentation to class properties (miscellaneous classes)Umherirrender2024-09-141-1/+2
| | | | | | | | | | Add doc-typehints to class properties found by the PropertyDocumentation sniff to improve the documentation. Once the sniff is enabled it avoids that new code is missing type declarations. This is focused on documentation and does not change code. Change-Id: I1da4b272a6b28c419cc8e860d142dae19ca0bbcf
* Merge "Add tracking category resolution to Parsoid DataAccess"jenkins-bot2024-09-051-4/+8
|\
| * Add tracking category resolution to Parsoid DataAccessC. Scott Ananian2024-08-301-4/+8
| | | | | | | | | | | | | | | | This allows Parsoid to add tracking categories, even though the exact name of the categories is resolved by mediawiki core. Change-Id: Id4b29c6d09c79649c94d2da2e678af52a967bbe5
* | Add `double-px-category` tracking category for deprecated image size syntaxC. Scott Ananian2024-08-291-0/+1
|/ | | | | | | | | | | | | | | | | | | | | | For decades MediaWiki has allowed "extra" px modifiers in image size specifications, for example `100pxpx`. It has been suggested since at least 2008 (T15500#174968) that this behavior should be deprecated. This is not localized, so (for example) on eowiki we allow `100rapx` as well (!). As one small step toward eventually removing this weird corner case behavior add a tracking category whenever it is used on wiki. In the process, emit deprecation warnings for ImageGalleryBase::setWidths() or ::setHeights() if called without ImageGalleryBase::setParser() having been set. The ::setParser() method already includes in its documentation that "If you do not set this and the output of this gallery ends up in parser cache, the javascript will break!", so please set the parser appropriately. Bug: T15436 Bug: T15500 Bug: T372935 Change-Id: If86d949189a7d105595404d21447477499873b03
* Move Language and friends into Language namespaceJames D. Forrester2024-08-101-1/+1
| | | | | Bug: T353458 Change-Id: Id3202c0c4f4a2043bf97b7caee081acab684155c
* Add MediaWiki\Registration namespace to registration classesEbrahim Byagowi2024-08-101-1/+1
| | | | | Bug: T353458 Change-Id: Ifa3b6a6e0353bb4ce21a3f4456f1fc696c8d377c
* Hard deprecate various public or protected properties of OutputPageC. Scott Ananian2024-08-011-1/+1
| | | | | | | These were soft deprecated in 1.38, it's time to emit deprecation warnings so we can complete their removal from the public API. Change-Id: I437ab7dc8af4eb5d336e8074a42a0a54b4c00a4b
* Add {{#dir}} parser functionEbrahim Byagowi2024-07-191-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Template:Dir is one of the most used templates in Wikimedia Commons, this tries to provide parts of its functionality in hope we can perhaps simplify or get rid of the template eventually for clarity and performance reasons. As a convenience, `{{#dir}}` and `{{#dir:}}` are synonyms for `{{#dir:{{PAGELANGUAGE}}}}`: they return the direction of the target language. For articles, the target language is the content language; for messages, the target language is the user language. In addition, to avoid confusion between BCP-47 language codes and MediaWiki-internal language codes, an optional second parameter can be supplied. If the second parameter is the (localizable) string 'bcp47', the language code given in the first parameter will be treated as a BCP-47 code. For example: `{{#dir:sr-Cyrl|bcp47}}`. (See LanguageCode::bcp47ToInternal() for a description of the differences and overlaps between MediaWiki internal and BCP-47 codes. These overlaps *so far* don't result in any case where encouraging editors to be precise about which set of enumerated string values they are using for consistency with other language-related functions, and because MediaWiki internally differentiates between BCP-47 codes and internal codes.) Bug: T359761 Change-Id: I19c3e91a924e080f37dc95a0d4e61493583b533e
* Add namespace and deprecation alias to DeprecationHelperHakan Özdemir2024-05-051-1/+1
| | | | | | | | | This patch introduces a namespace declaration for the MediaWiki\Debug to DeprecationHelper and establishes a class alias marked as deprecated since version 1.43. Bug: T353458 Change-Id: I808c6aa7836445feaa7b401624d79d01f2c70322
* Fix some line indentUmherirrender2024-04-201-1/+1
| | | | Change-Id: I8f82724197d20f9289d80e138d80310f1eab29f2
* Substitute category default sort key when filling links table, not at parse timeC. Scott Ananian2024-03-291-4/+1
| | | | | | | | | | | This ensures uniform treatment of all places that call `addCategory` without duplicating the `defaultsort` code; it also ensures that the effect of the {{DEFAULTSORT}} parser function is independent of page position. Bug: T40435 Bug: T353530 Change-Id: I4480a6d59e766fa4eddc9ec9117c58b66771bb47
* Standardise all our class alias deprecation comments for ease of greppingJames D. Forrester2024-03-194-12/+4
| | | | Change-Id: I7f85d931d3b79da23e87b4e5692b2e14be8fcaa0
* Namespace includes/cacheJames D. Forrester2024-02-201-1/+1
| | | | | Bug: T353458 Change-Id: Ic3f3168ef17113f5fb3ec11e0a47f52d65eefba9
* Move Parser to Mediawiki\Parser namespaceSubramanya Sastry2024-02-161-0/+1
| | | | | | | | Bug: T166010 Co-Authored-By: Daimona Eaytoy <daimona.wiki@gmail.com> Co-Authored-By: James Forrester <jforrester@wikimedia.org> Co-Authored-By: Subramanya Sastry <ssastry@wikimedia.org> Change-Id: I79b4e732c45095eedbaa80afa5eb7479b387ed8a
* Namespace includes/contextJames D. Forrester2024-02-081-2/+2
| | | | | Bug: T353458 Change-Id: I4dbef138fd0110c14c70214282519189d70c94fb
* Fix casing of Mediawiki to MediaWikiReedy2024-01-291-2/+2
| | | | Change-Id: I0f266a034a99255b27fd96d82335d6e710a61f20
* Merge "Change more uses of getDBLoadBalancerFactory() to ↵jenkins-bot2024-01-231-1/+1
|\ | | | | | | getConnectionProvider()"
| * Change more uses of getDBLoadBalancerFactory() to getConnectionProvider()Bartosz Dziewoński2024-01-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | Some less trivial cases. Also update variable names. 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: I6657d783375fac5c7fa856b884ff1fb09285e94c
* | Replace more instances of unchecked MWExceptionDaimona Eaytoy2024-01-231-3/+2
| | | | | | | | | | | | | | | | Most (all?) of the remaining usages are caught somewhere and will be migrated later. Bug: T328220 Change-Id: I5c36693a5361dd75b4f1e7a0bab5ad48626ed75c
* | title: Make TitleArrayFromResult via TitleFactory serviceDerick Alangi2024-01-231-3/+8
|/ | | | | | | | | | | | | | The TitleFactory should really be where TitleArrayFromResult should live as it's a place where Title objects are created based on certain specifications. This patch tries to consolidate the creation of TitleArrayFromResult via the TitleFactory services and in the future, we will consolidate more of the logic and kill TitleArrayFromResult. Follow up on: a99ec1b and e54665d. Change-Id: I98215af3252d756de4435b77d1280dacda8e85dc
* 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 usages of deprecated MWExceptionDaimona Eaytoy2024-01-191-3/+2
| | | | | Bug: T328220 Change-Id: Ie9b56bcf5e962e275d80570cad98d676da505894
* CategoryViewer: Fix "count(): Argument #1 ($value) must be of type ↵Paladox2023-12-231-1/+3
| | | | | | Countable|array, null given" Change-Id: If33bac6568bdedcdf31973b6841a8bd1eff84706
* Namespace ParserOutputJames D. Forrester2023-12-141-1/+1
| | | | | | | Most used non-namespaced class! Bug: T353458 Change-Id: I4c2cbb0a808b3881a4d6ca489eee5d8c8ebf26cf
* Category: Update commentsLucas Werkmeister2023-12-041-2/+2
| | | | | | | Minor things that shouldn’t block the UBN fix in change I36da2337d9. Bug: T352628 Change-Id: Icdcb59879a5194fb438b2e0f77ebcdd4bfe22c75
* Category: Stop locking thousands of rowsAmir Sarabadani2023-12-041-6/+16
| | | | | | | This is causing deadlocks (P54106) and all sorts of issues. Bug: T352628 Change-Id: I36da2337d9924f66ba642d5f14af75842741bde5
* Namespace remaining files under includes/deferredJames D. Forrester2023-11-221-1/+1
| | | | | Bug: T166010 Change-Id: Ibd40734b96fd2900e3ce12239d09becfb4150059
* Migrate off wfGetDB() in more places to ICPAmir Sarabadani2023-11-201-1/+1
| | | | | | | | | | | | | | | | | 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
* Migrate another batch to use $db->expr instead of raw SQLAmir Sarabadani2023-10-301-4/+10
| | | | | Bug: T210206 Change-Id: I327517fef250c24392565a26bbe7b296dc19508a
* Replace single-value $db->buildComparison() with $db->expr()Bartosz Dziewoński2023-10-221-1/+1
| | | | | | | | | | Find: ->buildComparison\( ('..?'), \[(\s*)([^\],]+) => ([^\],]+)(\s*)\] \) Replace with: ->expr($2$3, $1, $4$5) Change-Id: I2cfc3070c2a08fc3888ad48a995f7d79198cc336
* Title: Use TitleArrayFromResult instead of TitleArrayDerick Alangi2023-10-031-3/+3
| | | | | | | | TitleArray is just a tiny little wrapper to TitleArrayFromResult, so use the latter instead of the former. I have plans of killing the former soon. Change-Id: Ia06a6bb370ce313f38d3ec9a221ed7296aec0ee2
* Namespace TitleParser under \MediaWiki\TitleJames D. Forrester2023-09-191-1/+1
| | | | | | | One of the big ones, so doing this alone. Bug: T166010 Change-Id: I4848e903b0c0a2f7c58ac19e0baeef0085a36bdc
* 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
* Merge "Namespace TitleValue under \MediaWiki\Title"jenkins-bot2023-09-181-1/+1
|\
| * Namespace TitleValue under \MediaWiki\TitleJames D. Forrester2023-09-181-1/+1
| | | | | | | | | | | | | | One of the big ones, so doing this alone. Bug: T166010 Change-Id: I4c901d5c32696d8334ec30cede7d9b6f3d8d645e
* | Remove ParserOutput::addTrackingCategory(), deprecated since 1.38C. Scott Ananian2023-09-181-4/+14
|/ | | | | | | | Instead use either Parser::addTrackingCategory() or the TrackingCategories service. Bug: T305161 Change-Id: I19e0f67e377e6c68f54f6d5bb4f079110d1e61fc
* In query builders, use insertInto() and deleteFrom() instead of insert() and ↵Tim Starling2023-09-081-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | 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
* Migrate Database::upsert() calls to InsertQueryBuilderAmir Sarabadani2023-09-061-10/+10
| | | | | Bug: T335377 Change-Id: I0e0c3f3a9150c7a62d8fff95fe8867bdce356071
* Follow-up c811622: Add in-code comment on aliases for when they were addedJames D. Forrester2023-08-254-0/+12
| | | | Change-Id: If684cd129788b8ab1f730703b5a4e9131edbee54