aboutsummaryrefslogtreecommitdiffstats
path: root/includes/search
Commit message (Collapse)AuthorAgeFilesLines
* Move SearchResultProvideThumbnail hook to 'search'Matthias Mullie2022-09-011-0/+28
| | | | | | | | | | | | | This will no longer be a thing exclusive to REST API, but will be used more widely for search. This also introduced the (optional) $size param, for which implementations (PageImages only) have already been updated. Depends-On: Ia30afcc43a0ecec772cd0a82dd9661e61f31a651 Change-Id: Ic9110345b4db69d268685b80ec8e4e33da95a050 Bug: T306883
* ppearance update of "Sister project widgets" on Special:SearchMark Shenouda2022-08-092-13/+31
| | | | | | | | | | | | [x] Remove the header "Results from sister projects" [x] Remove background box [x] Update sister projects icons. These are the new black and white icons added to design system. All the icons can be found at the bottom of this icon list. [x] Add sister project name as a header (with icon) for each project [x] Update sister project search outlink copy, style and placement. - "See all results" link in the mock. [x] Add new spacing/padding to better align with the overall page. Follow the grid as mentioned in this ticket. The padding within the section can be found on Figma Bug: T307468 Change-Id: I9498a070dadacd26d4402943f6f59f308c99a0d0
* search: Replace deprecated User::getOptionUmherirrender2022-08-051-4/+17
| | | | | Bug: T296083 Change-Id: I83e4cca11c9266e93b237ed11c14293a001609dc
* Make use of ?? and ?: operators where it makes senseThiemo Kreuz2022-08-041-6/+2
| | | | Change-Id: I1d9d62d80b17d1a05222c6e82f631cb801c311a8
* Migrate use of ${var}-style string interpolationMáté Szabó2022-07-291-1/+1
| | | | | | | | The "${var}" and "${expr}" style string interpolations are deprecated in PHP 8.2. Migrate usages in core to "{$var}" as appropriate. Bug: T314096 Change-Id: I269bad3d4a68c2b251b3e71a066289d4ad9fd496
* Start `catch` blocks on the same line as the preceding }DannyS7122022-06-231-2/+1
| | | | Change-Id: Id34892c50f7c02e12683102dcbf66e558527f737
* Get rid of warnings on PHP 8.1Aryeh Gregor2022-06-132-2/+2
| | | | | | | | | | | This is mostly about adding return types to methods that implement PHP interfaces, and not passing null to core functions that want a string. After this patch, and an update to return types in RemexHtml, tests/phpunit/integration/ has no more errors than in PHP 8.0. Bug: T289879 Bug: T289926 Change-Id: Ia424f5cc897070f4188ae126b5bf6a1f552db0e1
* Fix many typos in commentsMatěj Suchánek2022-05-101-1/+1
| | | | | | Found using IntelliJ's "Typo" code inspection. Change-Id: I746220ebe6e1e39f6cb503390ec9053e6518cf16
* Use str_starts_with/str_ends_withAryeh Gregor2022-05-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | All the other ways of doing it were ridiculous and much harder to read, and usually required repeating the needle expression (to get its length). I found these occurrences by grepping for various expressions, but I undoubtedly missed some. I didn't try replacing the many instances of strpos(...) === 0 with str_starts_with(...), because I think they're readable enough as-is (although less efficient). Likewise I didn't try porting strpos(...) !== false to str_contains(...). For case-insensitive comparisons, Tim Starling requested that we stick with substr_compare() because it's more efficient than calling strtolower(). On PHP < 8 these functions will be included with a polyfill via vendor/autoload.php. This is included at the beginning of includes/AutoLoader.php, so if our autoloader has been included the polyfill will be available. This means it should be safe to call these functions from any code that would not be usable without our autoloader. Three uses that Tim Starling identified as being performance-sensitive have been split out to a separate commit for porting after the switch to PHP 8. Change-Id: I113a8d052b6845852c15969a2f0e6fbbe3e9f8d9
* Use MainConfigNames instead of string literals, #2Aryeh Gregor2022-04-134-7/+12
| | | | | | | This covers all occurrences of /onfig->.*get( '/ in includes/. Undoubtedly there are still plenty more to go. Change-Id: I33196c4153437778496f40436bcde399638ac361
* phan: Remove PhanPossiblyUndeclaredVariable suppressionUmherirrender2022-03-301-0/+8
| | | | | | | | | Make phan stricter about conditional variable declaration Remaining false positive issues are suppressed. The suppression and the setting change can only be done together Bug: T259172 Change-Id: I1f200ac37df7448453688bf464a8250c97313e5d
* phan: Disable null_casts_as_any_type settingUmherirrender2022-03-213-0/+4
| | | | | | | | | | | Make phan stricter about null types by setting null_casts_as_any_type to false (the default in mediawiki-phan-config) Remaining false positive issues are suppressed. The suppression and the setting change can only be done together Bug: T242536 Bug: T301991 Change-Id: I0f295382b96fb3be8037a01c10487d9d591e7e01
* phan: Disable scalar_implicit_cast settingUmherirrender2022-03-182-0/+2
| | | | | | | | | Make phan stricter about scalar types by setting scalar_implicit_cast to false (the default in mediawiki-phan-config) Bug: T242536 Bug: T301991 Change-Id: Ia2fe30b17804186571722e728578121c8b75d455
* search: Improve null documentation on RevisionSearchResultTraitUmherirrender2022-03-141-2/+2
| | | | | | Found by phan strict checks Change-Id: I42457087198697924c42a23401d0027eb13cbff9
* Use updated ObjectFactory namespaceAlexander Vorwerk2022-03-091-1/+1
| | | | | | | Depends-On: I99c5e5664d2401c36a9890f148eba7c25e6e8324 Depends-On: I48ab818b2965da14af15ef370aa83ad9455badd9 Depends-On: I018371e4b77911e56152ca7b2df734afc73f58a5 Change-Id: I04ebdb52102f6191d49a9cc70b1f98308299e72f
* search: Fix various scalar types to match documentationUmherirrender2022-03-086-7/+7
| | | | | | Found by phan strict checks Change-Id: Ia5585536340b59af24a2dbab0cc9f1c739beacd3
* search: Use NS_MAIN instead of hard coded 0Umherirrender2022-03-073-4/+4
| | | | Change-Id: I97f7b6e3d2c56eb8bcb134a8fc6b7e718a4b96cc
* SearchEngineConfig: Make code example match extension namespace best practiceReedy2022-03-051-2/+2
| | | | Change-Id: I308af05c60401e69f6c3a9cc99240375861b3198
* rdbms: Deprecate getLazyConnectionRefAmir Sarabadani2022-03-031-1/+1
| | | | | Bug: T255493 Change-Id: Ie352142c7aa120f2f8985ddcf755a1f4583a5410
* Fix various documentation related to null typesUmherirrender2022-02-261-2/+2
| | | | | | | | The functions returning null or the class property is set explict null Found by phan strict checks Change-Id: I4a271093fb6526564d8083a08249c64cb21f2453
* Merge "Convert SearchFormWidget namespace checkboxes to OOUI"jenkins-bot2022-02-251-11/+26
|\
| * Convert SearchFormWidget namespace checkboxes to OOUIdylsss2022-02-241-11/+26
| | | | | | | | | | Bug: T301500 Change-Id: Ia2b994bb8f59fc3826721701e430e0c3b11fd952
* | Replace some more usages of Wikimedia\(suppress|restore)Warnings()Reedy2022-02-242-4/+6
|/ | | | Change-Id: I2eb133a9e32116cd155f59086245bc4d15ecbfcc
* Don't double-escape the ellipses in Language::truncateForVisual()C. Scott Ananian2022-02-101-1/+0
| | | | | | | | | | | | | | | | | | | | | | | It turns out this gets rid of a bunch of suppressed "SecurityCheck-DoubleEscaped" that appear to have been accurate warnings. There seems to have been some confusion about how ::truncateForVisual() is supposed to be used; in particular it is to be passed *unescaped* output, because it is not (generally speaking) safe to truncate HTML-escaped strings. The goal of ::truncateForVisual() is to have a specific number of codepoints in the output for display purposes, the encoding of those codepoints is not an issue (htmlspecialchars can be applied to the *return value*.) If you need a specific number of *bytes* you should be using ::truncateForDatabase(). If you want a certain number of *HTML bytes* then the ::truncateHtml() method is probably what you want. Slightly refactor some code in RevDelLogItem to avoid a false positive. Bug: T301205 Bug: T290624 Change-Id: I893362e049aedfa699043fcf27caf4815196f748
* Add getMemberCount() to Category to supersede getPageCount()Ammarpad2022-01-311-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | getPageCount() method return `cat_pages`, a value that makes sense on database table but is currently non-intuitve in object context where there's a value that better deserves the name. This makes it necessary for callers to repeat same logic to get the content pages count and a comment to explain the behavior. In this patch, getMemberCount() is added. It returns the total member count as getPageCount(), by default, does now. getPageCount() now takes a parameter and two public constants are provided for that; Category::COUNT_CONTENT_PAGES return count of all memebers to retain existing behavior, Category::COUNT_CONTENT_PAGES will return only content pages. In future there'd be no need for the parameter. Content pages will be returned always. Total member count is already accessible with getMemberCount(). Also improve return type doc of getId() and getName() Bug: T299350 Change-Id: I63c711ebc697c1a131a50910c854f956d4021254
* Merge "Special:Search Refactor powerSearchBox method"jenkins-bot2022-01-191-94/+103
|\
| * Special:Search Refactor powerSearchBox methodjoseph emmanuel kayode (iemarjay)2022-01-181-94/+103
| | | | | | | | | | | | Make the method simpler to comprehend. Change-Id: Ib102436a9b351ebd5a572a50ba94094b9afffa98
* | Merge "Special:Search Change namespace selector layout to fix ugly scroll on ↵jenkins-bot2022-01-111-16/+16
|\| | | | | | | mobile web"
| * Special:Search Change namespace selector layout to fix ugly scroll on mobile webjoseph emmanuel kayode (iemarjay)2022-01-111-16/+16
| | | | | | | | | | | | | | The horizontal scroll was as a result of using tables to handle layout. Bug: T294799 Change-Id: I043b5af6c9e095102bd7cffd16f239d3418e1190
* | Refactor global variables to use MediaWikiServices insteadTChin2022-01-103-8/+12
| | | | | | | | | | | | | | | | | | | | | | | | Automatically refactors wg prefixed globals to use MediaWikiServices config using Rector. Doesn't include files that set globals or files that fail CI. Rector Gist: https://gist.github.com/tchin25/7cc54f6d23aedef010b22e4dfbead228 * This patch uses a modified source code rector library for our specific use case and the rector will have different effects without it. A writeup for future reference is here: https://meta.wikimedia.org/wiki/User:TChin_(WMF)/Using_Rector_On_MediaWiki Change-Id: I1a691f01cd82e60bf41207d32501edb4b9835e37
* | Fix typos in comments (S)Siddharth VP2022-01-093-5/+5
|/ | | | Change-Id: Id86769ca81ff65707edde520585aa9ea117123e1
* SearchFormWidget: Minor cleanupReedy2021-12-221-16/+8
| | | | | | | | * Minor code simplfication * Remove some unnecessary temporary variables * Fix a couple of typos Change-Id: Ic730064e0704088cd8f204f2ed4313b0162ba02f
* Remove some more comments that literally repeat the codeThiemo Kreuz2021-12-091-2/+2
| | | | | | | | Nothing to learn from these. You can find a longer explanation in the comments in I93751e6. Change-Id: I195aae70fc282b58be5b18160783f27d38605d15
* Use PHP's [ $this, 'fn' ] callback syntax where possibleThiemo Kreuz2021-12-031-3/+1
| | | | | | | | | | | | PHP 8.1 will give us "first class callables" that look like e.g. $result = array_map( $this->fn(...), $array ); For now we can use $result = array_map( [ $this, 'fn' ], $array ); Change-Id: I7278c80c075d162da73aa45af1b6578310ce0624
* Introduce `Redirect(Lookup&Store)` services to handle redirectsDerick Alangi2021-12-011-5/+5
| | | | | | | | | | | | | | | | The concept of a redirect chain didn't really work for a value of max redirect > 1. In the ideal world, we just want to have a source which points to target (source -> target) discarding the concept of a redirect chain completely. Having something like: source -> target -> target1 -> target2 doesn't really work well with the current database design. NOTE: Support for $wgMaxRedirect will be removed soon hence deprecation without interfaces for replacement. Bug: T290639 Change-Id: I469de6f85e405e8ddbe7abaa5b99b77cb9cf415d
* Remove or replace usages of "sane"Reedy2021-11-222-6/+5
| | | | | Bug: T254646 Change-Id: I096b2cf738a1395a14f1d47bcbed0c2c686c2581
* Merge "Use Message::sizeParams to simplify code when building messages"jenkins-bot2021-10-151-6/+3
|\
| * Use Message::sizeParams to simplify code when building messagesUmherirrender2021-10-131-6/+3
| | | | | | | | Change-Id: Ic04d4dea86e61fb07b2a3b17acb6021fab6ae5ee
* | Rename ParserOutput::setCategoryLinks() and ::getCategoryLinks()C. Scott Ananian2021-10-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Make ::setCategory() consistent with the corresponding singular method, which is ::addCategory(), not ::addCategoryLink(). Also, don't return a value. This renaming is in preparation for factoring out a write-only base class from ParserOutput suitable to be used by Parsoid. Note that OutputPage does distinguish a 'category link' from a 'category list', and there are separate OutputPage::getCategories() and OutputPage::getCategoryLinks() methods. However, the category map in ParserOutput isn't exactly the same as either of these: it's actually a map (or list of pairs) of category name to sort key. Rename ParserOutput::getCategoryLinks() to ::getCategoryNames() in order to clarify that the concept involved is not the same as the OutputPage "category links" methods. Code search: https://codesearch.wmcloud.org/deployed/?q=-%3E(get%7Cset)CategoryLinks%5C(&i=nope&files=&excludeFiles=&repos= (Note that many of the code search matches are for the methods in OutputPage, which we are trying to disambiguate here.) Bug: T287216 Change-Id: Idb383d3d9ef7b76f8a0208a057a3cb8c639465c9
* | SECURITY: Pass escaped HTML to FullSearchResultWidget::buildMetaAlexander Vorwerk2021-09-301-3/+5
| | | | | | | | | | | | | | CVE-2021-41798 Bug: T285515 Change-Id: I771e44af5641f3065141fa3478f68ab05e31d71f
* | Merge "Change null to [] for html attributes on call of Html functions"jenkins-bot2021-09-291-1/+1
|\ \
| * | Change null to [] for html attributes on call of Html functionsUmherirrender2021-09-221-1/+1
| |/ | | | | | | Change-Id: Ia84f5b1f210396cba5daa7b9e8bb8c4069e0171d
* / docs: Fix nullable documentation for class propertiesUmherirrender2021-09-241-1/+1
|/ | | | Change-Id: I6d0577124d852103f485ffdc819876a13f6641c3
* Remove Title from signatures in CategoryViewerAryeh Gregor2021-09-131-1/+2
| | | | | Co-authored-by: Daniel Kinzler <dkinzler@wikimedia.org> Change-Id: Ie880482fe58b96809fdfd08ebf0825bdcf1d19d1
* build: Update mediawiki/mediawiki-phan-config to 0.11.0Umherirrender2021-09-072-0/+2
| | | | | | | Addition and remove of suppression needs to be done with the version update. Change-Id: I3288b3cefa744b507eadebb67b8ab08c86517c1c
* Merge "Remove unneeded variable assignment"jenkins-bot2021-09-041-1/+0
|\
| * Remove unneeded variable assignmentUmherirrender2021-09-031-1/+0
| | | | | | | | | | | | The variable already has the value Change-Id: I75f25cc944e30d91a65e1d2bb0abce7d671b19b8
* | Cleanup mixed space/tab line indentUmherirrender2021-09-041-2/+2
|/ | | | Change-Id: I833052a656b1ce419c0929f6f0514f2a33c2c4cc
* Merge "Make use of Html class utility methods in a few places"jenkins-bot2021-08-314-75/+116
|\
| * Make use of Html class utility methods in a few placesDannyS7122021-08-124-75/+116
| | | | | | | | | | | | | | | | | | | | | | | | | | Each files' changes can be reviewed independently There may be places in the files that I didn't catch - this is not meant to be an exhaustive replacement Even where it may make sense to use Html::element, Html::rawElement is used in this patch to avoid changing any behavior. Change-Id: I26eaacc65106f10a5066c31d82f6594a59ff1281