These new classes provide a mechanism for defining the
behavior of slots, like the content models it supports.
This acts as an extension point for extensions that need
to define custom slots, like the MediaInfo extension
for the SDC project.
Bug: T194046
Change-Id: Ia20c98eee819293199e541be75b5521f6413bc2f
Currently, not all actions are processed by User::isBlockedFrom(). This results
in users who are partially blocked from specific pages to be blocked from
moving and deleting all pages.
Bug: T208862
Change-Id: I6312a36911e5b73d773452fefef7ff25b9af08a4
Non-breaking change. Remaining uses are public interfaces (a constant, two
globals, a config sub-parameter, SQL queries, storage function names), one i18n
message key, and a whole lot of maintenance scripts with calls to the deprecated
function wfWaitForSlaves().
Change-Id: I6ee5ca92ccf6a80c08f53d9efe38ebb4b05064d7
Return existing errors instead of empty array in checkUserConfigPermissions().
Returning an empty array wiped out previously-found errors.
Also add test coverage for patrol action.
Bug: T206130
Change-Id: I2df0551c5837adc578b27082ab6ba2ac95d937f8
The information for a title already in the select result.
Give it to Revision class to avoid extra Title::newFromId in
Revision::ensureTitle for each row
Change-Id: I6f1a936ce2ed1834feb29850e65a497dafe35238
Added spaces around .
Removed empty return statement which are not required
Removed return after phpunit markTestIncomplete,
which is throwing to exit the test, no need for a return
Change-Id: I2c80b965ee52ba09949e70ea9e7adfc58a1d89ce
Title::getRootText() uses the text form (spaces) of the title, while
$wgRawHtmlMessages was specifying them in dbkey form (underscores).
And add tests while we're at it. Which spotted that the existing
code didn't work. Whoops. Fixed.
Change-Id: I05eea553c588e0f99f862e07ad15386507ed0728
As it turns out this is super easy: we do require edit permissions
for some actions but not for delete, so it is enough to just
whitelist it.
Also fix SkinTemplate to not show the undelete action when the
user can undelete some pages but not the current one.
Bug: T200176
Change-Id: I0d326e6afde7ad2c9f7cb7f19ecc6c275c1ef65c
...by instance caching the result on the LinkTarget object.
Title::getPrefixedText() is an extremely hot function that has been
fully optimized over the years due to its usage basically everywhere in
MediaWiki.
Apply the same treatment to TitleFormatter, but keep the caching as part
of the LinkTarget instance so we can share caches across Title and
TitleFormatter. Once Title is switched over to using TitleFormatter
internally, we can probably centralize the cache again, and get rid of
the public but marked @private member variables.
Bug: T201801
Change-Id: I4ae2d6b176f69f66720473aeae85e39a601a9781
Since this is pretty hot code, avoid the performance hit of a function
call when we can directly access the property.
Change-Id: I287de5eb003582b5704e9d93e2fc99d16c0ffb2a
This does not handle the error message when viewing a non-existent
page (noarticletext-nopermission), but that seems complicated to
get right.
Change-Id: Ia4e798b9a646908bd84fec5a53db929040e61aa7
This relied on TitleCodec throwing MalformedTitleException in the
past, but that is fragile as other parts of the logic do not
expect null.
Bug: T200456
Change-Id: I1aca3971e2a9c0b1fe3adbcf34f3ee65b2271234
To limit the likelihood of incidents like T189665, the ability to
edit sitewide CSS/JSON/JS is split out from editinterface, into
separate 'editsitecss', 'editsitejson' and 'editsitejs' rights.
editsitecss, editsitejs, and the right to edit another (potentially
more privileged) user's personal CSS/JS is removed from sysops, and
a new user group, interface-admin, is created specifically for that
task (along with a new grant group 'editsiteconfig').
interface-admin is granted to the first user of a new wiki, along with
sysop and bureaucrat.
Bug: T120886
Bug: T190015
Depends-On: Ia9b2ea1450aff6121dc0f3777bf029292c8aaad9
Change-Id: Ifefd872640642441e26f8b2f144ffe4b88d2eb12
Previously it would affect all actions that use Title::userCan.
This used to be less noticable, but recently was expanded to include
the 'read' action. This only affected the case where both
$wgBlockDisablesLogin and $wgEmailConfirmedToEdit were enabled.
I don't think anyone was relying on the old behaviour as it was
undocumented, and only affected obscure permissions (checked with
Title::userCan and not depending on "edit" rights)
Follow-up b675be2083
Bug: T143790
Change-Id: I4ad93ed78de4f1ed444f73df6dc26d405a67e553
$this->mPageLanguage[0] get serialized with ->getCode() so it can
deserialized with Language::factory( $this->mPageLanguage[0] ).
Change-Id: I3e2bf51eb088d064d809549cfb8d15cfb464b1a9
Find: /isset\(\s*([^()]+?)\s*\)\s*\?\s*\1\s*:\s*/
Replace with: '\1 ?? '
(Everywhere except includes/PHPVersionCheck.php)
(Then, manually fix some line length and indentation issues)
Then manually reviewed the replacements for cases where confusing
operator precedence would result in incorrect results
(fixing those in I478db046a1cc162c6767003ce45c9b56270f3372).
Change-Id: I33b421c8cb11cdd4ce896488c9ff5313f03a38cf
`$a <=> $b` returns `-1` if `$a` is lesser, `1` if `$b` is lesser,
and `0` if they are equal, which are exactly the values 'sort()'
callbacks are supposed to return.
It also enables the neat idiom `$a[x] <=> $b[x] ?: $a[y] <=> $b[y]`
to sort arrays of objects first by 'x', and by 'y' if they are equal.
* Replace a common pattern like `return $a < $b ? -1 : 1` with the
new operator (and similar patterns with the variables, the numbers
or the comparison inverted). Some of the uses were previously not
correctly handling the variables being equal; this is now
automatically fixed.
* Also replace `return $a - $b`, which is equivalent to `return
$a <=> $b` if both variables are integers but less intuitive.
* (Do not replace `return strcmp( $a, $b )`. It is also equivalent
when both variables are strings, but if any of the variables is not,
'strcmp()' converts it to a string before comparison, which could
give different results than '<=>', so changing this would require
careful review and isn't worth it.)
* Also replace `return $a > $b`, which presumably sort of works most
of the time (returns `1` if `$b` is lesser, and `0` if they are
equal or `$a` is lesser) but is erroneous.
Change-Id: I19a3d2fc8fcdb208c10330bd7a42c4e05d7f5cf3
The exists() check performs most of what getCanonicalName() will
do a second time. Make the code more simple, DRY, and performant,
by aiming for EAFP instead of LBYL.
Also fixes a potential bug where it was using current namespace
from $this for exists(), but subject namespace (stored as $namespace)
for getCanonicalName().
Change-Id: I11539bde00bf3df3270869f40fbd62083588b50c
Also recognise MediaWiki: JSON pages (with the existing protection of
the editinterface right).
Bug: T76554
Change-Id: Idba166d82ee6dd507d7345c9bdbefc8ca78ed7b4
Only use in Wikimedia production is in GlobalCssJs, below.
Depends-On: I7543fe9ea393901379c16c4f0b1e96fa20955b6f
Change-Id: I66292b179d948e46dba3513f50c3d36012765a9d
Storing the user name or IP in every row in large tables like revision
and logging takes up space and makes operations on these tables slower.
This patch begins the process of moving those into one "actor" table
which other tables can reference with a single integer field.
A subsequent patch will remove the old columns.
Bug: T167246
Depends-On: I9293fd6e0f958d87e52965de925046f1bb8f8a50
Change-Id: I8d825eb02c69cc66d90bd41325133fd3f99f0226
This allows CommentStore to be added to MediaWikiServices
without the need of an aditional Factory.
This change includes a compatability layer to allow the behaviour
from 1.30 to continue to be used while deprecated.
CommentStore::newKey has been deprecated.
Keys are now passed into the public methods of CommentStore
where needed.
The following CommentStore methods have had their signatures changed
to introduced a $key parameter, but when used in conjunction with
CommentStore::newKey behaviour will remain unchanged:
* CommentStore::getFields
* CommentStore::getJoin
* CommentStore::getComment
* CommentStore::getCommentLegacy
* CommentStore::insert
* CommentStore::insertWithTemplate
Change-Id: I3abb62a5cfb0dcd456da9f4eb35583476ae41cfb