Mostly unspecific arrays that can be made more specific. This patch
intentionally doesn't touch any code, only comments.
Change-Id: I5b4690e6160c6c543f9fcb2f62c41f6329d48bdb
Returning true is the same as returning nothing. It's only meaningful
when a hook handler can also return false. Some actually do this.
I'm not touching these.
See Icccf60b for the reasoning why the added `@return void` are
beneficial.
Change-Id: I6de7addee853ff183058e6c84e87a5b275c785e8
No other access in the Title class contains a `get` prefix, so this
makes the title methods consistent.
Bug: T373047
Change-Id: I4a3a7498462b7b3b6143dc61f529e526ccb112e2
Added `categories` property in the lua title class which fetches page
categories. Analogous to getContent() which fetches page content. This
increments the expensive function count.
This enables category-specific editnotices (T85372) and other use-cases.
Bug: T50175
Change-Id: Ie8e0762c537374e6086abe9f9916b8200582776a
Made the earlier semantically-correct Hindi localization an alias
and added the suggested Hindi localization preferred by the Hindi
Wikipedia community members the primary Hindi localization.
Bug: T366235
Followup-To: I811594311abb4e1d3e44ce3b284d11f72836cbdd
Change-Id: I2f8c7b1dfe22f210773507e86f4b12edd3fd196b
When modules are first loaded by `require` in package.lua, it checks
for a return value with `if res then`. If that check fails, the module
will be cached with the default value `true` at line 109, and that
value is then returned.
That check should be changed to `if res ~= nil then`, because
otherwise a module with a return value of `false` will be cached with
the value `true`.
This also necessitates a corresponding change to the check at line 93,
which is when `package.loaded` is initially checked to see if a package
has been loaded before, as that value could be `false`.
Bug: T362045
Change-Id: Id42e26a922c13971c25ed8654e822dc6fdcb6ca7
`mw.clone` is called on the global table for each new `{{#invoke:}}`,
which is a major contributor to loading times on large pages. This
change introduces various speed optimisations that make it around
15% faster:
* `recursiveClone` is declared outside of the main function, to avoid
generating a new closure each time `mw.clone` is called.
* This means `tableRefs` has to be passed as an argument to
`recursiveClone` instead of being an upvalue, which also decreases
access time.
* `recursiveClone` is only called after a `type` then `tableRefs` check
confirms a value is an unseen table, meaning it's only called when
needed, not for every key/value pair (which add noticeable overhead
when cloning large tables).
* `getmetable` is only called once, not twice, by using a local
variable.
* `tableRefs[elt]` is only accessed once, by using a ternary operator.
* Any global accesses have been replaced by local ones.
Bug: T357199
Change-Id: I51593a971f0be728255723ca300d1ce692ead256
`mw.loadJsonData` in mw.lua throws an error if the input argument is
not a string. The error message should refer to the type of the input
argument `module`, not that of the variable `arg` (which is usually
undeclared, giving the type `nil`).
This also necessitates updating test `mw.loadJsonData, bad title (1)`
in CommonTests.lua, which checks for the error message if the input
is the number 0; the correct message should say "got number", not
"got nil".
Bug: T364987
Change-Id: I8362e91489a8ddc4c890e2799892f692c497c9b9