Commit graph

6 commits

Author SHA1 Message Date
Timo Tijhof
1f34ac4526 title: Remove dated comment about inNamespace(), overall doc cleanup
* The Title::inNamespace() method discouraged use of getNamespace()
  for comparison.

  This was added 10 years ago in r103893 (commit 3414e91bae),
  however no such "change" has been made, and the new LinkTarget
  stable interface and TitleValue class contains the same getNamespace()
  method, and no warning against its use.

  My main reason for removing this comment is so that avoid fear
  against using `in_array()` with TitleValue->getNamespace() which
  this comment seems to discourage. While Title has plural
  inNamespaces(), TitleValue does not. This seems fine, as one can
  simply use in_array for more complex use cases where a range or
  list is compared against.

* Fix Doxygen warnings about invalid or unsupported XML tags
  such as `<a>`, `<siteinfo>` etc. Rephase or use backtics,.

* Fix useless IDE tooltips and Doxygen output by removing empty stubs
  from method overrides that add no new information, yet obscured
  the otherwise inherited parent destination which does have useful
  information.

* Clarify that `renderForComment` must not be mixed with other ones.
  This seems to be how it is intended. Upon realizing that, I think
  this is unreasonable and should perhaps be removed. For now, I've
  documented the hack that it seems to exist for.

* Consistently use imperative mood when phrasing method docs, and
  consistently use a brief first line description, and
  consistently separate it from other paragraphs and annotations
  with one line break.

Change-Id: I7e1819a5d7124c635de84bc64d2371a122195928
2022-01-18 22:25:09 +00:00
James D. Forrester
0958a0bce4 Coding style: Auto-fix MediaWiki.Usage.IsNull.IsNull
Change-Id: I90cfe8366c0245c9c67e598d17800684897a4e27
2020-01-10 14:17:13 -08:00
Timo Tijhof
bee9f4db96 Remove various redundant '@license' tags in file headers
Redundant given this is the project-wide license already,
especially in file headers that already include the GPL license
header.

This and other minor fixups based on feedback from Ie0cea0ef5027c7e5.

* Add @file where missing.
* Move @ingroup and @deprecated from file to class doc where needed.

Change-Id: I7067abb7abee1f0c238cb2536e16192e946d8daa
2018-01-12 18:15:11 +00:00
This, that and the other
ef8bc825c6 Handle missing namespace prefix in XML dumps more gracefully
If an XML dump of a wiki is exported using dumpBackup.php, and there are
pages in a namespace that is not registered (perhaps because of a missing
extension), they will appear in the dump in the form

<page> ... <title>PageTitle</title> <ns>1234</ns> ... </page>

This caused the ForeignTitle code to raise an undefined offset error,
because it assumed that the <title> element was of the form
"Namespace:PageTitle" when <ns> was nonzero. This assumption is not valid.

Now, the importation of such dumps will no longer throw errors and the
pages will be correctly imported, although possibly to unexpected
locations.

Bug: T114115
Change-Id: I0271435dc208e7ea118339584f8a0e359c96113a
2017-01-01 09:11:45 +00:00
Kunal Mehta
6e9b4f0e9c Convert all array() syntax to []
Per wikitech-l consensus:
 https://lists.wikimedia.org/pipermail/wikitech-l/2016-February/084821.html

Notes:
* Disabled CallTimePassByReference due to false positives (T127163)

Change-Id: I2c8ce713ce6600a0bb7bf67537c87044c7a45c4b
2016-02-17 01:33:00 -08:00
This, that and the other
37b4cd5da2 Proper namespace handling for WikiImporter
Up until now, the import backend has tried to resolve titles in the XML
data using the regular Title class. This is a disastrous idea, as local
namespace names often do not match foreign namespace titles.

There is enough metadata present in XML dumps generated by modern MW
versions for the target namespace ID and name to be reliably determined.
This metadata is contained in the <siteinfo> and <ns> tags, which
(unbelievably enough) was totally ignored by WikiImporter until now.
Fallbacks are provided for older XML dump versions which may be missing
some or all of this metadata.

The ForeignTitle class is introduced. This is intended specifically for
the resolution of titles on foreign wikis. In the future, an
InterwikiTitle class could be added, which would inherit ForeignTitle
and add members for the interwiki prefix and fragment.

Factory classes to generate ForeignTitle objects from string data, and
Title objects from ForeignTitle objects, are also added.

The 'AfterImportPage' hook has been modified so the second argument is a
ForeignTitle object instead of a Title (the documentation was wrong,
it was never a string). LiquidThreads, SMW and FacetedSearch all use this
hook but none of them use the $origTitle parameter.

Bug: T32723
Bug: T42192
Change-Id: Iaa58e1b9fd7287cdf999cef6a6f3bb63cd2a4778
2014-12-10 22:24:47 +11:00