Commit graph

520 commits

Author SHA1 Message Date
jenkins-bot
ae5c51f354 Merge "Use Message::sizeParams to simplify code when building messages" 2021-10-15 23:21:38 +00:00
C. Scott Ananian
5ae946d3a6 Rename ParserOutput::setCategoryLinks() and ::getCategoryLinks()
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
2021-10-15 09:45:36 -07:00
Umherirrender
02c0e8b8e7 Use Message::sizeParams to simplify code when building messages
Change-Id: Ic04d4dea86e61fb07b2a3b17acb6021fab6ae5ee
2021-10-13 19:52:41 +00:00
Alexander Vorwerk
84e3bfcf36 SECURITY: Pass escaped HTML to FullSearchResultWidget::buildMeta
CVE-2021-41798

Bug: T285515
Change-Id: I771e44af5641f3065141fa3478f68ab05e31d71f
2021-09-30 15:49:36 +01:00
jenkins-bot
10490802e7 Merge "Change null to [] for html attributes on call of Html functions" 2021-09-29 16:20:41 +00:00
Umherirrender
769bdbf091 docs: Fix nullable documentation for class properties
Change-Id: I6d0577124d852103f485ffdc819876a13f6641c3
2021-09-24 00:54:53 +00:00
Umherirrender
362a48e316 Change null to [] for html attributes on call of Html functions
Change-Id: Ia84f5b1f210396cba5daa7b9e8bb8c4069e0171d
2021-09-22 22:47:28 +02:00
Aryeh Gregor
ceda8ac60e Remove Title from signatures in CategoryViewer
Co-authored-by: Daniel Kinzler <dkinzler@wikimedia.org>
Change-Id: Ie880482fe58b96809fdfd08ebf0825bdcf1d19d1
2021-09-13 16:14:06 +00:00
Umherirrender
07b499fbcf build: Update mediawiki/mediawiki-phan-config to 0.11.0
Addition and remove of suppression needs to be done with the version
update.

Change-Id: I3288b3cefa744b507eadebb67b8ab08c86517c1c
2021-09-07 17:19:05 +02:00
jenkins-bot
1e76c7bfb0 Merge "Remove unneeded variable assignment" 2021-09-04 23:48:21 +00:00
Umherirrender
2e4ee47c3d Cleanup mixed space/tab line indent
Change-Id: I833052a656b1ce419c0929f6f0514f2a33c2c4cc
2021-09-04 00:52:31 +02:00
Umherirrender
032b03dc7a Remove unneeded variable assignment
The variable already has the value

Change-Id: I75f25cc944e30d91a65e1d2bb0abce7d671b19b8
2021-09-03 22:51:22 +00:00
jenkins-bot
91937218cb Merge "Make use of Html class utility methods in a few places" 2021-08-31 15:39:39 +00:00
Umherirrender
864068d000 Remove unneeded explicit true/false inside conditions
The non-strict conditions in if/while are true/false without the check.

In some situation the true/false is removed, because it is known to be a
bool (by is_bool check or type hint)

Change-Id: I5ca4c4771af25d2e785e82732df204a73653886e
2021-08-17 21:52:34 +02:00
DannyS712
3d7ef1762c Make use of Html class utility methods in a few places
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
2021-08-12 08:49:37 +00:00
Thiemo Kreuz
69242b0876 Various updates and fixes to PHPDoc documentation
Some minor updates I collected in my local dev environment the
past months.

Change-Id: I30d5339bc262d54ba76e2860a3a3e9e5f002fdc3
2021-08-09 09:26:23 +02:00
Kunal Mehta
a85f569dd1 Revert "Use CsrfTokenSet as CSRF token source"
This reverts commit 0d75fdb4f7.

Bug: T287542
Change-Id: Iedd3461869f973f8d621a39e6ad4674cbb577551
2021-08-05 15:48:26 -07:00
jenkins-bot
b1a1d243dd Merge "Inject services into SearchFormWidget" 2021-08-04 07:45:34 +00:00
Umherirrender
63c6b77d2a Inject services into SearchFormWidget
Replace deprecated Language::convertNamespace

Necessary services in SpecialSearch already injected

Explicit pass content language to existing call to make different more
visible between both calls

Bug: T252095
Change-Id: I4d4bd6e1246e57d952b73cb99a4a129028d7ff5b
2021-08-04 03:40:20 +02:00
Umherirrender
a29b542d6f search: Replace deprecated Language::autoConvertToAllVariants
Bug: T252095
Change-Id: Ibe8c40bbee873520dd86333d85e7c6f82555d425
2021-08-04 03:36:51 +02:00
libraryupgrader
5357695270 build: Updating dependencies
composer:
* mediawiki/mediawiki-codesniffer: 36.0.0 → 37.0.0
  The following sniffs now pass and were enabled:
  * Generic.ControlStructures.InlineControlStructure
  * MediaWiki.PHPUnit.AssertCount.NotUsed

npm:
* svgo: 2.3.0 → 2.3.1
  * https://npmjs.com/advisories/1754 (CVE-2021-33587)

Change-Id: I2a9bbee2fecbf7259876d335f565ece4b3622426
2021-07-22 03:36:05 +00:00
Reedy
ac4151ff33 s/unrelevant/irrelevant
Change-Id: I29b6c18c9539e80d788e6c3568fea1b129c7a48b
2021-07-20 15:21:32 +01:00
Petr Pchelko
0d75fdb4f7 Use CsrfTokenSet as CSRF token source
Change-Id: I079d2c802d9b48d6abf7f37fa9ef7dafac631345
2021-07-12 14:19:15 -07:00
Amir Sarabadani
b8d11cd353 Fix code comment
We don't use "# #" for commenting

Change-Id: Iad1079be1d82ed30b7d0ab1f467136a795c14a42
2021-07-10 18:46:35 +02:00
Fomafix
356f1b72ef Use IEC prefixes instead of SI prefixes for byte sizes (docs+backend)
This change doesn't change any UI messages.

Bug: T54687
Change-Id: Ia62899a2a6fe8910618c35cd667291e397ddb055
2021-06-28 11:59:09 +01:00
DannyS712
7523df7d1f Remove the AugmentPageProps class, unused
Added to the release notes as a breaking change,
no deprecation period because there are no known
uses anywhere on codesearch

Bug: T248215
Change-Id: If7368ffdd09ab69f7a40501ef9d8a90660db7f58
2021-06-24 07:01:58 +00:00
DannyS712
47d70dbfba Post Revision-removal cleanup
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
2021-06-24 00:32:39 +00:00
Thiemo Kreuz
2ba01c7ee7 Remove some more comments that literally repeat the code
… including PHPDoc tags like `@return <type> $variableName`.
A return value doesn't have a variable name. I can see that
some people do this intentionally, repeating the variable
name that was used in the final `return $var;` at the end
of a method. This can indeed be helpful. I leave a lot of
these untouched and removed them only when it's obviously
wrong, or does not provide any additional information in
addition to what the code already says.

Change-Id: Ia18cd9f25ef658b08ad25b97a744897e2a8deffc
2021-06-18 21:23:56 +00:00
Thiemo Kreuz
26bd5ff256 api: Fix prefixsearch returning the entire database
As of now, an input like "[" that contains nothing but invalid
characters behaves odd: The prefixsearch API returns the entire
database, alphabetically ordered.

This behavior exists ever since this code was introduced in
Iaffe30a (2014).

While this might be used as a "feature", I really don't think it
is intentional:
* The way the code is arranged executes an SQL query with a
  pointless `LIKE '%'` that doesn't do anything but possibly
  wasting CPU resources. This doesn't look intentional.
* There are much better APIs when you really want to list all
  pages.
* I would expect an input like "*", "%", or "" to return all
  pages. But neither of these inputs does this. Only some very
  strange inputs like "[" do.
* I would argue that "[" should behave the same as "", i.e. as
  if no useful input is given.
* Since I877297f (2020) we normalize e.g. "[[foo]]" to "foo",
  for convenience. Since then such an input works as expected,
  instead of returning the entire database. This leaves titles
  that contain nothing but invalid characters as the only
  edge-case.

Change-Id: Ib2cbf315ed7c3736391362be6d69599c58e690db
2021-06-17 16:25:43 +02:00
DannyS712
c80841f58b Remove comments that repeat the code
Don't provide any addition information

Change-Id: I4f474537056e34bac74b0d0cd5b4beb800664f90
2021-06-02 08:03:09 +00:00
James D. Forrester
df5eb22f83 Replace uses of DB_MASTER with DB_PRIMARY
Just an auto-replace from codesniffer for now.

Change-Id: I5240dc9ac5929d291b0ef1c743ea2bfd3f428266
2021-04-29 09:24:31 -07:00
vladshapik
9cc797695b Hard deprecate User ::isIP, ::getOptions
Bug: T275602
Change-Id: Id4be13751ca0a900e51214c1855a4624077a5a62
2021-04-26 16:10:24 +00:00
DannyS712
ee6f4b5d88 SearchEngineFactory: inject load balancer
Change-Id: I26eda1a351a09c0660f4b8c4abaecf5963d9db5d
2021-04-22 20:48:10 +00:00
Petr Pchelko
eec331897e Replace various usages of PermissionManager with Authority
Change-Id: Idc303bdbbe2b7ce9e7011ee1f3926c781c56af71
2021-03-17 20:23:58 -06:00
daniel
f9cbc3888c SearchNearMatcher: don't create WikiPage for bad titles.
WikiPage should not be instantiated for titles that do not represent
editable pages.

Bug: T276387
Change-Id: If14cce13b6c2aeff75c3053ff7c0a3d18f354fd8
2021-03-03 20:38:59 +01:00
Umherirrender
8de3b7d324 Use static closures where safe to use
This is micro-optimization of closure code to avoid binding the closure
to $this where it is not needed.

Created by I25a17fb22b6b669e817317a0f45051ae9c608208

Change-Id: I0ffc6200f6c6693d78a3151cb8cea7dce7c21653
2021-02-11 00:13:52 +00:00
jenkins-bot
d749cbdf38 Merge "Use __CLASS__/::class to define callback for array_map/_filter/usort" 2021-02-05 03:14:42 +00:00
jenkins-bot
746af0c6f7 Merge "search: restore search suggestions from non-main namespaces" 2021-02-04 21:54:13 +00:00
Timo Tijhof
6404da3d39 rdbms: Remove outdated MySQL 4 references and fix doc URLs
- Remove or clarify ancient comments referencing MySQL 4.

- Oracle can't afford to host small HTML files for longer than two
  years, as such they make a point to break their URLs after a while.
  Update our references to the last 5.x release for now, where the same
  information resides (instead 404 or redirect to MySQL 8 docs).

Bug: T34217
Change-Id: I322cc8936f96c2545c63e7c9c1f5fa241e2b8c18
2021-01-30 22:47:33 +00:00
Umherirrender
e4d1a2c8bd Use __CLASS__/::class to define callback for array_map/_filter/usort
Change-Id: I3519dd5a1ce1ea688de602190cd74755c400c717
2021-01-22 16:39:29 +00:00
Amir Sarabadani
c33876f834 Migrate text table to abstract schema
For MySQL/Sqlite, drop the table options, they are for MySQL < 5.0 which
was released in 2003 and not any use today.

For Postgres, rename pagecontent table to text, approved as part of the
RFC. Swap order of creating auto-generated tables and manual tables.

Bug: T230428
Bug: T164898
Change-Id: Id7510b80beed7a7297353094a57d5e2d4f12fc64
2021-01-09 16:07:54 +01:00
James D. Forrester
abdc94a3da Swap out uses of User->isLoggedIn() with ->isRegistered()
Bug: T270450
Change-Id: I90ff94a553ebae9a4ef97c25c333f067f19c327d
2020-12-22 03:13:37 +00:00
James D. Forrester
04e46a3988 Upgrade wikimedia/object-factory from 2.1.0 to 3.0.0
Bug: T267074
Change-Id: Ic9cf63249744cd61bbe238c005630fc82db41d41
Depends-On: I2eac3e96eafdb540824bbc3ddc0b6cc1aed76bf2
2020-11-17 02:29:54 +00:00
misdre
472f27d214 search: restore search suggestions from non-main namespaces
Search suggestions are picked from the main namespace only,
with this change pages from other namespaces such as Category:
can also be suggested when prefixing searches with a namespace

Bug: T213842
Change-Id: Ia4bd36efaca4595815c676ad1985e8a80c054471
2020-11-17 00:31:42 +01:00
jenkins-bot
1976283835 Merge "Update a lot of unspecific "array" types in PHPDocs" 2020-11-13 21:48:24 +00:00
Umherirrender
d2dd124e5b Replace deprecated WikiPage::factory in search related classes
Change-Id: I4f61e222bc9dfcc504491845ce165bd99c1b9b8c
2020-11-11 23:03:32 +01:00
jenkins-bot
929381a81f Merge "Use LinkBatchFactory" 2020-11-01 20:48:02 +00:00
Umherirrender
c85a43561e Improve class property documentation
Reformat existing documentation to match the format

Change-Id: I190b54b5e962f17bab6502dd1b3c02f11dc926d2
2020-10-30 10:38:58 +01:00
Umherirrender
d621adbcb6 build: Updating mediawiki/mediawiki-codesniffer to 32.0.0
Exclude failing sniff to fix in follow ups
Includes some simply fix, most are autofix

Change-Id: I5bb4743f08618bb6226bc2a4cc7f4d73a7ad142d
2020-10-28 20:06:22 +00:00
Thiemo Kreuz
b0130ca649 Update a lot of unspecific "array" types in PHPDocs
This includes fixing some mistakes, as well as removing
redundant text that doesn't add new information, either because
it literally repeats what the code already says, or is actually
duplicated.

Change-Id: I3a8dd8ce57192deda8916cc444c87d7ab1a36515
2020-10-28 11:01:33 +01:00